/* ========================================================================= */
/* 0. CSS Variables & Global Constants */
/* These variables allow for quick theme changes */
/* ========================================================================= */
:root {
    /* Base Colors & Gradient - Updated to match tradingSummary */
    --color-primary: #667eea;
    --color-secondary: #764ba2;
    --color-positive: #10b981; /* Updated to match tradingSummary */
    --color-negative: #ef4444; /* Updated to match tradingSummary */
    --color-info: #00d25b;
    --color-warning: #f59e0b;
    --color-text-dark: #111827; /* Updated to match tradingSummary */
    --color-text-muted: #6b7280; /* Updated to match tradingSummary */
    --color-border: #e5e7eb; /* Updated to match tradingSummary */
    --color-background-light: #f8f9fa;
    --color-background-page: #f5f7ff; /* Added for page background */

    --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    --gradient-header: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); /* Added for headers */

    /* Spacing and Dimensions (Standardized) */
    --spacing-default: 1.5rem;
    --radius-default: 0.5rem;
    --radius-large: 0.75rem;

    /* Shadow - Updated to match tradingSummary */
    --shadow-default: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
    --shadow-card: 0 2px 10px rgba(0,0,0,0.1);

    /* Layout */
    --navbar-height: 60px;
    --sidebar-width: 280px;
}


/* ========================================================================= */
/* 1. Base Styles & Typography */
/* ========================================================================= */

html {
    scroll-behavior: smooth;
}
h1{
    font-size: 1.6em;
}
section {
    scroll-margin-top: calc(var(--navbar-height) + 1rem);
}

.content {
    max-width: 1400px;
    padding: 2rem;
    background: var(--color-background-page);
    min-height: 100vh;
}

h2 {
    margin-bottom: 2rem;
    font-size: 1.75rem;
    font-weight: 600;
}
h3 span{
    display: block;
}
.bi{
    margin-right: .4rem;
}
/* Back Link */
.back-link {
    color: var(--color-primary);
    text-decoration: none;
    margin-bottom: 1rem;
    display: inline-block;
}

.back-link:hover {
    text-decoration: underline;
}


/* ========================================================================= */
/* 2. Card Base & Section Styles */
/* Updated to match tradingSummary card styling */
/* ========================================================================= */

.card-base,
.result-card,
.summary-card,
.comparison-section,
.trades-section,
.settings-section,
.dashboard-card,
.stock-card {
    background: white;
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-default);
    padding: var(--spacing-default);
    transition: all 0.2s;
    border: 1px solid var(--color-border);
    margin-bottom: var(--spacing-default);
}

.result-card,
.dashboard-card,
.stock-card {
    /* Apply hover effect to standard clickable/interactive cards */
    text-decoration: none;
    color: inherit;
    display: block;
}

.result-card:hover,
.dashboard-card:hover,
.stock-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: #d1d5db;
    transform: translateY(-2px);
}

.summary-card.highlight {
    background: var(--gradient-primary);
    color: white;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-text-dark);
    display: flex;
    align-items: center;
}

.section-title i {
    margin-right: 0.5rem;
}

/* ========================================================================= */
/* 3. Layouts & Grids */
/* ========================================================================= */

.results-grid,
.summary-grid {
    display: grid;
    gap: var(--spacing-default);
}

.results-grid {
    /* For main list of results */
    margin-bottom: 3rem;
}

.summary-grid {
    /* For summary statistics at the top of a detail page */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin-bottom: 3rem;
}
.stock-stats,
.result-stats,
.results-stats {
    display: grid;
    gap: 1rem;
    /* Grid layout for smaller stat groups (card/page) */
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.results-stats {
    /* Used for test panel results */
    margin-bottom: 2rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-default);
    margin-top: 1.5rem;
}

/* ========================================================================= */
/* 4. Component Styles (Headers, Stats, Trades) */
/* ========================================================================= */

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    /* Standardized to 2rem from max definition */
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-border);
    /* Standardized to 2px */
}

