/* 
 * Attendance Management System - Theme CSS
 * Modern dark sidebar + light dashboard card style
 */

:root {
    /* Primary Colors - TechTrueView Theme */
    --primary-color: #5b5ce6;
    --primary-dark: #4a4bd4;
    --primary-light: #6b6cf0;

    /* Sidebar - Indigo/Purple */
    --sidebar-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --sidebar-text: #ffffff;
    --sidebar-hover: #4a4bd4;
    --sidebar-active: #ffffff;
    --sidebar-active-bg: rgba(255, 255, 255, 0.15);

    /* Light Dashboard */
    --dashboard-bg: #f5f6f8;
    --card-bg: #ffffff;
    --card-border: #e8eaed;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;

    /* Status/Metric Colors - TechTrueView Style */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0ea5e9;
    --metric-blue: #2563eb;
    --metric-green: #10b981;
    --metric-orange: #f59e0b;
    --metric-teal: #14b8a6;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--dashboard-bg);
    color: var(--text-primary);
}

/* ====================
   Main Layout
   ==================== */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* ====================
   Sidebar Navigation
   ==================== */

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 20px;
    margin: 15px;
    background: #ffffff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.sidebar-logo-text {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 20px;
}

.sidebar-nav {
    padding: 20px 0;
    flex: 1;
}

.nav-item {
    display: block;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-item:hover {
    background-color: var(--sidebar-hover);
    border-left-color: rgba(255, 255, 255, 0.3);
}

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    border-left-color: #ffffff;
    color: #ffffff;
    font-weight: 600;
}

.nav-item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 12px 0;
}

.sidebar-title {
    padding: 12px 20px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-footer {
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    margin-bottom: 10px;
}

.logout-nav {
    color: rgba(255, 255, 255, 0.7) !important;
}

.logout-nav:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #ffffff !important;
}


/* ====================
   Main Content Area
   ==================== */

.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: white;
    border-bottom: 1px solid var(--card-border);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-icon {
    width: 38px;
    height: 38px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    position: relative;
    padding: 0;
}

.notification-icon:hover {
    color: var(--primary-color);
    background: #eff6ff;
    border-color: #bfdbfe;
}

/* Header User Profile Dropdown */
.header-user {
    position: relative;
    display: flex;
    align-items: center;
}

.user-dropdown-toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 12px;
    transition: all 0.2s ease;
    user-select: none;
}

.user-dropdown-toggle:hover {
    background: #f1f5f9;
}

.header-user .user-info {
    text-align: right;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.header-user .user-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.2;
    white-space: nowrap;
}

.header-user .user-role {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.header-user .user-avatar {
    width: 38px;
    height: 38px;
    background: var(--primary-color);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 2px 4px rgba(91, 92, 230, 0.2);
}

.dropdown-arrow {
    font-size: 11px;
    color: #94a3b8;
    transition: transform 0.2s;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    width: 220px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 1001;
    overflow: hidden;
    padding: 8px;
}

.user-dropdown-menu.show {
    display: block !important;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #334155 !important;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-radius: 8px;
}

.user-dropdown-menu a:hover {
    background: #f8fafc;
    color: var(--primary-color) !important;
}

.user-dropdown-menu i {
    color: #64748b;
    font-size: 16px;
    width: 20px;
}

.dropdown-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 6px 0;
}

.logout-link:hover {
    background: #fef2f2 !important;
    color: #dc2626 !important;
}

@media (max-width: 600px) {
    .header-user .user-info {
        display: none;
    }

    .topbar-right {
        gap: 12px;
    }
}

.content-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* ====================
   Cards and Panels
   ==================== */

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--card-border);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.card-body {
    padding: 0;
}

