/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --green: #4ade80;
    --green-dark: #22c55e;
    --red: #f43f5e;
    --red-dark: #e11d48;
    --blue-accent: #3b82f6;
    --bg-dark: #0a0a0f;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --glass-bg: rgba(20, 20, 30, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'Geist', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    min-height: 100vh;
    color: var(--text-primary);
    overflow: hidden;
}

/* Background */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/axiom-web-bg.jpg');
    background-size: cover;
    background-position: center;
    z-index: -1;
}

/* Platform Tabs */
.platform-tabs {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    z-index: 100;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.platform-tabs.hidden {
    opacity: 0;
    visibility: hidden;
}

/* CA Text Display Bottom */
.ca-display-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 16px;
    margin-bottom: 0;
    font-family: 'Geist Mono', monospace;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.ca-display-bottom:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.ca-display-bottom.hidden {
    display: none;
}

.ca-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.ca-text {
    color: var(--text-primary);
    user-select: all;
}

/* Admin Modal */
.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    width: 320px;
    max-width: 90vw;
}

.admin-modal-content h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.admin-input-group {
    margin-bottom: 16px;
}

.admin-input-group label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
}

.admin-input-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Geist Mono', monospace;
    transition: all 0.2s ease;
}

.admin-input-group input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.admin-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.admin-btn {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.admin-btn.cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.admin-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

.admin-btn.submit {
    background: var(--green);
    color: #000;
}

.admin-btn.submit:hover {
    background: var(--green-dark);
}

.admin-message {
    margin-top: 12px;
    font-size: 13px;
    text-align: center;
    min-height: 20px;
}

.admin-message.success {
    color: var(--green);
}

.admin-message.error {
    color: var(--red);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Controls Panel */
.controls-panel {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(10, 10, 12, 0.7);
    /* Slightly transparent dark */
    backdrop-filter: blur(16px);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* Finer border */
    width: 280px;
    z-index: 100;
    overflow-y: auto;
    max-height: 90vh;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.controls-panel.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%) translateX(-20px);
}

.controls-panel h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 11px;
    /* Slightly smaller/cleaner */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
}

.input-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    /* Match Upload Button logic */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Geist Mono', monospace;
    transition: all 0.2s ease;
}

.input-group input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

/* Hide number input spinner arrows */
.input-group input[type="number"]::-webkit-outer-spin-button,
.input-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-group input[type="number"] {
    -moz-appearance: textfield;
}

/* Style file input to match theme */
.input-group input[type="file"] {
    padding: 10px 14px;
    cursor: pointer;
    color: var(--text-secondary);
}

.input-group input[type="file"]::file-selector-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 6px 12px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    margin-right: 10px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.input-group input[type="file"]::file-selector-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Calculated Values */
.calculated-values {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 16px;
}

.calc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.calc-item:last-child {
    margin-bottom: 0;
}

.calc-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.calc-value {
    font-size: 14px;
    font-weight: 600;
    font-family: 'Geist Mono', monospace;
}

.calc-value.profit {
    color: var(--green);
}

.calc-value.loss {
    color: var(--red);
}

/* Hide UI Button */
.hide-ui-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    font-family: inherit;
}

.hide-ui-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.hide-ui-btn kbd {
    font-size: 11px;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: inherit;
}