.ticker,
.ticker-title {
    font-weight: bold;
    color: var(--color-primary);
}

.ticker {
    font-size: 1.5rem;
}

.ticker-title {
    font-size: 2rem;
}

.date,
.date-info {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* Stat Elements (Label and Value) */
.stat,
.summary-card,
.stat-card {
    text-align: center;
    background-color: #fff;
}

.stat-label,
.summary-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
    opacity: 0.8;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: bold;
}

.summary-value {
    font-size: 2rem;
    font-weight: bold;
}

/* Stat Value Colors */
.stat-value.positive,
.summary-value.positive {
    color: var(--color-positive);
}

.stat-value.negative,
.summary-value.negative {
    color: var(--color-negative);
}

.summary-card.highlight .summary-value {
    color: white;
    /* Override positive/negative color when highlighted */
}

/* Trade List */
.trades-list {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 1.5rem;
}

.trade-item {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    display: grid;
    grid-template-columns: 150px 150px 1fr 150px;
    gap: 1rem;
    align-items: center;
}

.trade-date {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.trade-price {
    font-weight: 600;
}

.trade-action {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
}

.trade-action.win {
    background: #d4edda;
    /* Light green */
    color: #155724;
    /* Dark green */
}

.trade-action.start {
    background: #d1ecf1;
    /* Light cyan */
    color: #0c5460;
    /* Dark cyan */
}

.trade-action.dip {
    background: #fff3cd;
    /* Light yellow */
    color: #856404;
    /* Dark yellow */
}

.trade-action.stop {
    background: #f8d7da;
    /* Light red */
    color: #721c24;
    /* Dark red */
}


/* ========================================================================= */
/* 5. Button Styles */
/* ========================================================================= */

.btn-new,
.btn-test,
.btn-gradient-primary {
    display: inline-block;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    color: white;
    background: var(--gradient-primary);
    border: none;
    transition: all 0.3s;
}

.btn-new {
    margin-top: 1rem;
    padding: 0.75rem 2rem;
}

.btn-test {
    padding: 1rem 3rem;
    font-size: 1.2rem;
}

.btn-new:hover,
.btn-test:hover,
.btn-gradient-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    /* Shadow color based on primary */
    color: white;
    opacity: 0.9;
}


/* ========================================================================= */
/* 6. Dashboard & Utility Components (Upload, Alerts, Tables, Empty State) */
/* ========================================================================= */

/* Empty State - Updated to match tradingSummary */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-muted);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Loading Spinner - Updated to match tradingSummary */
.loading-spinner {
    border: 4px solid var(--color-border);
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}
input:required {
    background-color: #fff9a5;
}
/* Stat Cards (Used in test results) */
.stat-card {
    border: 2px solid var(--color-border);
    padding: 1rem;
    border-radius: 6px;
}

.stat-card.positive {
    border-color: var(--color-positive);
    background: #d4edda;
}

.stat-card.negative {
    border-color: var(--color-negative);
    background: #f8d7da;
}

/* Alerts - Updated to match tradingSummary */
.alert {
    border: none;
    border-radius: var(--radius-default);
    padding: 1rem 1.25rem;
    color: #111827 !important;
    border-left: 4px solid;
    margin-bottom: 1rem;
}

.alert-info {
    background: rgba(2, 184, 255, 0.1);
    border-left-color: #059669;
}

.alert-success {
    background: #d4edda;
    border-left-color: #155724;
    color: #155724 !important;
}

.alert-warning {
    background: #fff3cd;
    border-left-color: #856404;
    color: #856404 !important;
}

.alert-danger {
    background: #f8d7da;
    border-left-color: #721c24;
    color: #721c24 !important;
}

/* Tabs */
.nav-tabs .nav-link {
    color: var(--color-primary);
    font-weight: 600;
}

.nav-tabs .nav-link.active {
    color: var(--color-secondary);
    border-bottom: 3px solid var(--color-secondary);
}

