/* css/theme-toggle.css - Dark Mode Theme System */

/* CSS Variables for Light Theme (Default) */
:root {
    /* Background Colors */
    --bg-primary: #f2f2f2;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f9f9f9;
    --bg-hover: #f0f0f0;
    --bg-active: #e3f2fd;
    --bg-input: #f9f9f9;

    /* Text Colors */
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-tertiary: #7b7b7b;
    --text-inverse: #ffffff;
    --text-link: #007bff;
    --text-error: #dc3545;

    /* Border Colors */
    --border-primary: #e0e0e0;
    --border-secondary: #dddddd;
    --border-focus: #007cba;
    --border-error: #dc3545;

    /* Button Colors */
    --btn-primary-bg: #007bff;
    --btn-primary-hover: #0056b3;
    --btn-secondary-bg: #e0e0e0;
    --btn-secondary-hover: #c9c9c9;
    --btn-secondary-text: #333333;
    --btn-success-bg: #28a745;
    --btn-success-hover: #218838;
    --btn-disabled-bg: #6c757d;

    /* Accent Colors */
    --accent-primary: #007bff;
    --accent-hover: #0056b3;
    --accent-light: #bbdefb;

    /* Message Colors */
    --msg-user-bg: #007bff;
    --msg-user-hover: #0056b3;
    --msg-bot-bg: #f0f0f0;
    --msg-bot-hover: #e6e6e6;

    /* Status Message Colors */
    --status-success-bg: #d4edda;
    --status-success-text: #155724;
    --status-success-border: #c3e6cb;
    --status-error-bg: #f8d7da;
    --status-error-text: #721c24;
    --status-error-border: #f5c6cb;

    /* Table Colors - Using existing variables for consistency */
    --table-header-bg: var(--bg-primary);      /* #f2f2f2 */
    --table-row-even: var(--bg-tertiary);      /* #f9f9f9 */
    --table-row-hover: #f5f5f5;
    --table-border: #000000;

    /* Shadow Colors */
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.3);
    --shadow-focus: rgba(0, 124, 186, 0.3);
}

/* Dark Theme Variables */
[data-theme="dark"] {
    /* Background Colors */
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;    
    --bg-tertiary: #2a2a2a;
    --bg-hover: #333333;
    --bg-active: #1a365d;
    --bg-input: #2d2d2d;

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-tertiary: #8a8a8a;
    --text-inverse: #ffffff;
    --text-link: #66b3ff;

    /* Border Colors */
    --border-primary: #404040;
    --border-secondary: #4a4a4a;
    --border-focus: #66b3ff;

    /* Button Colors */
    --btn-primary-bg: #0056b3;
    --btn-primary-hover: #007bff;
    --btn-secondary-bg: var(--border-primary);     /* #404040 */
    --btn-secondary-hover: var(--border-secondary); /* #4a4a4a */
    --btn-secondary-text: var(--text-primary);     /* #ffffff */
    --btn-success-bg: #2e7d32;
    --btn-success-hover: #388e3c;
    --btn-disabled-bg: #424242;

    /* Accent Colors */
    --accent-primary: #66b3ff;
    --accent-hover: #80c7ff;
    --accent-light: #1a365d;

    /* Message Colors */
    --msg-user-bg: var(--btn-primary-bg);      /* #0056b3 */
    --msg-user-hover: var(--btn-primary-hover); /* #007bff */
    --msg-bot-bg: var(--bg-tertiary);          /* #2a2a2a */
    --msg-bot-hover: var(--bg-hover);          /* #333333 */

    /* Status Message Colors */
    --status-success-bg: #1b5e20;
    --status-success-text: #66bb6a;
    --status-success-border: #2e7d32;
    --status-error-bg: #b71c1c;
    --status-error-border: #d32f2f;

    /* Table Colors - Using existing variables for consistency */
    --table-header-bg: var(--bg-tertiary);     /* #2a2a2a */
    --table-row-even: var(--bg-secondary);     /* #1e1e1e */
    --table-row-hover: var(--bg-hover);        /* #333333 */
    --table-border: var(--border-primary);     /* #404040 */

    /* Shadow Colors */
    --shadow-light: rgba(0, 0, 0, 0.4);
    --shadow-medium: rgba(0, 0, 0, 0.7);
    --shadow-focus: rgba(102, 179, 255, 0.4);
}

