/**
 * Stylesheet Utama
 * Sistem Absensi QR Code
 * SMK EXPO Pameran
 */

/* ================================
   CSS Variables
================================ */
:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --dark: #1a1a2e;
    --light: #f8f9fa;
    --gray: #6c757d;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s ease;
}

/* ================================
   Reset & Base
================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* ================================
   Layout - Sidebar
================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--dark);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition);
    z-index: 1000;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-logo {
    width: 50px;
    height: 50px;
    background: var(--gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.sidebar-brand h2 {
    font-size: 16px;
    font-weight: 600;
}

.sidebar-brand span {
    font-size: 12px;
    opacity: 0.7;
}

.sidebar-menu {
    padding: 20px 0;
}

.menu-label {
    padding: 10px 25px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
}

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

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: 10px;
    transition: var(--transition);
    color: rgba(255, 255, 255, 0.7);
}

.menu-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.menu-link.active {
    background: var(--gradient);
    color: white;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.menu-link i {
    width: 20px;
    text-align: center;
}

.menu-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
}

/* ================================
   Layout - Main Content
================================ */
.main-content {
    flex: 1;
    margin-left: 280px;
    transition: var(--transition);
}

.topbar {
    background: white;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.toggle-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--dark);
}

.page-title h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--dark);
}

.page-title p {
    font-size: 13px;
    color: var(--gray);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-icon {
    position: relative;
    width: 40px;
    height: 40px;
    background: var(--light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.topbar-icon:hover {
    background: var(--primary);
    color: white;
}

.topbar-icon .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 15px;
    border-radius: 10px;
    transition: var(--transition);
}

.user-menu:hover {
    background: var(--light);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--gray);
}

/* ================================
   Content Area
================================ */
.content {
    padding: 30px;
}

/* ================================
   Cards
================================ */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 25px;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--primary);
}

.card-body {
    padding: 25px;
}

.card-footer {
    padding: 15px 25px;
    background: var(--light);
    border-top: 1px solid #eee;
}

/* ================================
   Stats Cards
================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
}

.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.info::before { background: var(--info); }

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card.primary .stat-icon { background: rgba(102, 126, 234, 0.1); color: var(--primary); }
.stat-card.success .stat-icon { background: rgba(40, 167, 69, 0.1); color: var(--success); }
.stat-card.warning .stat-icon { background: rgba(255, 193, 7, 0.1); color: var(--warning); }
.stat-card.danger .stat-icon { background: rgba(220, 53, 69, 0.1); color: var(--danger); }
.stat-card.info .stat-icon { background: rgba(23, 162, 184, 0.1); color: var(--info); }

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
}

.stat-info p {
    font-size: 14px;
    color: var(--gray);
}

/* ================================
   Tables
================================ */
.table-responsive {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.table th {
    background: var(--light);
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: #f8f9ff;
}

.table-avatar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
}

/* ================================
   Buttons
================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Poppins', sans-serif;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--gradient);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    box-shadow: 0 5px 20px rgba(40, 167, 69, 0.4);
}

.btn-warning {
    background: var(--warning);
    color: var(--dark);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    box-shadow: 0 5px 20px rgba(220, 53, 69, 0.4);
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-light {
    background: var(--light);
    color: var(--dark);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 16px;
}

.btn-icon {
    width: 35px;
    height: 35px;
    padding: 0;
    border-radius: 8px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* ================================
   Forms
================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    background: white;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.input-group {
    position: relative;
}

.input-group .form-control {
    padding-left: 45px;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

/* ================================
   Badges & Status
================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary { background: rgba(102, 126, 234, 0.1); color: var(--primary); }
.badge-success { background: rgba(40, 167, 69, 0.1); color: var(--success); }
.badge-warning { background: rgba(255, 193, 7, 0.2); color: #856404; }
.badge-danger { background: rgba(220, 53, 69, 0.1); color: var(--danger); }
.badge-info { background: rgba(23, 162, 184, 0.1); color: var(--info); }
.badge-gray { background: #e9ecef; color: var(--gray); }

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--gray); }
.status-dot.busy { background: var(--danger); }

/* ================================
   Alerts
================================ */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ================================
   Modal
================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 35px;
    height: 35px;
    border: none;
    background: var(--light);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ================================
   QR Code Styles
================================ */
.qr-container {
    text-align: center;
    padding: 30px;
}

.qr-code {
    display: inline-block;
    padding: 20px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.qr-code img {
    width: 200px;
    height: 200px;
}

.qr-info {
    margin-top: 15px;
}

.qr-info h4 {
    font-size: 18px;
    color: var(--dark);
}

.qr-info p {
    color: var(--gray);
    font-size: 14px;
}

/* ================================
   Scanner Styles
================================ */
.scanner-container {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.scanner-video {
    width: 100%;
    border-radius: var(--radius-lg);
    background: #000;
}

.scanner-result {
    margin-top: 20px;
    padding: 20px;
    background: var(--light);
    border-radius: var(--radius);
}

/* ================================
   Charts Area
================================ */
.chart-container {
    position: relative;
    height: 300px;
}

/* ================================
   Empty State
================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 60px;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--dark);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--gray);
    margin-bottom: 20px;
}

/* ================================
   Pagination
================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 14px;
    transition: var(--transition);
}

.pagination a {
    background: white;
    color: var(--dark);
    border: 1px solid #eee;
}

.pagination a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    color: white;
}

/* ================================
   Search Box
================================ */
.search-box {
    position: relative;
    max-width: 300px;
}

.search-box input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--primary);
    outline: none;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

/* ================================
   Toolbar
================================ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ================================
   Responsive
================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .toggle-sidebar {
        display: block;
    }
}

@media (max-width: 768px) {
    .content {
        padding: 20px 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left,
    .toolbar-right {
        justify-content: center;
    }

    .topbar {
        padding: 15px;
    }

    .user-info {
        display: none;
    }

    .card-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .btn-group {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal {
        width: 95%;
        margin: 10px;
    }

    .pagination a,
    .pagination span {
        width: 35px;
        height: 35px;
        font-size: 12px;
    }
}

/* ================================
   Animations
================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

.slide-up {
    animation: slideUp 0.5s ease;
}

/* ================================
   Dark Mode Toggle (Optional)
================================ */
.theme-toggle {
    position: relative;
    width: 50px;
    height: 26px;
}

.theme-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: var(--transition);
    border-radius: 26px;
}

.theme-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}

.theme-toggle input:checked + .theme-slider {
    background: var(--gradient);
}

.theme-toggle input:checked + .theme-slider:before {
    transform: translateX(24px);
}

/* ================================
   Print Styles
================================ */
@media print {
    .sidebar,
    .topbar,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .content {
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ================================
   Utility Classes
================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--gray); }

.bg-primary { background: var(--primary); }
.bg-success { background: var(--success); }
.bg-warning { background: var(--warning); }
.bg-danger { background: var(--danger); }
.bg-light { background: var(--light); }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.p-1 { padding: 10px; }
.p-2 { padding: 20px; }
.p-3 { padding: 30px; }

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.shadow { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: var(--shadow-lg); }
