:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --accent-color: #10b981;
    /* Emerald Green */
    --accent-glow: rgba(16, 185, 129, 0.4);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(15, 23, 42, 0.6);
    --ad-bg: rgba(0, 0, 0, 0.2);
    --font-main: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    background-image: radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 100%);
    overflow-x: hidden;
}

.app-container {
    display: flex;
    height: 100%;
    width: 100%;
}

/* Ad Spaces */
.ad-space {
    width: 250px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--glass-border);
    border-right: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.1);
}

.ad-left {
    border-right: 1px solid var(--glass-border);
    border-left: none;
    display: none;
}

@media (min-width: 1024px) {
    .ad-left {
        display: flex;
    }
}

.ad-placeholder {
    background: var(--ad-bg);
    border: 1px dashed var(--glass-border);
    border-radius: 8px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.9rem;
    min-height: 200px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    padding: 2rem;
    position: relative;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    align-items: center;
    justify-content: center;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 2.5rem;
    width: 100%;
    max-width: 1400px;
    min-height: fit-content;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    margin: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto 1fr auto;
    gap: 2rem;
    grid-template-areas:
        "header header"
        "display display"
        "controls breakdown"
        "footer footer";
}

.dashboard-header {
    grid-area: header;
    padding-bottom: 0.5rem;
}

.dashboard-display {
    grid-area: display;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 180px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.dashboard-controls {
    grid-area: controls;
    text-align: left;
    display: grid;
    grid-template-rows: auto 1fr;
    padding-right: 0;
    align-items: start;
    position: relative;
}

.dashboard-controls::after {
    content: '';
    position: absolute;
    right: -1rem;
    top: 4rem;
    bottom: 1.5rem;
    width: 1px;
    background: var(--glass-border);
}

.dashboard-controls h3 {
    font-size: 1rem;
    color: #cbd5e1;
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    text-align: left;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    height: 2.5rem;
    margin-top: 0;
}

.dashboard-breakdown {
    grid-area: breakdown;
    display: grid;
    grid-template-rows: auto 1fr;
    padding-left: 0;
    align-items: start;
    align-self: stretch;
}

.dashboard-footer {
    grid-area: footer;
    border-top: 1px solid var(--glass-border);
    padding-top: 1.25rem;
    margin-top: 1rem;
}

.feedback-link {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.feedback-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

header h1 {
    font-weight: 800;
    font-size: 2.5rem;
    margin-bottom: 0;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

/* Controls */
.controls-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
    margin-top: 0;
    text-align: left;
    align-items: stretch;
    padding-top: 0;
    grid-auto-rows: 1fr;
}

/* Match the height of breakdown-header (2.5rem) + margin-bottom (1.25rem) = 3.75rem total */
/* Add margin-top to controls-container to align with breakdown-grid */
.dashboard-controls h3 + .controls-container {
    margin-top: 0;
}

/* Ensure both headers have the same total height including margin-bottom */
.dashboard-controls h3 {
    box-sizing: border-box;
}

.breakdown-header {
    box-sizing: border-box;
}

.input-group {
    background: rgba(0, 0, 0, 0.25);
    padding: 1.25rem;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: flex-start;
    align-items: flex-start;
    transition: all 0.2s ease;
    min-height: 100%;
    height: 100%;
    box-sizing: border-box;
}

.input-group:hover {
    background: rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

label {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 0;
}

input,
select {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    color: var(--accent-color);
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-main);
    transition: all 0.3s ease;
    width: 100%;
    outline: none;
}

input::placeholder {
    color: #64748b;
    font-weight: 400;
    font-size: 1rem;
}

select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2310b981' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
    padding-right: 1.5rem;
}

input:focus,
select:focus {
    outline: none;
    color: var(--accent-color);
}

.input-group:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

option {
    background-color: var(--bg-color);
    color: white;
    padding: 0.5rem;
}

/* Settings Toggle */
.settings-toggle {
    margin-bottom: 1rem;
    text-align: right;
}

.btn-text {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
    transition: color 0.2s;
}

.btn-text:hover {
    color: var(--accent-color);
}

.hidden-settings {
    display: none;
    animation: fadeIn 0.3s ease;
}

.hidden-settings.show {
    display: grid;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.btn {
    padding: 0.875rem 1.75rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    flex: 1;
}

.btn.primary {
    background: var(--accent-color);
    color: #022c22;
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px var(--accent-glow);
}

.btn.secondary {
    background: #ef4444;
    color: white;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

.btn.secondary:disabled {
    background: #334155;
    color: #64748b;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn.outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: #cbd5e1;
}

.btn.outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: white;
}

/* Display */
.label {
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.money-value {
    font-size: 4.5rem;
    font-weight: 800;
    color: var(--accent-color);
    text-shadow: 0 0 50px var(--accent-glow);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    margin: 0;
    text-align: center;
    width: 100%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0 1rem;
    box-sizing: border-box;
}

.time-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    letter-spacing: 2px;
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1;
    white-space: nowrap;
}

/* Target Progress */
.target-container {
    margin-top: 1rem;
    opacity: 1;
    transition: opacity 0.3s ease;
    width: 100%;
    max-width: 400px;
}

.target-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.progress-bar-bg {
    height: 8px;
    background: #334155;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-color);
    width: 0%;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px var(--accent-glow);
}

.target-status {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 0.5rem;
}

#percentage-display {
    color: white;
    font-weight: 600;
}

/* Breakdown */
.breakdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    min-height: 2.5rem;
    height: 2.5rem;
    margin-top: 0;
}