/* Theme Toggle Switch Styling */
.theme-toggle {
    cursor: pointer;
    z-index: 1000;
}

/* Theme toggle positioning for container pages */
.container .theme-toggle {
    position: absolute;
    top: 10px;
    left: 10px;
}

/* Logout button positioning for container pages */
.container .logout-button {
    position: absolute;
    top: 10px;
    right: 10px;
}

/* Theme toggle positioning in sidebar */
.sidebar-button-container .theme-toggle {
    position: static;
}

/* Toggle Switch Container */
.toggle-switch {
    width: 65px;
    height: 30px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 25px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--shadow-light);
}



/* Toggle Slider - contains icons and circle */
.toggle-slider {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 15px;
    overflow: hidden;
}

/* Toggle Icons */
.toggle-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    z-index: 1;
    transition: all 0.3s ease;
}

.sun-icon {
    left: 8px;
    color: #ffa500; /* Orange color for sun */
}

.moon-icon {
    right: 8px;
    color: #4169e1; /* Blue color for moon */
}

/* Toggle Circle */
.toggle-circle {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    background: var(--accent-primary);
    border-radius: 50%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 2;
    box-shadow: 0 2px 4px var(--shadow-light);
}



/* Circle position based on theme */
.toggle-switch[data-theme="dark"] .toggle-circle {
    transform: translateX(34px);
}

.toggle-switch[data-theme="light"] .toggle-circle {
    transform: translateX(0);
}

/* Logout Button Styling - mirrors theme toggle */
.logout-button {
    cursor: pointer;
    z-index: 1000;
}

.logout-switch {
    width: 65px;
    height: 30px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 25px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--shadow-light);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-primary);
}

.logout-switch:hover {
    background: var(--bg-hover);
    box-shadow: 0 4px 12px var(--shadow-medium);
}

.logout-icon {
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.logout-switch:hover .logout-icon {
    color: var(--accent-primary);
}

/* Smooth transitions for theme switching - only when user actively switches */
.theme-transitioning * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Accessibility improvements */
.theme-toggle:focus {
    outline: none;
}



/* Responsive adjustments */
@media (max-width: 768px) {
    .container .theme-toggle {
        top: 15px;
        left: 15px;
    }

    .container .logout-button {
        top: 15px;
        right: 15px;
    }

    .toggle-switch {
        width: 60px;
        height: 30px;
    }

    .toggle-icon {
        font-size: 12px;
    }

    .sun-icon {
        left: 6px;
    }

    .moon-icon {
        right: 6px;
    }

    .toggle-circle {
        width: 22px;
        height: 22px;
        top: 2px;
        left: 2px;
    }

    .toggle-switch[data-theme="dark"] .toggle-circle {
        transform: translateX(28px);
    }

    .logout-switch {
        width: 60px;
        height: 30px;
    }

    .logout-icon {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .container .theme-toggle {
        top: 10px;
        left: 10px;
    }

    .container .logout-button {
        top: 10px;
        right: 10px;
    }

    .toggle-switch {
        width: 50px;
        height: 25px;
    }

    .toggle-icon {
        font-size: 10px;
    }

    .sun-icon {
        left: 5px;
    }

    .moon-icon {
        right: 5px;
    }

    .toggle-circle {
        width: 19px;
        height: 19px;
        top: 1px;
        left: 1px;
    }

    .toggle-switch[data-theme="dark"] .toggle-circle {
        transform: translateX(24px);
    }

    .logout-switch {
        width: 50px;
        height: 25px;
    }

    .logout-icon {
        font-size: 10px;
    }
}