/* Premium CSS Design System for EMS */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Theme Light Variables */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-sidebar: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active-text: #ffffff;
    --sidebar-active-bg: #3b82f6;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    
    --border-color: #e2e8f0;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --card-hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-rgb: 59, 130, 246;
    --success: #10b981;
    --success-rgb: 16, 185, 129;
    --warning: #f59e0b;
    --warning-rgb: 245, 158, 11;
    --danger: #ef4444;
    --danger-rgb: 239, 68, 68;
    --info: #06b6d4;
    --info-rgb: 6, 182, 212;
    
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(226, 232, 240, 0.8);
    
    --transition-speed: 0.3s;
}

[data-theme="dark"] {
    /* Theme Dark Variables */
    --bg-primary: #090d16;
    --bg-secondary: #111827;
    --bg-sidebar: #0b0f19;
    --sidebar-text: #6b7280;
    --sidebar-active-text: #ffffff;
    --sidebar-active-bg: #2563eb;
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-light: #6b7280;
    
    --border-color: #1f2937;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    --card-hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    
    --glass-bg: rgba(17, 24, 39, 0.6);
    --glass-border: rgba(31, 41, 55, 0.7);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color var(--transition-speed), color var(--transition-speed);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0px); }
}

.animate-fade {
    animation: fadeIn 0.5s ease-out forwards;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Base Layout Structure */
.ems-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100vw;
}

/* Sidebar Styling */
.ems-sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    flex-shrink: 0;
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand-name {
    font-family: 'Outfit', sans-serif;
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 10px;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.menu-category {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
    padding: 10px 15px 5px;
    letter-spacing: 1px;
}

.menu-item {
    margin-bottom: 5px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.925rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.menu-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.menu-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}

.menu-item.active .menu-link {
    color: var(--sidebar-active-text);
    background-color: var(--sidebar-active-bg);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background-color: rgba(0, 0, 0, 0.2);
}

.user-profile-sm {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-sm {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.user-meta-sm {
    display: flex;
    flex-direction: column;
}

.user-name-sm {
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.user-role-sm {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    text-transform: capitalize;
}

/* Content Area */
.ems-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ems-navbar {
    height: 70px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.navbar-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.theme-toggle-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.theme-toggle-btn:hover {
    background-color: var(--bg-primary);
}

.navbar-user-menu {
    position: relative;
    cursor: pointer;
}

/* Page Content Container */
.ems-content {
    flex-grow: 1;
    padding: 28px;
    overflow-y: auto;
}

/* Dashboard Cards System */
.stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
    border-color: rgba(var(--primary-rgb), 0.2);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 16px;
}

.stat-card-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 6px;
}

.stat-card-value {
    font-size: 1.875rem;
    color: var(--text-primary);
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

/* Card Decorative Glow */
.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(var(--primary-rgb), 0.05) 0%, rgba(var(--primary-rgb), 0) 70%);
    border-radius: 50%;
    transform: translate(20px, -20px);
    pointer-events: none;
}

/* Table Design */
.ems-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.ems-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ems-card-body {
    padding: 24px;
}

.table-responsive {
    overflow-x: auto;
}

.ems-table {
    width: 100%;
    border-collapse: collapse;
}

.ems-table th {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.ems-table td {
    padding: 16px 20px;
    color: var(--text-primary);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

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

.ems-table tr:hover td {
    background-color: rgba(var(--primary-rgb), 0.02);
}

/* Badges */
.badge-custom {
    padding: 6px 12px;
    border-radius: 50rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-success { background-color: rgba(var(--success-rgb), 0.1); color: var(--success); }
.badge-warning { background-color: rgba(var(--warning-rgb), 0.1); color: var(--warning); }
.badge-danger { background-color: rgba(var(--danger-rgb), 0.1); color: var(--danger); }
.badge-info { background-color: rgba(var(--info-rgb), 0.1); color: var(--info); }
.badge-primary { background-color: rgba(var(--primary-rgb), 0.1); color: var(--primary); }

/* Login Portal Page Styles - Futuristic Design */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 50%, #0a0a1a 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(139, 92, 246, 0.1) 0%, transparent 40%);
    animation: gradientShift 15s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

/* Particle effect container */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(59, 130, 246, 0.6);
    border-radius: 50%;
    animation: floatParticle 20s infinite linear;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.8);
}

@keyframes floatParticle {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

/* Grid overlay effect */
.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
    pointer-events: none;
    z-index: 2;
}

@keyframes gridMove {
    0% { transform: perspective(500px) rotateX(60deg) translateY(0); }
    100% { transform: perspective(500px) rotateX(60deg) translateY(50px); }
}

.login-card {
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(59, 130, 246, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
    padding: 40px;
    transition: all var(--transition-speed);
    position: relative;
    z-index: 10;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.8), rgba(6, 182, 212, 0.8), transparent);
    animation: borderGlow 3s ease-in-out infinite;
}

@keyframes borderGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.login-logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #3b82f6, #06b6d4, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    animation: logoGradient 5s ease infinite;
    text-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
    position: relative;
}

@keyframes logoGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Custom form styling - Futuristic */
.form-group-custom {
    position: relative;
    margin-bottom: 24px;
}

.form-control {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    color: #333;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 12px 16px;
    transition: all 0.3s ease;
}

.form-control:focus {
    background: white;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    outline: none;
    transform: translateY(-2px);
}

.form-select {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    color: #333;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 12px 16px;
    transition: all 0.3s ease;
}

.form-select:focus {
    background: white;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    outline: none;
}

.form-control-custom {
    width: 100%;
    padding: 14px 16px 14px 44px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    color: #333;
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    transition: all 0.3s ease;
}

.form-control-custom::placeholder {
    color: #adb5bd;
    font-weight: 400;
}

.form-control-custom:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: white;
    transform: translateY(-2px);
}