.dashboard-breakdown h3 {
    font-size: 1rem;
    color: #cbd5e1;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    text-align: left;
}

.net-gross-toggle {
    display: flex;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 0.25rem;
    border: 1px solid var(--glass-border);
}

.toggle-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toggle-btn:hover {
    color: #cbd5e1;
}

.toggle-btn.active {
    background: var(--accent-color);
    color: #022c22;
    box-shadow: 0 0 10px var(--accent-glow);
}

.breakdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: stretch;
    margin-top: 0;
    grid-auto-rows: 1fr;
}

.breakdown-card {
    background: rgba(0, 0, 0, 0.25);
    padding: 1.25rem;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: flex-start;
    align-items: flex-start;
    transition: all 0.2s ease;
    min-height: 100%;
    height: 100%;
    box-sizing: border-box;
}

.breakdown-card:hover {
    background: rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}


.breakdown-label {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0;
}

.breakdown-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
}

.breakdown-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--accent-color);
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-main);
    width: 100%;
    text-align: left;
    padding: 0;
    transition: border-color 0.2s ease;
}

.breakdown-input:focus {
    outline: none;
    border-bottom-color: var(--accent-color);
}

.breakdown-input::placeholder {
    color: var(--accent-color);
    opacity: 0.7;
}

/* Privacy Page Styles */
.privacy-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    overflow-y: auto;
    max-height: 90vh;
}

.privacy-text {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    margin-bottom: 2rem;
    text-align: left;
}

