/* ===== DEVA TEAM Design System ===== */

/* --- CSS Variables --- */
:root {
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #4f46e5;
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #f1f5f9;
    --sidebar-width: 240px;
    --navbar-bg: #0f172a;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: #eef2ff;
    --bg-body: #f1f5f9;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --radius: 10px;
    --radius-sm: 6px;
    --transition: all 0.2s ease;
}

/* --- Base --- */
body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --- Navbar --- */
.navbar {
    background: var(--navbar-bg) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    padding: 0.6rem 1rem;
    z-index: 1040;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
}

.navbar-brand i {
    color: var(--accent);
    margin-right: 4px;
}

.navbar .btn-outline-light {
    border-radius: 20px;
    font-size: 0.8rem;
    padding: 4px 14px;
    border-color: #475569;
    color: #94a3b8;
    transition: var(--transition);
}

.navbar .btn-outline-light:hover {
    background: #334155;
    border-color: #64748b;
    color: #f1f5f9;
}

/* --- Sidebar --- */
.sidebar {
    min-height: calc(100vh - 56px);
    background: var(--sidebar-bg) !important;
    border-right: none;
    padding-top: 1rem !important;
    width: var(--sidebar-width);
    position: fixed;
    top: 56px;
    left: 0;
    overflow-y: auto;
    z-index: 1030;
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    margin: 2px 10px;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-hover);
}

.sidebar .nav-link.active,
.sidebar .nav-link:active {
    background: var(--sidebar-active);
    color: #fff;
}

.sidebar .nav-link i {
    margin-right: 10px;
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

/* --- Main Content --- */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 1.5rem 2rem;
}

/* --- Page Header --- */
h4 {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.35rem;
}

/* --- Cards --- */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    background: #fff;
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
}

.card-body {
    padding: 1.25rem;
}

.card-title {
    font-weight: 700;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}

/* --- Stat Cards --- */
.stat-card {
    border-left: 4px solid;
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 100%;
    opacity: 0.05;
    border-radius: 50%;
    transform: translate(20px, -20px);
}

.stat-card .card-title {
    font-size: 1.75rem;
    font-weight: 800;
}

.stat-card.primary { border-color: var(--accent); }
.stat-card.primary::after { background: var(--accent); }
.stat-card.success { border-color: #10b981; }
.stat-card.success::after { background: #10b981; }
.stat-card.warning { border-color: #f59e0b; }
.stat-card.warning::after { background: #f59e0b; }
.stat-card.danger { border-color: #ef4444; }
.stat-card.danger::after { background: #ef4444; }
.stat-card.info { border-color: #06b6d4; }
.stat-card.info::after { background: #06b6d4; }

/* --- Tables --- */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875rem;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

.table-responsive {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #fff;
}

/* --- Buttons --- */
.btn {
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    padding: 0.45rem 1rem;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-outline-primary {
    color: var(--accent);
    border-color: var(--accent);
}

.btn-outline-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

/* --- Forms --- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.85rem;
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

/* --- Badges --- */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.7em;
    border-radius: 20px;
}

.badge.bg-success {
    background: #dcfce7 !important;
    color: #16a34a;
}

.badge.bg-secondary {
    background: #f1f5f9 !important;
    color: #64748b;
}

.badge.bg-danger {
    background: #fee2e2 !important;
    color: #dc2626;
}

.badge.bg-warning {
    background: #fef3c7 !important;
    color: #d97706;
}

.badge.bg-primary {
    background: var(--accent-light) !important;
    color: var(--accent);
}

.badge.bg-info {
    background: #e0f2fe !important;
    color: #0284c7;
}

/* --- Alerts --- */
.alert {
    border-radius: var(--radius);
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-success {
    background: #dcfce7;
    color: #16a34a;
}

.alert-danger {
    background: #fee2e2;
    color: #dc2626;
}

/* --- Pagination --- */
.pagination .page-link {
    border-radius: var(--radius-sm);
    margin: 0 2px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    transition: var(--transition);
}

.pagination .page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.pagination .page-link:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

/* --- Clock (Staff Attendance) --- */
.clock-display {
    font-size: 3.5rem;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    color: var(--text-primary);
    letter-spacing: 2px;
}

.clock-btn {
    font-size: 1.3rem;
    padding: 16px 48px;
    border-radius: 50px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.clock-btn.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.clock-btn.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.clock-btn.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.clock-btn.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* --- Login Page --- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(79,70,229,0.15) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(79,70,229,0.1) 0%, transparent 70%);
    bottom: -50px;
    left: -50px;
    border-radius: 50%;
}

.login-container {
    max-width: 400px;
    width: 100%;
    margin: 0 20px;
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.login-container .brand-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: #fff;
    font-size: 1.5rem;
}

.login-container h2 {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.login-container .form-control {
    padding: 0.65rem 1rem;
    background: #f8fafc;
    border: 1.5px solid var(--border-color);
}

.login-container .form-control:focus {
    background: #fff;
}

.login-container .btn-primary {
    padding: 0.65rem;
    font-weight: 600;
    font-size: 0.95rem;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border: none;
    border-radius: 8px;
}

.login-container .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

/* --- Error Pages --- */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
}

.error-page .error-code {
    font-size: 8rem;
    font-weight: 900;
    color: var(--accent);
    opacity: 0.15;
    line-height: 1;
}

.error-page h3 {
    font-weight: 700;
    margin-top: -1rem;
}

/* --- Wiki / Markdown --- */
#markdownContent {
    line-height: 1.8;
    font-size: 0.95rem;
}

#markdownContent h1,
#markdownContent h2,
#markdownContent h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

#markdownContent code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #e11d48;
}

#markdownContent pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

#markdownContent pre code {
    background: none;
    color: inherit;
    padding: 0;
}

#markdownContent blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 1rem;
    margin-left: 0;
    color: var(--text-secondary);
}

#markdownContent table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

#markdownContent table th,
#markdownContent table td {
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
}

#markdownContent table th {
    background: #f8fafc;
    font-weight: 600;
}

/* --- Utilities --- */
.text-muted {
    color: var(--text-secondary) !important;
}

/* Smooth scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 2px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        position: static;
        width: 100%;
        min-height: auto;
    }
    .main-content {
        margin-left: 0;
    }
}
