/* ############################################################
   # 1. CORE VARIABLES & RESET
   ############################################################ */
:root {
    --background-color1: #55423d;
    --background-color2: #F5EFE6;
    --background-color3: #EBCB90;
    --headline-color1: #fffffe;
    --text-color1: #fff3ec;
    --text-color2: #271c19;
    --button-color1: #271c19;
    --button-color2: rgb(116, 81, 45);
    --hover-color1: #FFF0CE;
    --success-green: #2ecc71;
    --danger-red: #e74c3c;
    --info-blue: #3498db;
}

body {
    background-color: var(--background-color1);
    color: var(--text-color1);
    margin: 0;
    padding: 0;
    font-family: "Poppins", sans-serif;
    display: flex;
}

h1 {
    color: var(--headline-color1);
    text-align: center;
}

/* ############################################################
   # 2. LAYOUT & SIDEBAR
   ############################################################ */
.main-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    align-items: flex-start; /* Prevents sidebar from stretching weirdly */
}


.content {
    flex-grow: 1;
    padding: 40px;
    min-width: 0; /* Prevents charts from breaking the layout */
}

/* SIDEBAR BASE */
.sidebar {
    position: sticky;    
    top: 0;       
    height: 100vh;        
    width: 260px;
    background-color: var(--button-color1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;     
    transition: width 0.3s ease;
    z-index: 1000;        
}

/* SIDEBAR HEADER */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    height: 60px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.logo-text {
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* NAVIGATION */
.sidebar-nav ul {
    list-style-type: none;
    padding: 0;
    margin: 10px 0;
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--text-color1);
    text-decoration: none;
    transition: all 0.3s;
    gap: 15px;
}

.nav-item a:hover, .nav-item.active a {
    background-color: var(--hover-color1);
    color: var(--button-color1);
}

/* SIDEBAR FOOTER & TOGGLE AREA */
.sidebar-footer {
    margin-top: auto;      /* Pushes footer to the very bottom of the 100vh sidebar */
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.2); /* Slightly darker background */
    border-top: 1px solid rgba(255, 255, 255, 0.1); /* Separator line */
}

.toggle-container {
    display: flex;
    width: 100%;
    margin-bottom: 10px; /* Space between button and clocks */
}

.toggle-button {
    margin-left: auto; /* Pushes button to the right */
    background: transparent;
    border: none;
    color: var(--text-color1);
    cursor: pointer;
}

.clocks {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 10px;
}
#utc-clock, #est-clock {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #888; /* Darker, muted gray */
    letter-spacing: 1px;
}

/* ############################################################
   # 3. COLLAPSED STATES & RESPONSIVENESS
     (Sidebar collapses to icons only, with smooth transitions)
   ############################################################ */
.sidebar.collapsed { 
    width: 80px; 
}

/* Hide text only, keep the containers visible */
.sidebar.collapsed .logo-text, 
.sidebar.collapsed .nav-text,
.sidebar.collapsed .clocks { 
    display: none; 
}

/* Slide button to the left */
.sidebar.collapsed .toggle-button {
    margin-left: 0;
    margin-right: auto;
}

/* Flip the icon */
.sidebar.collapsed .toggle-button span {
    transform: rotate(180deg);
}


/* ############################################################
   # 4. BUTTONS & CONTROLS
   ############################################################ */
.cancel-button, .cancel-btn {
    background-color: var(--button-color2);
    color: var(--text-color1);
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: opacity 0.2s;
}

.cancel-button:hover, .cancel-btn:hover {
    opacity: 0.8;
}

.clean-up-button {
    background-color: var(--background-color3);
    color: var(--text-color2);
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    display: block;
    margin: 10px auto;
}

/* ############################################################
   # 5. DATA TABLES
   ############################################################ */
.trades-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    color: var(--text-color2); 
    background-color: var(--background-color3);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.trades-table th {
    background-color: var(--button-color1);
    color: var(--text-color1);
    border: 1px solid #444;
}

.trades-table td {
    border: 1px solid rgba(0,0,0,0.1);
    padding: 12px;
    text-align: left;
    vertical-align: middle;
}

.trades-table tr:nth-child(even) { background-color: rgba(255, 255, 255, 0.2); }
.trades-table tr:hover { background-color: var(--hover-color1); }

/* ############################################################
   # 6. BADGES & LABELS
   ############################################################ */
.strat-label {
    background-color: rgba(0, 0, 0, 0.15); /* Soft dark background */
    color: var(--text-color2) !important;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;      /* Semi-bold instead of heavy bold */
    letter-spacing: 0.5px; /* Pro spacing */
    font-family: 'Inter', 'Poppins', sans-serif; /* Clean font */
    text-transform: uppercase;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white !important;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
}

.status-badge.tracking_atr { background-color: var(--info-blue); }
.status-badge.placed       { background-color: var(--success-green); }
.status-badge.pending      { background-color: #f39c12; }
.status-badge.cancelled    { background-color: var(--danger-red); }

/* ############################################################
   # 7. PROGRESS & CHARTS
   ############################################################ */
.text-green-500, .hit { color: var(--success-green); font-weight: bold; }
.text-gray-500, .waiting { color: #888; }
.text-blue-400 { color: var(--info-blue); }
.text-danger-red { color: var(--danger-red); }
.step-arrow { color: #555; padding: 0 4px; font-weight: normal; }

.bg-gray-700, .chart-container {
    background-color: var(--button-color1);
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.bg-gray-700 { border-left: 4px solid var(--background-color3); }

/* ############################################################
   # 8. Sequential Trades
   ############################################################ */
.sequential-steps {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
}


/* Loading Spinner Logic */
.cancel-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

.spinner-hidden { display: none; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tooltip/Label consistency */
.no-trades {
    text-align: center;
    padding: 40px;
    color: #888;
}

/* ############################################################
   # 9. ATR Trades
   ############################################################ */
   .atr-tracking-container {
    background: #1a1a1a;
    padding: 8px;
    border-radius: 4px;
    border-left: 3px solid #3b82f6; /* Blue indicator */
    min-width: 200px;
}
.atr-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}
.atr-label { font-size: 10px; color: #3b82f6; font-weight: bold; }
.atr-stats { display: flex; flex-direction: column; gap: 2px; }