/* Upload Zones */
.upload-zone,
.upload-zone-small {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-default);
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background-color: white;
}

.upload-zone {
    padding: 3rem 2rem;
}

.upload-zone-small {
    padding: 1.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.5);
    /* Semi-transparent for sidebar */
}

.upload-zone:hover {
    border-color: var(--color-secondary);
    background: rgba(154, 85, 255, 0.05);
    /* Light secondary shade */
}

.upload-zone.dragover {
    border-color: var(--color-info);
    background: rgba(0, 210, 91, 0.05);
    /* Light success shade */
    border-style: solid;
}

.upload-zone i {
    font-size: 3rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.upload-zone-small i {
    font-size: 2rem;
    margin-bottom: 0;
}

/* Tables - Updated to match tradingSummary styling */
.comparison-table,
.table-custom,
.lot-table {
    width: 100%;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    border-collapse: collapse;
}

.comparison-table th,
.comparison-table td,
.table-custom th,
.table-custom td,
.lot-table th,
.lot-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.comparison-table th,
.lot-table thead th {
    background: var(--color-background-light);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8125rem;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    border-bottom: 2px solid var(--color-border);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.table-custom tbody tr:hover,
.lot-table tbody tr:hover {
    background: rgba(154, 85, 255, 0.03);
}

.table-custom .number,
.lot-table .number {
    text-align: right;
    font-family: 'Courier New', monospace;
}
.sticky-top{
    top:5rem;
    z-index: 1;
}
/* Sticky table headers */
thead th {
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 10;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.05);
}

.lot-table thead th {
    background: var(--color-background-light);
}

/* ========================================================================= */
/* 8. Form Controls & Components */
/* Added to match tradingSummary form styling */
/* ========================================================================= */
.btn-primary, .btn-primary:hover, .btn-primary:active, .btn-primary:focus{
    margin-top: 1rem;
}
.form-check{
    padding-left: 0;
}
.form-switch .form-check-input{
    margin: 0;
}

.form-control {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.95em;
    color: var(--color-text-dark);
    background: white;
    transition: all 0.2s;
}
.form-block{
    padding-left: 0;
}

.form-control:hover {
    border-color: #9ca3af;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-label {
    font-weight: 600;
    color: var(--color-text-dark);
    margin-bottom: 0.5rem;
}

/* ========================================================================= */
/* 10. Responsive Design */
/* Added to match tradingSummary responsive approach */
/* ========================================================================= */

@media (max-width: 768px) {
    .content {
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.8em;
    }

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

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

    .dashboard-card {
        margin-bottom: 1rem;
    }

    table {
        font-size: 0.9em;
    }

    th, td {
        padding: 8px 4px;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }
}

.status-message {
    padding: 12px 16px;
    border-radius: 5px;
    margin-top: 10px;
    font-weight: 500;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.privacy-notice {
    background: #e9ecef;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--color-primary);
}

.privacy-notice h3 {
    color: var(--color-text-dark);
    margin-bottom: 10px;
}

.privacy-notice ul {
    margin-left: 20px;
}

.privacy-notice li {
    margin-bottom: 5px;
}
.navbar .container-fluid{
    padding: 0;
}
.navbar-custom {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    box-shadow: 0 1px 15px 1px rgba(69, 65, 78, 0.08);
    /* Standardized shadow */
    padding: 0 1.5rem;
    background: #ffffff !important;
    z-index: 1000;
}
.navbar-brand{
    padding-top: 0;
}
.navbar-brand img{
    height: 25px;
}

/* Left Sidebar - Updated to match strategy detail sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: white;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1.5rem 0;
    padding-top: calc(var(--navbar-height) + 1.5rem);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 999;
    transition: all 0.3s ease;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.08);
}
.sidebar li{
    list-style: none;
}
.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 0 1.5rem 1rem;
    margin-bottom: 1rem;
    /* Removed redundant border-bottom from one definition */
}

.sidebar-header h5 {
    margin: 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9e9e9e;
    font-weight: 600;
}

/* ... Sidebar navigation links ... */
.sidebar-nav{
    padding-left: 0;
}
.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: #3c4858;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 0.875rem;
    font-weight: 400;
    position: relative;
    border-left: 4px solid transparent;
}

