/* Custom styles for the Modern Dark Mode */
:root {
    --primary-color: #06B6D4; /* Corporate Cyan/Teal Accent */
    --page-bg: #111827; /* Dark Navy Background */
    --card-bg: #1F2937; /* Slightly Lighter Dark Gray for Cards */
    --text-color: #D1D5DB; /* Light Gray Text */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--page-bg);
    color: var(--text-color); 
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

/* Clean focus effect for inputs */
.professional-input {
    background-color: #374151; /* Dark input background */
    border: 1px solid #4B5563; /* Darker border */
    color: white;
}

.professional-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.4); /* Cyan ring */
    border-color: var(--primary-color) !important;
    background-color: #1F2937; /* Slightly darker on focus */
}

/* Password field specific styling to override browser defaults */
.professional-input[type="password"] {
    background-color: #374151 !important;
    border-color: #4B5563 !important;
    color: white !important;
    -webkit-text-fill-color: white !important;
}

.professional-input[type="password"]::placeholder {
    color: #9ca3af !important;
    -webkit-text-fill-color: #9ca3af !important;
}

.professional-input[type="password"]:focus {
    background-color: #1F2937 !important;
    border-color: var(--primary-color) !important;
    color: white !important;
    -webkit-text-fill-color: white !important;
}

.professional-button {
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); /* Deeper shadow for dark mode */
}

.professional-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* Custom Checkbox/Toggle Styling for Dark Mode */
.professional-checkbox {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #6B7280; /* Medium gray border */
    background-color: #374151;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.professional-checkbox:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.professional-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white; /* White checkmark for better visibility */
    font-weight: bold;
    font-size: 0.75rem;
}

/* --- SPINNER STYLES --- */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

/* Tooltip Styles (for chart) */
#tooltip {
    position: absolute;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.875rem;
    background: rgba(43, 49, 58, 0.95); /* Semi-transparent dark background */
    border: 1px solid var(--primary-color);
    border-radius: 0.375rem;
    pointer-events: none; /* Crucial: ensures the tooltip doesn't block mouse events on the chart */
    opacity: 0;
    transition: opacity 0.1s;
    color: white;
    z-index: 50;
}
.tooltip-value {
    font-weight: bold;
    color: var(--primary-color);
}

/* Body Fill Fix */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 0;
}

/* Main Fill - pt-20 accounts for fixed header (h-20 = 80px) */
main {
    flex: 1;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Console Fill */
#main-console {
    flex: 1;
    display: block;
}

/* Grid - Clean structure for two equal columns */
#main-console .grid {
    display: grid !important;
    align-items: start;
    width: 100%;
    position: relative;
}

/* Ensure columns don't overlap - grid items should remain grid items */
#main-console .grid > div {
    position: relative;
    /* Removed display: block - grid items use default grid item behavior */
}

/* Reset Margins on Title */
.text-center {
    margin-top: 0 !important;
    margin-bottom: 1rem !important;
}

/* AI Analysis Insight - Fixed height with scrolling */
#ai_analysis_insight {
    overflow-y: auto !important;
    resize: none !important;
    min-height: auto !important;
    max-height: none !important;
    height: auto !important;
}

/* Custom scrollbar styling for all textareas to match grey background */
textarea::-webkit-scrollbar {
    width: 8px;
}

textarea::-webkit-scrollbar-track {
    background: #1F2937; /* Match the grey-800 background */
    border-radius: 4px;
}

textarea::-webkit-scrollbar-thumb {
    background: #4B5563; /* Grey-600 for the thumb */
    border-radius: 4px;
}

textarea::-webkit-scrollbar-thumb:hover {
    background: #6B7280; /* Grey-500 on hover */
}

/* Firefox scrollbar styling for all textareas */
textarea {
    scrollbar-width: thin;
    scrollbar-color: #4B5563 #1F2937; /* thumb color, track color */
}

/* Typing cursor animation for AI Analysis Insight */
#typing_cursor {
    animation: blink-cursor 1s step-end infinite;
    color: #06b6d4; /* cyan-400 to match theme */
    font-weight: bold;
}

@keyframes blink-cursor {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}
