/* 
 * Attendance System - Compact Modern UI
 * Simple, responsive, user-friendly design
 */

:root {
    /* Dark Theme */
    --bg-primary: #0d0d12;
    --bg-secondary: #13131a;
    --bg-card: #18181f;
    --bg-hover: #1e1e28;
    --bg-input: #1a1a22;

    /* Accent */
    --accent: #6366f1;
    --accent-hover: #7c7ff2;
    --accent-muted: rgba(99, 102, 241, 0.12);

    /* Status */
    --success: #22c55e;
    --success-muted: rgba(34, 197, 94, 0.12);
    --warning: #eab308;
    --warning-muted: rgba(234, 179, 8, 0.12);
    --danger: #ef4444;
    --danger-muted: rgba(239, 68, 68, 0.12);
    --info: #3b82f6;
    --info-muted: rgba(59, 130, 246, 0.12);

    /* Text */
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    /* Border */
    --border: #27272a;
    --border-light: #3f3f46;

    /* Radius */
    --radius: 8px;
    --radius-lg: 10px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.main-content {
    padding: 16px 0 24px;
    min-height: calc(100vh - 56px);
}

/* Grid */
.grid {
    display: grid;
    gap: 12px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

@media (max-width: 900px) {

    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Flex Utils */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-2 {
    gap: 8px;
}

.gap-4 {
    gap: 16px;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* Spacing */
.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 12px;
}

.mt-4 {
    margin-top: 16px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 12px;
}

.mb-4 {
    margin-bottom: 16px;
}

.py-4 {
    padding-top: 16px;
    padding-bottom: 16px;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.text-sm {
    font-size: 12px;
}

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    height: 56px;
}

.navbar-content {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.navbar-brand i {
    color: var(--accent);
    font-size: 20px;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-link.active {
    color: var(--accent);
    background: var(--accent-muted);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    text-align: right;
    display: none;
}

@media (min-width: 768px) {
    .user-info {
        display: block;
    }
}

.user-name {
    font-size: 13px;
    font-weight: 500;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-title i {
    color: var(--accent);
    font-size: 16px;
}

.page-title h1 {
    font-size: 18px;
    font-weight: 600;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-title i {
    color: var(--accent);
}

/* Stat Cards - Compact */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.stat-icon.success {
    background: var(--success-muted);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--warning-muted);
    color: var(--warning);
}

.stat-icon.danger {
    background: var(--danger-muted);
    color: var(--danger);
}

.stat-icon.info {
    background: var(--info-muted);
    color: var(--info);
}

.stat-icon.primary {
    background: var(--accent-muted);
    color: var(--accent);
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 20px;
    font-size: 14px;
}

/* Forms */
.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.15s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2371717a'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
}

.input-icon-wrapper {
    position: relative;
}

.input-icon-wrapper .form-input {
    padding-left: 32px;
}

.input-icon-wrapper i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
}

.badge-present,
.badge-approved {
    background: var(--success-muted);
    color: var(--success);
}

.badge-late,
.badge-pending {
    background: var(--warning-muted);
    color: var(--warning);
}

.badge-absent,
.badge-rejected {
    background: var(--danger-muted);
    color: var(--danger);
}

.badge-half_day,
.badge-info {
    background: var(--info-muted);
    color: var(--info);
}

.badge-on_leave {
    background: var(--accent-muted);
    color: var(--accent);
}

.badge-supervisor,
.badge-admin {
    background: var(--accent-muted);
    color: var(--accent);
}

.badge-employee {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 10px 12px;
    text-align: left;
}

.table th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.table tbody tr {
    border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

.table tbody tr:last-child {
    border-bottom: none;
}

/* Team List */
.team-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.15s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.team-item:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.team-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}

.team-info {
    flex: 1;
    min-width: 0;
}

.team-name {
    font-weight: 500;
    font-size: 13px;
}

.team-dept {
    font-size: 11px;
    color: var(--text-muted);
}

.team-time {
    text-align: right;
    font-family: monospace;
    font-size: 12px;
}

.time-in {
    color: var(--success);
}

.time-out {
    color: var(--text-muted);
}

.working {
    font-size: 11px;
    color: var(--success);
}

.working::before {
    content: '●';
    margin-right: 4px;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    50% {
        opacity: 0.3;
    }
}

/* Calendar */
.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-header {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 6px 0;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    background: var(--bg-hover);
    cursor: default;
}

.calendar-day.today {
    border: 2px solid var(--accent);
}

.calendar-day.present {
    background: var(--success-muted);
    color: var(--success);
}

.calendar-day.late {
    background: var(--warning-muted);
    color: var(--warning);
}

.calendar-day.absent {
    background: var(--danger-muted);
    color: var(--danger);
}

.calendar-day.on_leave {
    background: var(--accent-muted);
    color: var(--accent);
}

.calendar-day.other-month {
    background: transparent;
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.alert-success {
    background: var(--success-muted);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-error {
    background: var(--danger-muted);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-warning {
    background: var(--warning-muted);
    border: 1px solid var(--warning);
    color: var(--warning);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 280px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.hide {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.toast.success .toast-icon {
    background: var(--success-muted);
    color: var(--success);
}

.toast.error .toast-icon {
    background: var(--danger-muted);
    color: var(--danger);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 13px;
}

.toast-message {
    font-size: 12px;
    color: var(--text-muted);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    padding: 16px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow: auto;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 15px;
    font-weight: 600;
}

.modal-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.modal-close:hover {
    background: var(--border);
    color: var(--text-primary);
}

.modal-body {
    padding: 16px;
}

.modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Progress Bar */
.progress {
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.progress-bar.success {
    background: var(--success);
}

.progress-bar.warning {
    background: var(--warning);
}

.progress-bar.danger {
    background: var(--danger);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 32px 16px;
}

.empty-state i {
    font-size: 40px;
    color: var(--text-muted);
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 13px;
}

/* Responsive Nav */
@media (max-width: 768px) {
    .navbar-nav span {
        display: none;
    }

    .nav-link {
        padding: 8px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}