/* Main Application Styles */
:root {
    --primary-color: #4361ee;
    --primary-dark: #3a56d4;
    --primary-light: #4895ef;
    --secondary-color: #7209b7;
    --success-color: #4cc9f0;
    --warning-color: #f72585;
    --error-color: #e63946;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border-color: #dee2e6;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1), 0 5px 10px rgba(0,0,0,0.05);
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --primary-color: #5b75ff;
    --primary-dark: #4a63e8;
    --primary-light: #6d8aff;
    --secondary-color: #8a2be2;
    --success-color: #5fd4ff;
    --warning-color: #ff3b94;
    --error-color: #ff4757;
    --background-color: #0f1419;
    --surface-color: #1a202c;
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    --border-color: #2d3748;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.2);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.4), 0 5px 10px rgba(0,0,0,0.3);
}

/* Auto Theme - Follows system preference */
[data-theme="auto"] {
    /* Uses light theme by default, dark theme when system prefers dark */
}

@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        --primary-color: #5b75ff;
        --primary-dark: #4a63e8;
        --primary-light: #6d8aff;
        --secondary-color: #8a2be2;
        --success-color: #5fd4ff;
        --warning-color: #ff3b94;
        --error-color: #ff4757;
        --background-color: #0f1419;
        --surface-color: #1a202c;
        --text-primary: #f7fafc;
        --text-secondary: #e2e8f0;
        --text-muted: #a0aec0;
        --border-color: #2d3748;
        --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
        --shadow-md: 0 4px 6px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.2);
        --shadow-lg: 0 10px 25px rgba(0,0,0,0.4), 0 5px 10px rgba(0,0,0,0.3);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

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

a:hover {
    color: var(--primary-dark);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.container-fluid {
    width: 100%;
    padding: 0 1rem;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.75rem;
}

.col {
    flex: 1;
    padding: 0 0.75rem;
}

/* Grid System */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Cards */
.card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0,0,0,0.02);
}

[data-theme="dark"] .card-header,
[data-theme="auto"] .card-header {
    background: rgba(255,255,255,0.02);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0,0,0,0.02);
}

[data-theme="dark"] .card-footer,
[data-theme="auto"] .card-footer {
    background: rgba(255,255,255,0.02);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a08a0;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(0,0,0,0.05);
    color: var(--text-primary);
}

[data-theme="dark"] .btn-ghost:hover:not(:disabled),
[data-theme="auto"] .btn-ghost:hover:not(:disabled) {
    background: rgba(255,255,255,0.05);
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #d32f2f;
    transform: translateY(-1px);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--surface-color);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.form-control:disabled {
    background: var(--background-color);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 1rem;
    height: 1rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    border-left: 4px solid transparent;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

[data-theme="dark"] .alert-success,
[data-theme="auto"] .alert-success {
    background: rgba(76, 201, 240, 0.1);
    color: #4cc9f0;
    border-color: rgba(76, 201, 240, 0.3);
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

[data-theme="dark"] .alert-error,
[data-theme="auto"] .alert-error {
    background: rgba(230, 57, 70, 0.1);
    color: #e63946;
    border-color: rgba(230, 57, 70, 0.3);
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

[data-theme="dark"] .alert-warning,
[data-theme="auto"] .alert-warning {
    background: rgba(247, 37, 133, 0.1);
    color: #f72585;
    border-color: rgba(247, 37, 133, 0.3);
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

[data-theme="dark"] .alert-info,
[data-theme="auto"] .alert-info {
    background: rgba(67, 97, 238, 0.1);
    color: #4361ee;
    border-color: rgba(67, 97, 238, 0.3);
}

/* Navigation */
.navbar {
    background: var(--surface-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.navbar-nav a {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
}

.navbar-nav a:hover,
.navbar-nav a.active {
    color: var(--primary-color);
}

.navbar-nav a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

/* Sidebar */
.sidebar {
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.25rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.sidebar-nav .nav-icon {
    width: 1.25rem;
    height: 1.25rem;
    opacity: 0.7;
}

/* Main Content */
.main-content {
    margin-left: 250px;
    min-height: 100vh;
    background: var(--background-color);
    transition: background-color 0.3s ease;
}

.content-header {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
}

.content-body {
    padding: 2rem;
}

/* Tables */
.table {
    width: 100%;
    background: var(--surface-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: rgba(0,0,0,0.02);
    font-weight: 600;
    color: var(--text-primary);
}

[data-theme="dark"] .table th,
[data-theme="auto"] .table th {
    background: rgba(255,255,255,0.02);
}

.table tbody tr:hover {
    background: rgba(0,0,0,0.02);
}

[data-theme="dark"] .table tbody tr:hover,
[data-theme="auto"] .table tbody tr:hover {
    background: rgba(255,255,255,0.02);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    border-radius: 50px;
}

.badge-primary {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
}

.badge-success {
    background: rgba(76, 201, 240, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(247, 37, 133, 0.1);
    color: var(--warning-color);
}

.badge-error {
    background: rgba(230, 57, 70, 0.1);
    color: var(--error-color);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.25rem;
    height: 1.25rem;
    margin: -0.625rem 0 0 -0.625rem;
    border: 2px solid transparent;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-primary);
}

[data-theme="dark"] .theme-toggle:hover,
[data-theme="auto"] .theme-toggle:hover {
    background: rgba(255,255,255,0.05);
}

.theme-toggle .light-icon,
.theme-toggle .dark-icon,
.theme-toggle .auto-icon {
    display: none;
}

[data-theme="light"] .theme-toggle .light-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .dark-icon {
    display: block;
}

[data-theme="auto"] .theme-toggle .auto-icon {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
        z-index: 1001;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .navbar-nav {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .sidebar,
    .btn {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
    }
    
    body {
        background: white;
    }
}

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

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.position-relative { position: relative; }
.position-absolute { position: absolute; }
.position-fixed { position: fixed; }
.position-sticky { position: sticky; }

/* Footer Top Responsive Styles */
.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: #0099ff;
    color: white;
    padding: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .footer-top {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .footer-top > div {
        padding: 4px !important;
    }
    
    #footer-clock {
        order: -1; /* Put clock at top on mobile */
        width: 100%;
    }
}

@media (max-width: 480px) {
    .footer-top {
        font-size: 12px !important;
    }
    
    #footer-clock {
        font-size: 11px !important;
    }
}