/* Material Design Variables */
:root {
    --primary-color: #A8FBD3;
    --hover-color: #8AE5B8;
    --active-color: #637AB9;
    --text-primary: #333;
    --text-secondary: #666;
    --background: #f8f9fa;
    --sidebar-bg: #A8FBD3;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --border-radius: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables */
body.dark-mode,
html.dark-mode-loading {
    --text-primary: #d4d4d4;
    --text-secondary: #cccccc;
    --background: #1e1e1e;
    --sidebar-bg: #2d2d30;
    --shadow: 0 2px 8px rgba(0,0,0,0.5);
    --card-bg: #252526;
    --card-border: #3e3e42;
    --hover-bg: #3e3e42;
}

/* Apply dark mode styles to html element during loading */
html.dark-mode-loading {
    background-color: #1e1e1e;
}

html.dark-mode-loading body {
    background-color: #1e1e1e;
    color: #d4d4d4;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--sidebar-bg);
    box-shadow: var(--shadow);
    z-index: 1000;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: 70px;
}

/* Sidebar Header */
.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    opacity: 1;
    transition: var(--transition);
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Hamburger Menu */
.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    transition: var(--transition);
}

.hamburger span {
    width: 100%;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
    transform-origin: center;
}

.sidebar.collapsed .hamburger span:nth-child(1) {
    transform: rotate(-45deg) translate(-6px, 6px);
}

.sidebar.collapsed .hamburger span:nth-child(2) {
    opacity: 0;
}

.sidebar.collapsed .hamburger span:nth-child(3) {
    transform: rotate(45deg) translate(-6px, -6px);
}

