:root {
    --bg-color: #000000;
    --card-bg: rgba(20, 20, 25, 0.4);
    --card-border: rgba(255, 255, 255, 0.1);

    --text-primary: #FFFFFF;
    --text-secondary: #A0A0AA;
    --input-bg: rgba(0, 0, 0, 0.6);
    --input-border: rgba(255, 255, 255, 0.2);

    --accent-red: #FF3131;
    --accent-green: #39FF14;
    --accent-blue: #00D4FF;

    /* User Requested Fonts */
    --font-ui: 'Poppins', sans-serif;
    --font-heading: 'Montserrat', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-ui);
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Glowing Orbs */
.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.2;
}

.orb-1 {
    width: 50vw;
    height: 50vw;
    background: var(--accent-blue);
    top: -20%;
    left: -10%;
    opacity: 0.3;
    /* Toned down further per user request to be subtle */
}

.orb-2 {
    width: 40vw;
    height: 40vw;
    background: var(--accent-green);
    bottom: -10%;
    right: -10%;
}

.orb-3 {
    width: 30vw;
    height: 30vw;
    background: var(--accent-red);
    top: 30%;
    left: 40%;
}

/* Layout Grid */
.app-layout {
    display: flex;
    justify-content: center;
    padding: 2rem 1.5rem;
    /* Added small margins on either side */
    min-height: 100vh;
}

.main-content {
    max-width: 1600px;
    /* Vastly increased to fit wider screens without large margins */
    width: 100%;
}

/* Header */
.glass-header {
    background: rgba(255, 255, 255, 0.25);
    /* Much more translucent white (glassy) */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.brand {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Made Logo Bigger based on user feedback (2x original request) */
.brand-logo {
    max-width: 450px;
    /* Slightly reduced from 600px */
    height: auto;
    max-height: 80px;
    /* Constrained height so header doesn't expand too much */
    object-fit: contain;
}

.fallback-logo {
    background: linear-gradient(135deg, var(--accent-red), var(--accent-green));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #fff;
    font-family: var(--font-heading);
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.highlight {
    color: var(--accent-green);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.currency-badge {
    background: transparent;
    color: #000000;
    padding: 0.6rem 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn {
    background: transparent;
    border: 2px solid;
    color: #000000;
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn.outline-red {
    border-color: rgba(255, 49, 49, 0.5);
    color: var(--accent-red);
}

.action-btn.outline-red:hover {
    background: rgba(255, 49, 49, 0.1);
    border-color: var(--accent-red);
    box-shadow: 0 0 15px rgba(255, 49, 49, 0.2);
}

.action-btn.outline-blue {
    border-color: rgba(0, 212, 255, 0.5);
    color: var(--accent-blue);
}

.action-btn.outline-blue:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent-blue);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
}

/* Commission note */
.commission-note {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--accent-blue);
    color: var(--text-primary);
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    font-weight: 400;
    /* Set to regular weight, HTML <strong> handles the bold part */
    margin-bottom: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.1);
}

/* Glass Panels */
.glass-container {
    width: 100%;
}

.tables-container {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.table-wrapper {
    flex: 1;
    min-width: 320px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.5rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.8rem;
}

/* Tables Formatting */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.data-table th {
    text-align: left;
    padding: 0.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table td {
    padding: 0.8rem 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.95rem;
}

.data-table tr td:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.data-table tr td:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.label-cell {
    font-weight: 500;
    color: var(--text-secondary);
}

.value-cell {
    font-weight: 600;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
}

/* Target Highlights */
.bg-neutral-highlight td {
    background: rgba(255, 255, 255, 0.05);
    border-left: 2px solid var(--text-secondary);
}

.text-green {
    color: var(--accent-green) !important;
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.4);
}

.text-red {
    color: var(--accent-red) !important;
    text-shadow: 0 0 10px rgba(255, 49, 49, 0.4);
}

.neutral {
    color: var(--text-primary);
}

/* Dynamic Outline Formatting for Net Profit/Loss */
.profit-loss-outline-green {
    border: 1px solid var(--accent-green) !important;
    box-shadow: inset 0 0 10px rgba(57, 255, 20, 0.2), 0 0 10px rgba(57, 255, 20, 0.2);
    border-radius: 8px;
}

.profit-loss-outline-red {
    border: 1px solid var(--accent-red) !important;
    box-shadow: inset 0 0 10px rgba(255, 49, 49, 0.2), 0 0 10px rgba(255, 49, 49, 0.2);
    border-radius: 8px;
}

/* Inputs */
.input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 4px 8px;
    transition: all 0.3s;
}

.input-row:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
}

.input-cell {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-weight: 600;
    font-family: var(--font-heading);
    outline: none;
    font-size: 1rem;
}

.input-cell::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.input-cell::-webkit-outer-spin-button,
.input-cell::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-cell[type=number] {
    -moz-appearance: textfield;
}

.clear-input-btn {
    background: rgba(255, 49, 49, 0.2);
    color: var(--accent-red);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.clear-input-btn:hover {
    background: var(--accent-red);
    color: #000;
    box-shadow: 0 0 10px var(--accent-red);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: all 0.3s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-family: var(--font-heading);
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.close-btn:hover {
    color: var(--accent-red);
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.95rem;
}

.result-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.result-value {
    font-weight: 600;
    font-family: var(--font-heading);
}

/* How to Use Section (Collapsible) */
.how-to-use-section {
    margin-top: 1.5rem;
    padding: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.toggle-btn {
    width: fit-content;
    gap: 1.5rem;
    /* Space between title and arrow */
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-blue);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 0;
    margin: 0;
}

.toggle-btn:focus {
    outline: none;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.toggle-btn[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.4s ease-out, margin-top 0.4s ease-out;
    opacity: 0;
}

.collapsible-content.expanded {
    max-height: 1000px;
    /* Arbitrary large number to allow content to expand fully */
    opacity: 1;
    margin-top: 1.5rem;
    border-top: 1px solid var(--card-border);
    padding-top: 1.5rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.info-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.info-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.info-card h4 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.text-blue {
    color: var(--accent-blue);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tables-container {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        padding-bottom: 1rem;
        /* Space for scrollbar */
    }

    .table-wrapper {
        min-width: 90vw;
        /* Slightly wider so edge peaks through */
        scroll-snap-align: start;
        flex-shrink: 0;
    }

    /* Hide scrollbar for cleaner look on mobile */
    .tables-container::-webkit-scrollbar {
        display: none;
    }

    .tables-container {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .brand-title {
        font-size: 1.3rem;
    }

    .brand-logo {
        max-width: 250px;
        /* Doubled on mobile too */
        height: auto;
    }

    .glass-header {
        padding: 1rem;
        justify-content: center;
        text-align: center;
        background: #FFFFFF;
        /* Solid white background on mobile */
    }

    .header-actions {
        justify-content: center;
        width: 100%;
    }
}