/* =========================================
   CSS VARIABLES & THEME CONFIGURATION
   ========================================= */
:root {
    /* --- Light Theme (Default) --- */
    --bg-body: #f4f4f8;
    --bg-container: #ffffff;
    --bg-panel: #f9f9f9;
    --bg-input: #ffffff;
    --bg-modal: #fefefe;
    --bg-tooltip: #ffffff;
    
    --text-main: #333333;
    --text-secondary: #555555;
    --text-muted: #6c757d;
    --text-inverse: #ffffff;
    --text-header: #2c3e50;
    
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --secondary-color: #6c757d;
    --secondary-hover: #5a6268;
    --disabled-bg: #aaaaaa;
    
    --border-light: #eeeeee;
    --border-medium: #cccccc;
    --border-dark: #888888;
    
    --success-color: #28a745;
    --error-color: #dc3545;
    --info-icon-bg: #e9ecef;
    --info-icon-text: #6c757d;
    
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-md: 0 2px 6px rgba(0,0,0,0.05);
    
    /* Solunar & Badges */
    --badge-major-bg: #d4edda;
    --badge-major-text: #155724;
    --badge-major-border: #c3e6cb;
    
    --badge-minor-bg: #fff3cd;
    --badge-minor-text: #856404;
    --badge-minor-border: #ffeeba;
    
    --badge-none-bg: #f8f9fa;
    --badge-none-text: #6c757d;
    --badge-none-border: #dee2e6;
    
    --badge-fair-bg: #f8d7da;
    --badge-fair-text: #721c24;

    --fish-active: #2e7d32;
    --bar-bg: #e0e0e0;
    --divider-color: #dee2e6;
}

[data-theme="dark"] {
    /* --- Dark Theme --- */
    --bg-body: #121212;
    --bg-container: #1e1e1e;
    --bg-panel: #2d2d2d;
    --bg-input: #2d2d2d;
    --bg-modal: #2d2d2d;
    --bg-tooltip: #333333;
    
    --text-main: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #9e9e9e;
    --text-inverse: #ffffff;
    --text-header: #d1d1d1;
    
    --primary-color: #4dabf7;
    --primary-hover: #339af0;
    --secondary-color: #6c757d;
    --secondary-hover: #5a6268;
    --disabled-bg: #555555;
    
    --border-light: #333333;
    --border-medium: #444444;
    --border-dark: #666666;
    
    --success-color: #4cd964;
    --error-color: #ff5252;
    --info-icon-bg: #444444;
    --info-icon-text: #cccccc;
    
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.5);
    --shadow-md: 0 2px 6px rgba(0,0,0,0.3);
    
    /* Solunar & Badges (Dark Mode) */
    --badge-major-bg: #1b4d2e;
    --badge-major-text: #d4edda;
    --badge-major-border: #155724;
    
    --badge-minor-bg: #4d3e1b;
    --badge-minor-text: #fff3cd;
    --badge-minor-border: #856404;
    
    --badge-none-bg: #343a40;
    --badge-none-text: #adb5bd;
    --badge-none-border: #495057;
    
    --badge-fair-bg: #5c2b2b;
    --badge-fair-text: #f8d7da;

    --fish-active: #66bb6a;
    --bar-bg: #444444;
    --divider-color: #444444;
}

/* =========================================
   BASE STYLES
   ========================================= */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 1rem;
    display: flex;
    justify-content: center;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    width: 100%;
    max-width: 500px;
    background: var(--bg-container);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.3s;
}

header {
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.header-logo {
    max-width: 480px;
    width: 100%;
    height: auto;
}

.header-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

/* =========================================
   FORM & INPUT STYLES
   ========================================= */
form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

label {
    font-weight: 500;
    color: var(--text-main);
}

input, select, textarea, .button {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
    background-color: var(--bg-input);
    color: var(--text-main);
}

textarea {
    resize: vertical;
}

button, .button {
    background-color: var(--primary-color);
    color: var(--text-inverse);
    font-weight: bold;
    border: none;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
}

button:hover, .button:hover {
    background-color: var(--primary-hover);
}

button:disabled {
    background-color: var(--disabled-bg);
    cursor: not-allowed;
}

.button-secondary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.button-secondary:hover {
    background-color: var(--secondary-hover);
    border-color: var(--secondary-hover);
}

/* =========================================
   NAVIGATION & LINKS
   ========================================= */
nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.auth-link, .back-link {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* =========================================
   STATUS & ALERTS
   ========================================= */
#status {
    margin-top: 1rem;
    font-weight: 500;
    text-align: center;
}
.status-success {
    color: var(--success-color);
}
.status-error {
    color: var(--error-color);
}

/* =========================================
   MODALS & TOOLTIPS
   ========================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: var(--bg-modal);
    margin: 40% auto;
    padding: 20px;
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    width: 80%;
    max-width: 400px;
    color: var(--text-main);
}

.close-button {
    color: var(--text-muted);
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: var(--text-main);
    text-decoration: none;
    cursor: pointer;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    background-color: var(--info-icon-bg);
    color: var(--info-icon-text);
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 4px;
    vertical-align: middle;
}

.info-icon:hover {
    background-color: var(--primary-color);
    color: var(--text-inverse);
}

/* =========================================
   DASHBOARD & WEATHER WIDGET
   ========================================= */
.forecast-container {
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.weather-card {
    background: var(--bg-container);
    border-radius: 8px;
    padding: 8px 15px;
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    font-size: 0.95rem;
    color: var(--text-header);
}

.wx-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wx-icon-img {
    width: 32px;
    height: 32px;
}

.wx-temp {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-header);
}

.wx-divider {
    width: 1px;
    height: 20px;
    background-color: var(--divider-color);
    display: block;
}

.wx-data-text {
    font-weight: 600;
}

.trend-arrow {
    font-size: 1.1rem;
    margin-left: 2px;
}

/* Bite Ratings */
.bite-tag {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.rating-excellent { background-color: var(--badge-major-bg); color: var(--badge-major-text); }
.rating-normal { background-color: var(--badge-minor-bg); color: var(--badge-minor-text); }
.rating-fair { background-color: var(--badge-fair-bg); color: var(--badge-fair-text); }

/* Tooltip Box */
.tooltip-box {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 240px;
    background-color: var(--bg-tooltip);
    border: 1px solid var(--border-light);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 12px;
    z-index: 1000;
    text-align: left;
    margin-top: 8px;
}
.tooltip-box.active { display: block; }
.tooltip-item { font-size: 0.85rem; margin-bottom: 8px; line-height: 1.4; color: var(--text-secondary); }

/* =========================================
   CHARTS & MAPS
   ========================================= */
#tideChart {
    min-height: 300px; 
    width: 100%;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    display: block; 
    background-color: var(--bg-container);
}

#map-container {
    width: 100%;
    height: 400px;
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-medium);
    position: relative;
}