/* Sidebar Menu */
.sidebar-menu {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.menu-items {
    list-style: none;
    padding: 0 1rem;
}

.menu-item {
    margin-bottom: 0.5rem;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    transition: var(--transition);
    position: relative;
}

.menu-link:hover {
    background-color: var(--hover-color);
    color: var(--text-primary);
    transform: translateX(4px);
}

.menu-link.active {
    background-color: var(--active-color);
    color: white;
}

.menu-icon {
    font-size: 1.2rem;
    margin-right: 1rem;
    min-width: 20px;
    text-align: center;
    transition: var(--transition);
}

.menu-text {
    font-weight: 500;
    white-space: nowrap;
    opacity: 1;
    transition: var(--transition);
}

.sidebar.collapsed .menu-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .menu-link {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .menu-icon {
    margin-right: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #e9ecef;
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--active-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.logout-btn:hover {
    background: #4A5A8A;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 122, 185, 0.3);
}

.logout-icon {
    font-size: 1.2rem;
    margin-right: 1rem;
    transition: var(--transition);
}

.logout-text {
    white-space: nowrap;
    opacity: 1;
    transition: var(--transition);
}

.sidebar.collapsed .logout-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .logout-btn {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .logout-icon {
    margin-right: 0;
}

/* Main Content */
.main-content {
    margin-left: 280px;
    min-height: 100vh;
    transition: var(--transition);
    padding: 2rem;
}

.main-content.expanded {
    margin-left: 70px;
}

/* Content Container */
.content-container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    min-height: calc(100vh - 4rem);
}

/* Floating Mobile Menu Button */
.mobile-menu-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: var(--sidebar-bg);
    border: none;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 44px;
    height: 44px;
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    background: var(--hover-color);
    transform: scale(1.05);
}

.mobile-menu-btn span {
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px;
    transition: var(--transition);
    transform-origin: center;
}

.mobile-menu-btn.active {
    left: calc(280px - 44px - 20px); /* Move to right edge of sidebar */
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        z-index: 1000;
    }

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

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .content-container {
        padding: 1rem;
        min-height: calc(100vh - 2rem);
    }

    .hamburger {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0.5rem;
    }

    .content-container {
        padding: 1rem;
        border-radius: 0;
        box-shadow: none;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Notification System */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.notification {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    min-width: 320px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    position: relative;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid;
    will-change: transform, opacity;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.hide {
    transform: translateX(100%);
    opacity: 0;
}

/* Notification Types */
.notification.success {
    border-left-color: #4CAF50;
}

.notification.error {
    border-left-color: #F44336;
}

.notification.info {
    border-left-color: var(--active-color);
}

.notification.warning {
    border-left-color: #FF9800;
}

/* Notification Icon */
.notification-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.notification.success .notification-icon {
    background: #4CAF50;
    color: white;
}

.notification.error .notification-icon {
    background: #F44336;
    color: white;
}

.notification.info .notification-icon {
    background: var(--active-color);
    color: white;
}

.notification.warning .notification-icon {
    background: #FF9800;
    color: white;
}

/* Notification Content */
.notification-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin: 0;
}

.notification-message {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

/* Close Button */
.notification-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1;
    transition: var(--transition);
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

/* Progress Bar */
.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    overflow: hidden;
}

.notification-progress-bar {
    height: 100%;
    background: currentColor;
    opacity: 0.3;
    transition: width linear;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.notification.success .notification-progress-bar {
    background: #4CAF50;
}

.notification.error .notification-progress-bar {
    background: #F44336;
}

.notification.info .notification-progress-bar {
    background: var(--active-color);
}

.notification.warning .notification-progress-bar {
    background: #FF9800;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }

    .notification {
        min-width: auto;
        max-width: none;
    }
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--sidebar-bg);
    border: 2px solid var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: var(--transition);
    z-index: 1002; /* Higher than mobile menu button and sidebar */
    box-shadow: var(--shadow);
    pointer-events: auto; /* Ensure it can receive clicks */
    user-select: none; /* Prevent text selection */
}

.dark-mode-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 15px rgba(168, 251, 211, 0.3);
}

.dark-mode-toggle:active {
    transform: scale(0.95);
}

.dark-mode-toggle .sun-icon,
.dark-mode-toggle .moon-icon {
    position: absolute;
    transition: all 0.3s ease;
    pointer-events: none; /* Let clicks pass through to button */
}

.dark-mode-toggle .moon-icon {
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

/* Dark mode active state */
body.dark-mode .dark-mode-toggle {
    background: var(--card-bg);
    border-color: var(--card-border);
}

body.dark-mode .dark-mode-toggle .sun-icon {
    opacity: 0;
    transform: rotate(-180deg) scale(0);
}

body.dark-mode .dark-mode-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: var(--background);
    color: var(--text-primary);
}

body.dark-mode .main-content {
    background-color: #252526; /* Slightly less dark canvas */
}

body.dark-mode .content-container {
    background-color: #252526; /* Slightly less dark canvas for content containers */
}

body.dark-mode .sidebar {
    background: var(--sidebar-bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.dark-mode .sidebar-header {
    border-bottom: 1px solid var(--card-border);
}

body.dark-mode .logo-text {
    color: var(--text-primary);
}

body.dark-mode .menu-link {
    color: var(--text-primary);
}

body.dark-mode .menu-link:hover {
    background: var(--hover-bg);
}

body.dark-mode .menu-link.active {
    background: var(--active-color);
    color: #ffffff;
}

body.dark-mode .logout-btn {
    background: var(--active-color);
    color: #ffffff;
}

body.dark-mode .logout-btn:hover {
    background: #4A5A8A;
}

body.dark-mode .hamburger span {
    background: var(--text-primary);
}

body.dark-mode .mobile-menu-btn span {
    background: var(--text-primary);
}

body.dark-mode .mobile-menu-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
}

body.dark-mode .mobile-menu-btn:hover {
    background: var(--hover-bg);
}

/* Responsive adjustments for dark mode toggle */
@media (max-width: 768px) {
    .dark-mode-toggle {
        top: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
        z-index: 1002; /* Higher than mobile menu button */
    }
}

@media (max-width: 480px) {
    .dark-mode-toggle {
        top: 0.75rem;
        right: 0.75rem;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        z-index: 1002; /* Higher than mobile menu button */
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 1rem;
}

.mb-2 {
    margin-bottom: 1rem;
}
