/* --- BASE DESIGN SYSTEM --- */
:root {
    --bg-color: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;

    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);

    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Overrides */
body.light-theme {
    --bg-color: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;

    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);

    background-image:
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
}

body.light-theme input,
body.light-theme select,
body.light-theme textarea {
    background: rgba(255, 255, 255, 0.5);
}

body.light-theme .data-table th {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .glass-nav {
    background: rgba(255, 255, 255, 0.8);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- UTILITIES & COMMON --- */
.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.view {
    display: none;
    flex: 1;
    flex-direction: column;
}

.active-view {
    display: flex;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- GLASSMORPHISM CARDS --- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    padding: 1.5rem;
}

.glass-nav {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* --- TYPOGRAPHY & FORMS --- */
h2,
h3 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

p.subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.help-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
}

input,
select,
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.input-wrapper input {
    padding-left: 2.75rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: var(--success-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    transition: var(--transition);
}

.icon-btn:hover {
    color: var(--text-main);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* --- LOGIN VIEW --- */
#login-view {
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 400px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.logo-icon {
    font-size: 2rem;
    color: var(--primary);
}

.login-hint {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

/* --- DASHBOARD LAYOUT & NAV --- */
.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-greeting {
    margin-right: 1.5rem;
    font-weight: 500;
    color: var(--text-muted);
}

.dashboard-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.sidebar {
    width: 250px;
    margin: 1.5rem;
    margin-right: 0;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
}

.nav-menu {
    list-style: none;
}

.nav-menu li {
    padding: 1rem 1.5rem;
    margin: 0.25rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-menu li:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-menu li.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.main-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.content-section.active-section {
    display: block;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.date-display {
    font-weight: 500;
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

/* --- DATA TABLES --- */
.table-card {
    padding: 0;
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.data-table th {
    background: rgba(0, 0, 0, 0.2);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary);
}

/* --- CALENDAR SYSTEM --- */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-controls select {
    width: auto;
    min-width: 120px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.calendar-dw {
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.5rem 0;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.calendar-day {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    min-height: 80px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

body.light-theme .calendar-day {
    background: rgba(255, 255, 255, 0.3);
}

.calendar-day.empty {
    background: transparent;
    border: none;
}

.calendar-day .day-num {
    font-weight: 500;
    font-size: 0.85rem;
    align-self: flex-end;
    color: var(--text-muted);
}

.calendar-day.today {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.calendar-day.today .day-num {
    color: var(--primary);
    font-weight: 700;
}

.cal-entry {
    font-size: 0.7rem;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.light-theme .cal-entry {
    background: rgba(0, 0, 0, 0.05);
}

.cal-entry.present {
    border-left: 2px solid var(--success);
}

.cal-entry.late {
    border-left: 2px solid var(--danger);
}

.cal-entry.leave {
    border-left: 2px solid var(--warning);
}

/* --- SPECIFIC COMPONENTS --- */
.action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.action-card {
    text-align: center;
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1rem;
}

.checkin-icon {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.checkout-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
}

.grid-2-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* --- MODALS --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

.modal {
    width: 100%;
    max-width: 450px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* --- TOASTS --- */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-left: 4px solid var(--primary);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease-out forwards;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}