/* Center Layout */
.center-layout {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* Card Wrapper */
/* UPDATE: Resized to 840 x 570 based on user canvas */
.card-wrapper {
    position: relative;
    width: 840px;
    height: auto;
    aspect-ratio: 840 / 570;
}

/* PNL Card */
.pnl-card {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.card-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Card Content Overlay */
.card-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    display: block;
}

/* Username Handle - Explicitly Positioned */
.user-handle {
    position: absolute;
    left: 98.17px;
    top: 452.35px;
    width: 287.39px;
    height: 46.13px;
    font-family: 'Geist', sans-serif;
    font-weight: 400;
    /* Reduced from 500 */
    font-size: 38px;
    line-height: 46.13px;
    letter-spacing: -0.02em;
    color: #ffffff;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
}

/* PNL Amount Display - Just the Number */
.progress-section {
    position: absolute;
    left: 50.85px;
    top: 186.98px;
    width: 321.83px;
    height: 65.14px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.pnl-number-container {
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 4px;
    /* Move closer to left edge */
}

.pnl-number-text {
    font-size: 59px;
    font-weight: 700;
    /* Thicker weight */
    color: #000000;
    white-space: nowrap;
    font-family: 'Geist', sans-serif;
    letter-spacing: -0.02em;
    line-height: 65.14px;
}

/* Values Section - Absolute Items */
.values-section {
    /* Container styles removed, items are absolute relative to card-content */
}

.abs-value {
    position: absolute;
    font-family: 'Geist', sans-serif;
    font-weight: 500;
    font-size: 26px;
    color: #ffffff;
    white-space: nowrap;
    width: 161.67px;
    height: 28.42px;
    line-height: 28.42px;
    display: flex;
    align-items: center;
    letter-spacing: 0em;
}

/* Specific Positions */
.val-percentage {
    left: 301.73px;
    top: 296.9px;
}

.val-percentage.profit {
    color: #2edda8;
}

.val-percentage.loss {
    color: #ec397a;
}

.val-invested {
    left: 299.73px;
    top: 337.9px;
}

.val-position {
    left: 299.73px;
    top: 378.9px;
}

.val-coin-name {
    left: 33.73px;
    top: 122px;
    width: 272.1px;
    height: 45.99px;
    font-size: 42px;
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 45.99px;
}

.profile-pic-display {
    position: absolute;
    left: 33.78px;
    top: 449.78px;
    width: 47.46px;
    height: 47.46px;
    border-radius: 3px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.1);
}

.padre-logo {
    position: absolute;
    left: 85.2px;
    /* Scaled from 201 */
    top: 77.2px;
    /* Scaled from 182 */
    width: 182px;
    /* Scaled from 429 */
    height: 40px;
    /* Scaled from 94 */
    object-fit: contain;
    pointer-events: none;
    z-index: 1;
}

/* Padre Platform Specifics */
.pnl-card[data-platform="padre"] .val-coin-name {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 44.5px;
    /* Scaled 105pt */
    letter-spacing: -0.025em;
    left: 84.8px;
    /* Scaled 199.87 */
    top: 247.5px;
    /* Scaled 583.52 */
}

/* Padre PNL Position Override - PNL Amount */
.pnl-card[data-platform="padre"] .progress-section {
    left: 75px;
    top: 319.5px;
    width: 252.5px;
}

/* Padre PNL Text Override */
.pnl-card[data-platform="padre"] .pnl-number-text {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 62.7px;
    -webkit-text-stroke: 0;
    letter-spacing: 0;
}

/* Padre Colors */
.pnl-card[data-platform="padre"] .pnl-number-container.profit .pnl-number-text {
    color: #3cd287;
}

.pnl-card[data-platform="padre"] .pnl-number-container.loss .pnl-number-text {
    color: #e73a44;
}

/* Padre Static Labels */
.padre-lbl {
    display: none;
    position: absolute;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 19px;
    color: #808080;
    top: 407.1px;
    /* Scaled 959.6 */
}

.pnl-card[data-platform="padre"] .padre-lbl {
    display: block;
}

.lbl-invested {
    left: 85.5px;
}

/* Scaled 201.43 */
.lbl-position {
    left: 234.8px;
}

/* Scaled 553.43 */
.lbl-pnl {
    left: 385.8px;
}

/* Padre Values Overrides */
.pnl-card[data-platform="padre"] .val-invested,
.pnl-card[data-platform="padre"] .val-position,
.pnl-card[data-platform="padre"] .val-percentage {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 25.5px;
    /* Scaled 60pt */
    top: 433.6px;
    /* Scaled 1022.14 */
    width: auto;
    height: auto;
    line-height: normal;
    text-shadow: none;
    display: block;
}

.pnl-card[data-platform="padre"] .val-invested {
    left: 81.4px;
    /* Scaled 191.87 */
    color: #ffffff;
}

.pnl-card[data-platform="padre"] .val-position {
    left: 231.6px;
    /* Scaled 545.87 */
    color: #ffffff;
}

.pnl-card[data-platform="padre"] .val-percentage {
    left: 381.7px;
    /* Scaled 899.87 */
}

/* Padre Percentage Colors Override */
.pnl-card[data-platform="padre"] .val-percentage.profit {
    color: #3cd287;
}

.pnl-card[data-platform="padre"] .val-percentage.loss {
    color: #e73a44;
}

/* Padre Solana Values (Under dollar amounts) */
.padre-sol-val {
    display: none;
    position: absolute;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    /* Regular */
    font-size: 19px;
    /* Scaled 44.67pt */
    color: #808080;
    top: 469.7px;
    /* Scaled from Y: 1107.79 */
    align-items: center;
    gap: 6px;
}

.pnl-card[data-platform="padre"] .padre-sol-val {
    display: flex;
}

/* Solana icon SVG styling - uses currentColor for fill */
.padre-sol-val .sol-icon {
    width: 16px;
    height: 14px;
    flex-shrink: 0;
    margin-right: 4px;
    vertical-align: middle;
}

/* Colors are inherited from parent's color property via currentColor */

.val-invested-sol {
    left: 81px;
    /* Centered under $100.00 */
}

.val-position-sol {
    left: 232px;
    /* Centered under $150.00 */
}

.val-pnl-sol {
    left: 382px;
    /* Centered under +50.00% */
}

.val-pnl-sol.profit {
    color: #3cd287;
}

.val-pnl-sol.loss {
    color: #e73a44;
}

/* Hide Profile Pic and Username for Padre */
.pnl-card[data-platform="padre"] .profile-pic-display,
.pnl-card[data-platform="padre"] .user-handle {
    display: none !important;
}

/* Scaled 909.43 */

/* Image Selector Module */
.image-selector-module {
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    width: 840px;
}

.image-selector-module.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Top Row: Gallery + Upload */
.selector-top-row {
    display: flex;
    gap: 8px;
    height: 90px;
}

/* Gallery Wrapper (Left Side - Slider) */
.gallery-wrapper {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.gallery-wrapper::-webkit-scrollbar {
    display: none;
}

.thumbnail-gallery {
    display: flex;
    gap: 4px;
    height: 100%;
}

.thumbnail {
    width: 160px;
    height: 100%;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    opacity: 0.8;
}

.thumbnail:hover {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.3);
}

.thumbnail.active {
    border-color: var(--blue-accent);
    opacity: 1;
}

.thumbnail.custom {
    border-color: rgba(255, 255, 255, 0.1);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Upload Button (Fixed on Right) */
.upload-btn {
    width: 140px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: rgba(255, 255, 255, 0.9);
    gap: 4px;
    flex-shrink: 0;
}

.upload-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.upload-btn svg {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.7);
}

.upload-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.upload-btn span {
    font-size: 12px;
    font-weight: 600;
}

.upload-btn small {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
}

/* Bottom Row: Actions (Right Aligned) */
.selector-bottom-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Ripple Animation */
.ripple-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.ripple-rect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    opacity: 0;
    transform: scale(1);
    animation: ripple 3s infinite cubic-bezier(0.1, 0, 0.3, 1);
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.4;
        border-width: 1px;
    }

    100% {
        transform: scale(1.08);
        opacity: 0;
        border-width: 0px;
    }
}

/* Responsive */
@media (max-width: 1000px) {
    .center-layout {
        transform: translate(-50%, -50%) scale(0.8);
    }
}

@media (max-width: 768px) {
    .center-layout {
        transform: translate(-50%, -50%) scale(0.55);
        width: 100%;
    }

    .card-wrapper,
    .image-selector-module {
        /* Keep px width for internal flow, scale parent */
    }

    .controls-panel {
        /* Panel handling... */
    }
}