.form-group-custom i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 1.1rem;
    pointer-events: none;
    transition: all 0.3s ease;
}

.form-control-custom:focus ~ i {
    color: #3b82f6;
}

.btn-primary-custom {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 15px rgba(59, 130, 246, 0.4),
        0 0 30px rgba(59, 130, 246, 0.2);
    position: relative;
    overflow: hidden;
}

.btn-primary-custom::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-primary-custom:hover::before {
    left: 100%;
}

.btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(59, 130, 246, 0.5),
        0 0 40px rgba(139, 92, 246, 0.3);
}

.btn-primary-custom:active {
    transform: translateY(0);
}

/* SkyBus Map Simulated Area */
.skybus-container {
    background-color: #0f172a;
    border-radius: 16px;
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
}

/* Futuristic text colors for login pages */
.text-primary {
    color: #3b82f6 !important;
}

.text-secondary {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* Alert styling for futuristic theme */
.alert {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: #86efac;
}

/* Demo card styling */
.ems-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.ems-card-header {
    background: rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ems-card-body {
    background: rgba(255, 255, 255, 0.03);
}

/* Select dropdown styling */
select.form-control-custom {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    cursor: pointer;
}

select.form-control-custom option {
    background: white;
    color: #333;
}

.skybus-road {
    position: absolute;
    background-color: #334155;
    border: 2px dashed rgba(255, 255, 255, 0.2);
}

.skybus-marker {
    position: absolute;
    width: 44px;
    height: 44px;
    background-color: var(--primary);
    border: 3px solid #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.1rem;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.6);
    transition: top 1s linear, left 1s linear;
    z-index: 10;
}

.skybus-marker-pulse {
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
    pointer-events: none;
}

@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

.skybus-stop {
    position: absolute;
    width: 16px;
    height: 16px;
    background-color: var(--danger);
    border: 3px solid #ffffff;
    border-radius: 50%;
    z-index: 5;
}

/* Modal Custom Glassmorphism styling */
.modal-content-custom {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Smart Attendance Grid */
.attendance-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.attendance-day {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 0.9rem;
    background-color: var(--bg-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.attendance-day:hover {
    transform: scale(1.05);
}

.attendance-day.present {
    background-color: rgba(var(--success-rgb), 0.15);
    color: var(--success);
    border: 1px solid rgba(var(--success-rgb), 0.3);
}

.attendance-day.absent {
    background-color: rgba(var(--danger-rgb), 0.15);
    color: var(--danger);
    border: 1px solid rgba(var(--danger-rgb), 0.3);
}

.attendance-day.late {
    background-color: rgba(var(--warning-rgb), 0.15);
    color: var(--warning);
    border: 1px solid rgba(var(--warning-rgb), 0.3);
}

/* Responsive side nav controls */
@media (max-width: 991.98px) {
    .ems-sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
    }
    
    .ems-sidebar.show {
        left: 0;
    }
}