/* ====================
   Dashboard Stats
   ==================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-icon.primary {
    background: rgba(91, 92, 230, 0.15);
    color: var(--primary-color);
}

.stat-icon.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.stat-icon.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.stat-icon.metric-blue {
    background: rgba(37, 99, 235, 0.15);
    color: var(--metric-blue);
}

.stat-icon.metric-green {
    background: rgba(16, 185, 129, 0.15);
    color: var(--metric-green);
}

.stat-icon.metric-orange {
    background: rgba(245, 158, 11, 0.15);
    color: var(--metric-orange);
}

.stat-icon.metric-teal {
    background: rgba(20, 184, 166, 0.15);
    color: var(--metric-teal);
}

.stat-content h3 {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-content .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ====================
   Tables
   ==================== */

.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background-color: #f3f4f6;
}

.table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--card-border);
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-primary);
    font-size: 14px;
}

.table tbody tr:hover {
    background-color: #f9fafb;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ====================
   Buttons
   ==================== */

.btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    outline: none;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: #e5e7eb;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 16px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* ====================
   Forms
   ==================== */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
    color: var(--text-secondary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

/* ====================
   Badges
   ==================== */

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-info {
    background: rgba(14, 165, 233, 0.1);
    color: var(--info);
}

.badge-primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

/* Status Badge Colors for Calendar */
.badge-present {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-absent {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-half-day {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-leave {
    background: rgba(14, 165, 233, 0.1);
    color: var(--info);
}

/* ====================
   Modals
   ==================== */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--card-border);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: none;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ====================
   Alerts
   ==================== */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 4px solid;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border-left-color: var(--success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #7f1d1d;
    border-left-color: var(--danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #78350f;
    border-left-color: var(--warning);
}

.alert-info {
    background: rgba(14, 165, 233, 0.1);
    color: #0c4a6e;
    border-left-color: var(--info);
}

/* ====================
   Calendar Specific
   ==================== */

.fc {
    background: var(--card-bg);
}

.fc .fc-button-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.fc .fc-button-primary:hover {
    background-color: var(--primary-dark);
}

.fc .fc-button-primary.fc-button-active {
    background-color: var(--primary-dark);
}

.fc .fc-daygrid-day:hover {
    background-color: #f3f4f6;
}

.fc .fc-daygrid-day.fc-day-other {
    background-color: #fafafa;
}

/* ====================
   Responsive Design
   ==================== */

@media (max-width: 768px) {
    .sidebar {
        width: 0;
        visibility: hidden;
        transition: all 0.3s;
    }

    .sidebar.show {
        width: 260px;
        visibility: visible;
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .table {
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 8px;
    }

    .content-area {
        padding: 16px;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding: 12px 16px;
    }

    .topbar-title {
        font-size: 16px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-content .value {
        font-size: 24px;
    }

    .card {
        padding: 16px;
    }
}

/* ====================
   Utilities
   ==================== */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-secondary);
}

.mt-16 {
    margin-top: 16px;
}

.mt-24 {
    margin-top: 24px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.flex {
    display: flex;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.hidden {
    display: none;
}

.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--primary-light);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ====================
   Charts and Analytics
   ==================== */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.chart-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--card-border);
}

.chart-header {
    margin-bottom: 20px;
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.mt-24 {
    margin-top: 24px;
}

.metric-purple {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Notification Styles */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid white;
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    width: 320px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 1001;
    overflow: hidden;
}

.notification-dropdown.show {
    display: block !important;
    animation: slideDown 0.2s ease-out;
}

.notification-header {
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.notification-list {
    max-height: 350px;
    overflow-y: auto;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    gap: 12px;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
}

.notification-item:hover {
    background: #f8fafc;
}

.notification-item.unread {
    background: #f0f9ff;
}

.notification-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-monthly_sheet {
    background: #e0f2fe;
    color: #0ea5e9;
}

.notif-regularisation {
    background: #fef3c7;
    color: #d97706;
}

.notification-item-body {
    flex: 1;
}

.notification-item-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.notification-item-message {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

.notification-item-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

.notification-footer {
    padding: 10px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
}

.notification-footer a {
    font-size: 12px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}