:root {
    --bg-color: #0f1115;
    --card-bg: #181b21;
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --border-color: #2d3748;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --input-bg: #22262e;
}

[data-theme="light"] {
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --border-color: #e5e7eb;
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --input-bg: #f9fafb;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2rem;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Navigation */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.nav-brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 0.5px;
}

.nav-brand img {
    width: auto;
    height: 80px;
    max-width: 100%;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    font-size: 0.95rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent-color);
}

header {
    margin-bottom: 2rem;
    text-align: center;
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background-color: var(--card-bg);
    border-color: var(--accent-color);
}

/* Hide/Show icons based on theme */
.sun-icon {
    display: none;
}

.moon-icon {
    display: block;
}

[data-theme="light"] .sun-icon {
    display: block;
}

[data-theme="light"] .moon-icon {
    display: none;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #9ca3af);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

[data-theme="light"] h1 {
    background: linear-gradient(to right, #111827, #4b5563);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.config-section {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.config-section h2 {
    font-size: 1.25rem;
    margin-bottom: 0;
    color: var(--text-primary);
    user-select: none;
}

.config-section h2:hover {
    color: var(--accent-color);
}

.config-panel {
    max-height: 1000px;
    /* Arbitrary large height */
    opacity: 1;
    overflow: hidden;
    transition: all 0.5s ease-in-out;
    margin-top: 1.5rem;
}

.config-panel.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.config-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.config-group h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    font-weight: 600;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 140px;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

#configToggleIcon.rotated {
    transform: rotate(-90deg);
}

.strategy-info {
    display: flex;
    gap: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.95rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.strategy-info p {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.strategy-info span {
    color: var(--success-color);
    font-weight: 600;
    font-size: 1.1rem;
}

.strategy-info span.highlight {
    color: var(--accent-color);
}

.table-container {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

input,
select {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 6px;
    width: 100%;
    font-family: inherit;
    transition: all 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

input[type="number"] {
    text-align: right;
}

/* Status Styles */
.status-pending {
    color: var(--text-secondary);
}

.status-won {
    color: var(--success-color);
    font-weight: 600;
}

.status-lost {
    color: var(--danger-color);
    font-weight: 600;
}

select.status-select {
    width: 120px;
    font-weight: 500;
}

select.status-select.won {
    border-color: var(--success-color);
    color: var(--success-color);
}

select.status-select.lost {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.readonly-cell {
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.positive {
    color: var(--success-color);
}

.negative {
    color: var(--danger-color);
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 17, 21, 0.95);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.login-box {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.login-box h2 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.login-box p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.login-box input {
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1.1rem;
}

.error-msg {
    color: var(--danger-color) !important;
    font-size: 0.9rem;
    margin-top: 1rem;
    min-height: 1.5em;
}

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

/* Mobile Responsive */
.blocking-content.success-theme {
    border: 2px solid #FFD700;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.2);
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
}

@media (max-width: 768px) {
    .main-nav {
        flex-direction: column;
        gap: 1rem;
        padding-bottom: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .nav-brand {
        margin-bottom: 0.5rem;
    }

    .config-grid {
        grid-template-columns: 1fr;
    }

    .strategy-info {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
        text-align: center;
    }

    h1 {
        font-size: 2rem;
    }

    /* Mobile Table - Scroll View */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
        width: calc(100% + 2rem);
        border: none;
        box-shadow: none;
        background: transparent;
    }

    #investmentTable {
        min-width: 600px;
        /* Reduced min-width */
    }

    /* Hide the card view specific overrides we added before if any remained, 
       but since we are replacing the block, we just ensure table display is normal */
    #investmentTable,
    #investmentTable thead,
    #investmentTable tbody,
    #investmentTable tr,
    #investmentTable td,
    #investmentTable th {
        display: revert;
    }

    #investmentTable td::before {
        display: none;
    }

    #investmentTable th,
    #investmentTable td {
        white-space: nowrap;
        text-align: left;
        padding: 0.5rem 0.25rem;
        /* Tighter padding */
        font-size: 0.85rem;
        /* Smaller font */
    }

    #investmentTable input[type="number"] {
        width: 60px;
        /* Smaller input */
        padding: 0.25rem;
        font-size: 0.85rem;
    }

    #investmentTable select.status-select {
        min-width: 60px;
        font-size: 0.85rem;
        padding: 0.25rem;
    }
}

/* Blocking Modal Styles */
.blocking-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.98);
    /* Almost solid black block */
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

.blocking-modal.hidden {
    display: none;
}

.blocking-content {
    background: #1a1a1a;
    padding: 2rem;
    border-radius: 12px;
    border: 2px solid #ff4444;
    text-align: center;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 50px rgba(255, 0, 0, 0.2);
    animation: fadeIn 0.5s ease-out;
}

.blocking-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    animation: pulse 2s infinite;
}

.stop-sign-img {
    width: 180px;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(255, 0, 0, 0.4));
}

.modal-actions button {
    min-width: 150px;
    transition: all 0.2s;
}

.modal-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.blocking-content h2 {
    color: #ff4444;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.blocking-content p {
    color: #e0e0e0;
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.blocking-timer {
    font-size: 3rem;
    font-family: monospace;
    color: #ff4444;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem 2rem;
    border-radius: 8px;
    display: inline-block;
    border: 1px solid #ff4444;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

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

/* =========================================
   PROFIT PAGE STYLES
   ========================================= */
.profit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.days-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.day-checkbox {
    display: none;
}

.day-label {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    user-select: none;
}

.day-checkbox:checked+.day-label {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.profit-table-container {
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1rem;
}

.profit-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.profit-table th,
.profit-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.profit-table tr:last-child td {
    border-bottom: none;
}

.summary-card {
    background-color: #0f111a;
    /* Darker background for contrast */
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.summary-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-success {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.status-fail {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.status-neutral {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

.input-currency {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 6px;
    width: 100px;
}

/* =========================================
   LOGIN PAGE STYLES
   ========================================= */

body.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 0;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.google-btn {
    background-color: #fff;
    color: #757575;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 1rem;
    transition: background-color 0.2s;
}

.google-btn:hover {
    background-color: #f1f1f1;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-secondary);
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider::before {
    margin-right: .5em;
}

.divider::after {
    margin-left: .5em;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1rem;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}