#map {
    height: 100%;
    width: 100%;
    background-color: var(--bar-bg);
}

#status-panel {
    text-align: center;
    padding: 1rem;
    background-color: var(--bg-panel);
    border-radius: 8px;
    margin-bottom: 1rem;
}

#accuracy-display {
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--primary-color);
}

/* =========================================
   LISTS & CARDS
   ========================================= */
.catch-card {
    background-color: var(--bg-container);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.catch-card h2 {
    margin-top: 0;
    color: var(--primary-color);
}

.tally-container {
    padding: 0.5rem 1.5rem 1rem 1.5rem;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.tally-container li {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.tally-header {
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-medium);
    font-size: 1rem;
    color: var(--text-main);
}

.date-separator {
    background-color: var(--bg-panel);
    color: var(--text-main);
    padding: 10px 15px;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border-bottom: 2px solid var(--primary-color);
    font-size: 1.2rem;
}

/* =========================================
   ADMIN & TABLES
   ========================================= */
.admin-table-container {
    overflow-x: auto;
}

.admin-catch-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border-light);
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.75rem;
    display: inline-block;
    text-transform: uppercase;
    margin-top: 4px;
}

.badge-major {
    background-color: var(--badge-major-bg);
    color: var(--badge-major-text);
    border: 1px solid var(--badge-major-border);
}

.badge-minor {
    background-color: var(--badge-minor-bg);
    color: var(--badge-minor-text);
    border: 1px solid var(--badge-minor-border);
}

.badge-none {
    background-color: var(--badge-none-bg);
    color: var(--badge-none-text);
    border: 1px solid var(--badge-none-border);
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.8rem;
    width: auto;
}

.btn-danger {
    background-color: var(--error-color);
}
.btn-danger:hover {
    background-color: #c82333;
}

/* =========================================
   SOLUNAR & MISC
   ========================================= */
.coeff-bar-container {
    flex-grow: 1;
    height: 8px;
    background-color: var(--bar-bg);
    border-radius: 4px;
    overflow: hidden;
    margin-left: 10px;
}

.coeff-bar-fill {
    height: 100%;
    border-radius: 4px;
}

.coeff-text {
    font-weight: bold;
    min-width: 25px;
    text-align: right;
}

/* Fish Activity Icons */
.fish-icon {
    font-size: 1.2rem;
    opacity: 0.3; /* Dim inactive fish */
    filter: grayscale(100%); /* Make inactive fish gray */
    margin-right: 2px;
}

.fish-active {
    opacity: 1; /* Bright active fish */
    filter: none; /* Restore color */
}

/* =========================================
   ADVISOR PAGE STYLES
   ========================================= */
.advisor-card {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.best-window-box {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

.best-window-time {
    font-size: 2rem;
    font-weight: 800;
    margin: 10px 0;
    display: block;
}

.score-badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.9rem;
}

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}
.insight-item:last-child { border-bottom: none; }

.insight-icon { font-size: 1.5rem; }

.history-match {
    background-color: var(--badge-major-bg);
    border: 1px solid var(--success-color);
    color: var(--text-main);
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    margin-bottom: 15px;
}

/* AI Analysis Box */
.ai-box {
    background-color: var(--bg-panel);
    border-left: 4px solid var(--secondary-color);
    padding: 15px;
    border-radius: 4px;
    margin-top: 15px;
    font-size: 0.95rem;
    line-height: 1.6;
}
.ai-box h3 { margin-top: 0; color: var(--primary-color); }
.ai-box ul { padding-left: 20px; }
.ai-box strong { color: var(--text-header); }