:root, [data-theme="dark"] {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-primary: #ffffff; /* Simple white accent */
    --accent-secondary: #e0e0e0;
    --card-bg: #1e1e1e;
    --card-border: #333333;
    --input-bg: #121212;
    --input-border: #333333;
    --input-focus: #ffffff;
    --navbar-bg: #1e1e1e;
    --footer-bg: #1e1e1e;
    --border-color: #333333;
    --table-header-bg: #2c2c2c;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #1e1e1e 0%, #2c2c2c 100%);
    --gradient-secondary: linear-gradient(135deg, #2c2c2c 0%, #333333 100%);
    --gradient-accent: linear-gradient(135deg, #a0a0a0 0%, #ffffff 100%);
}

[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --accent-primary: #212529; /* Dark accent for light mode */
    --accent-secondary: #495057;
    --card-bg: #ffffff;
    --card-border: #dee2e6;
    --input-bg: #ffffff;
    --input-border: #ced4da;
    --input-focus: #212529;
    --navbar-bg: #ffffff;
    --footer-bg: #f8f9fa;
    --border-color: #dee2e6;
    --table-header-bg: #e9ecef;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    --gradient-secondary: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    --gradient-accent: linear-gradient(135deg, #495057 0%, #212529 100%);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Navbar Styling */
.navbar {
    background-color: var(--navbar-bg) !important;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1030 !important;
    width: 100%;
}

body {
    padding-top: 76px;
}

/* Layout Utilities & Resets */
html {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.footer, footer, .bg-dark, .bg-light {
    margin-bottom: 0 !important;
    margin-top: 0 !important;
}

body > *:last-child {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.container:last-child,
.container-fluid:last-child,
.row:last-child,
[class*="col-"]:last-child {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

p:last-child,
h1:last-child,
h2:last-child,
h3:last-child,
h4:last-child,
h5:last-child,
h6:last-child,
div:last-child {
    margin-bottom: 0 !important;
}

/* Direction Control */
body, .navbar, .navbar-nav, .navbar-brand, .container-fluid, .navbar-collapse {
    direction: ltr !important;
}

[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

.navbar * {
    direction: ltr !important;
    text-align: left !important;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
    color: var(--text-primary) !important;
}

.navbar-nav .nav-link {
    font-weight: 500;
    margin: 0 5px;
    color: var(--text-secondary) !important;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--text-primary) !important;
}

.dropdown-menu {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
}

.dropdown-item {
    color: var(--text-secondary);
}

.dropdown-item:hover, .dropdown-item:focus {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.dropdown-divider {
    border-top-color: var(--border-color);
}

/* Footer Styling */
.footer {
    background-color: var(--footer-bg);
    color: var(--text-primary);
    padding: 50px 0 20px 0;
    margin-top: auto; /* Push to bottom */
    border-top: 1px solid var(--border-color);
}

.footer h5 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 20px;
    position: relative;
}

.footer h5:after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 50px;
    height: 2px;
    background-color: var(--accent-primary);
}

.footer p, .footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
    line-height: 1.6;
}

.footer a:hover {
    color: var(--accent-primary);
}

.footer-contact-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.footer-contact-item i {
    width: 20px;
    margin-right: 10px;
    color: var(--accent-primary);
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    margin-top: 30px;
    text-align: center;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    margin: 0 5px;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-3px);
}

/* General Utilities */
.text-muted {
    color: var(--text-secondary) !important;
}

.bg-light {
    background-color: var(--bg-primary) !important;
}

.card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

/* Navbar Toggler Fix */
.navbar-toggler {
    border-color: var(--text-primary) !important;
}

.navbar-toggler:focus {
    box-shadow: none;
}

.navbar-toggler-icon {
    background-image: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5em;
    height: 1.5em;
}

.navbar-toggler-icon::after {
    content: '\f0c9'; /* FontAwesome bars */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* Explicit overrides for session list to ensure visibility */
.session-name {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .session-name {
    color: #ffffff !important;
}

[data-theme="light"] .session-name {
    color: #212529 !important;
}