.privacy-text h2 {
    color: var(--accent-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.privacy-text p {
    margin-bottom: 1rem;
}

.privacy-text a {
    color: var(--accent-color);
    text-decoration: none;
}

.privacy-text a:hover {
    text-decoration: underline;
}

/* Cookie Consent Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

.cookie-banner.show {
    transform: translateY(0);
}

.cookie-content {
    color: var(--text-color);
    font-size: 0.9rem;
    max-width: 600px;
}

.cookie-btn {
    background: var(--accent-color);
    color: #022c22;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px var(--accent-glow);
}

.cookie-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px var(--accent-glow);
}

/* Responsive */
@media (max-width: 1024px) {
    .glass-panel {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "display"
            "controls"
            "breakdown"
            "footer";
        max-width: 700px;
        height: auto;
        max-height: none;
        overflow-y: visible;
        padding: 2rem;
        gap: 1.5rem;
    }

    .main-content {
        height: auto;
        overflow-y: auto;
        padding: 1.5rem;
    }

    .dashboard-controls {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding-bottom: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .dashboard-controls::after {
        display: none;
    }

    .dashboard-breakdown {
        padding-left: 0;
        padding-top: 1.5rem;
    }

    .breakdown-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--glass-border);
    }

    .money-value {
        font-size: 3.5rem;
    }
    
    .time-value {
        font-size: 1.25rem;
        top: 0.75rem;
        right: 0.75rem;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        overflow-y: auto;
    }

    /* Hide left ad space on mobile */
    .ad-left {
        display: none;
    }

    /* Show right ad space at bottom on mobile */
    .ad-space {
        width: 100%;
        padding: 1rem;
        flex-direction: row;
        border: none;
        border-top: 1px solid var(--glass-border);
        order: 3; /* Place after main content */
        min-height: auto;
        max-height: 120px;
    }

    .ad-placeholder {
        min-height: 100px;
        max-height: 100px;
        width: 100%;
    }

    .main-content {
        order: 1; /* Ensure main content comes first */
        padding: 1rem;
        padding-bottom: 0.5rem;
        height: auto;
        overflow-y: auto;
        width: 100%;
        flex: 1;
    }

    .glass-panel {
        padding: 1.5rem;
        gap: 1.5rem;
        max-height: none;
        width: 100%;
        max-width: 100%;
    }

    .money-value {
        font-size: 2.5rem;
        padding: 0 0.5rem;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .time-value {
        font-size: 1rem;
        top: 0.5rem;
        right: 0.5rem;
        letter-spacing: 1px;
    }

    .dashboard-display {
        padding: 3rem 1rem 1.5rem 1rem;
        min-height: 140px;
        position: relative;
    }

    .dashboard-header {
        text-align: center;
    }

    .dashboard-header h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }

    .dashboard-controls {
        padding-bottom: 1.5rem;
        margin-bottom: 1.5rem;
        border-bottom: 1px solid var(--glass-border);
    }

    .dashboard-controls h3 {
        text-align: center;
        margin-bottom: 1rem;
    }

    .controls-container {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .dashboard-breakdown {
        padding-top: 0;
    }

    .breakdown-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
        gap: 1rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--glass-border);
    }

    .breakdown-header h3 {
        margin: 0;
        flex: 1;
    }

    .net-gross-toggle {
        flex-shrink: 0;
        width: auto;
    }

    .breakdown-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .input-group {
        padding: 1rem;
    }

    .breakdown-card {
        padding: 1rem;
    }

    .action-buttons {
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1rem;
    }

    .btn {
        width: 100%;
    }

    .cookie-banner {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem;
    }

    .cookie-content {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0.75rem;
    }

    .glass-panel {
        padding: 1.25rem;
        gap: 1.25rem;
        border-radius: 20px;
    }

    .dashboard-header h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .money-value {
        font-size: 2rem;
        padding: 0 0.25rem;
    }

    .time-value {
        font-size: 0.9rem;
        top: 0.5rem;
        right: 0.5rem;
        letter-spacing: 1px;
    }

    .dashboard-display {
        padding: 2.5rem 0.75rem 1rem 0.75rem;
        min-height: 120px;
    }

    .dashboard-controls h3 {
        font-size: 0.9rem;
    }

    .controls-container {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .input-group,
    .breakdown-card {
        padding: 0.875rem;
    }

    .input-group label,
    .breakdown-label {
        font-size: 0.7rem;
    }

    input,
    select,
    .breakdown-value {
        font-size: 1.1rem;
    }

    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    .breakdown-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .breakdown-header h3 {
        font-size: 0.9rem;
        margin: 0;
    }

    .net-gross-toggle {
        flex-shrink: 0;
        width: auto;
    }

    .toggle-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .breakdown-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
}