.sidebar-nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-nav-link:hover {
    background: rgba(102, 126, 234, 0.05);
    color: #667eea;
    border-left-color: rgba(102, 126, 234, 0.3);
}

.sidebar-nav-link.active {
    background: linear-gradient(to right, rgba(102, 126, 234, 0.1), transparent);
    color: #667eea;
    font-weight: 600;
    border-left-color: #667eea;
}

.sidebar-nav-link.active::before {
    opacity: 1;
}

.sidebar-nav-link i {
    margin-right: 1rem;
    width: 20px;
    font-size: 1.125rem;
    text-align: center;
}

/* Main Content Wrapper - Updated to match right sidebar approach */
.main-wrapper {
    margin-top: var(--navbar-height);
    margin-left: 280px;
    margin-right: 0;
    padding: 2rem;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    background: var(--color-background-page);
    width: calc(100% - 280px);
}

.main-wrapper.full-width {
    margin-left: 0;
    width: 100%;
}

/* Specific routing for layout handling */
.route-trading-index .main-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
}
.route-strategy-index .main-wrapper{
    margin-left: 0;
    width: 100%;
}
.route-auth-register .main-wrapper,
.route-auth-login .main-wrapper{
    background: none;
    width: 320px;
    margin: 0 auto;
}
.route-auth-register .main-wrapper .submit,
.route-auth-login .main-wrapper .submit{
    width: 100%;
    background-color: #000;
}
.main-wrapper.full-width {
    margin-left: 0;
    width: 100%;
}
.main-wrapper .logo{
    margin-bottom: 0;
}
.motto{
    text-align: center;
    margin-bottom: 1rem;
}
/* Right Sidebar - For strategy pages */
.sidebar-right {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 280px;
    background: white;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1.5rem 0;
    padding-top: calc(var(--navbar-height) + 1.5rem);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 999;
    transition: all 0.3s ease;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.08);
}

.sidebar-right.collapsed {
    transform: translateX(100%);
}

.sidebar-right .sidebar-header {
    padding: 0 1.5rem 1rem;
    margin-bottom: 1rem;
}

.sidebar-right .sidebar-header h5 {
    margin: 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9e9e9e;
    font-weight: 600;
}

.sidebar-right .sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-right .sidebar-nav-item {
    margin-bottom: 0;
}

.sidebar-right .sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: #3c4858;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 0.875rem;
    font-weight: 400;
    position: relative;
    border-left: 4px solid transparent;
}

.sidebar-right .sidebar-nav-link:hover {
    background: rgba(102, 126, 234, 0.05);
    color: #667eea;
    border-left-color: rgba(102, 126, 234, 0.3);
}

.sidebar-right .sidebar-nav-link.active {
    background: linear-gradient(to left, rgba(102, 126, 234, 0.1), transparent);
    color: #667eea;
    font-weight: 600;
    border-left-color: #667eea;
}

.sidebar-right .sidebar-nav-link i {
    margin-right: 1rem;
    width: 20px;
    font-size: 1.125rem;
    text-align: center;
}

/* Main content with right sidebar margin */
.main-content-right {
    transition: margin-right 0.3s ease;
}

.main-content-right.full-width {
    margin-right: 0;
}

/* Smooth scroll for anchor links */
html {
    scroll-behavior: smooth;
}

@media (max-width: 992px) {
    /* Hide sidebar by default on mobile */
    .sidebar {
        transform: translateX(-100%);
        top: 0;
        height: 100vh;
        z-index: 9999;
        border-right: 1px solid rgba(0, 0, 0, 0.1);
        border-left: none;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.08);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .route-trading-index .main-wrapper {
        margin-left: 0;
        width: 100%;
    }
}