@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #fafaf8;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --white: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --accent: #7a3038;
    --accent-hover: #5a2028;
    --border-color: #e5e0d5;
    --border-light: #f1f1f1;
    --gold: #b8944b;
    --success: #2d6a4f;
    --danger: #9d0208;
    --warning: #ffb703;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
aside {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: all 0.3s ease;
    z-index: 100;
}

.brand {
    padding: 24px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    border-bottom: 4px solid var(--gold);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
}

nav {
    padding: 20px 0;
    flex: 1;
    overflow-y: auto;
}

nav ul {
    list-style: none;
}

nav li a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    gap: 12px;
}

nav li a:hover {
    background-color: rgba(122, 48, 56, 0.05);
    color: var(--accent);
}

nav li a.active {
    background-color: rgba(122, 48, 56, 0.08);
    color: var(--accent);
    border-right: 4px solid var(--gold);
}

nav li a i {
    width: 20px;
    height: 20px;
}

.user-profile {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: #fdfdfb;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--gold);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

/* Topbar / Page Header */
.topbar {
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.topbar h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

/* Main Content Area */
main {
    flex: 1;
    margin-left: 260px;
    padding: 40px;
    width: calc(100% - 260px);
}

.page-header {
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: #fff;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184, 148, 75, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

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

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

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

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

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

th {
    text-align: left;
    padding: 16px;
    background-color: #fdfdfb;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

tr:hover td {
    background-color: #fafaf8;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #d8f3dc; color: #1b4332; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* Dashboard Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Alert Boxes */
.alert {
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Dashboard Grid System */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.dashboard-section {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 30px;
    box-shadow: var(--shadow);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 20px;
}

.responsive-grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.responsive-grid-1-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .responsive-grid-2-1, .responsive-grid-1-2 {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .dashboard-section { padding: 16px; }
    .dashboard-header { flex-direction: column; align-items: flex-start; }
    .dashboard-header form { width: 100%; }
    .dashboard-header form .form-control { flex: 1; }
    
    .stats-grid, .grid-cards {
        grid-template-columns: 1fr !important;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    aside { width: 80px; }
    aside .brand div, aside .user-profile div, aside nav li a span { display: none; }
    aside nav li a { justify-content: center; padding: 15px; }
    aside nav li a i { margin: 0; width: 24px; height: 24px; }
    main { margin-left: 80px; width: calc(100% - 80px); }
}

@media (max-width: 768px) {
    body { flex-direction: column; }
    aside { 
        width: 100%; 
        height: 60px; 
        position: fixed; 
        bottom: 0; 
        top: auto; 
        left: 0; 
        border-right: none; 
        border-top: 1px solid var(--border-color);
        flex-direction: row;
        z-index: 1000;
    }
    .brand, .user-profile { display: none; }
    nav { padding: 0; }
    nav ul { display: flex; justify-content: space-around; height: 100%; }
    nav li { flex: 1; }
    nav li a { 
        flex-direction: column; 
        padding: 10px 0; 
        font-size: 0.65rem; 
        gap: 4px;
        height: 100%;
        justify-content: center;
    }
    nav li a.active { border-right: none; border-top: 3px solid var(--gold); background: transparent; }
    
    main { 
        margin-left: 0; 
        width: 100%; 
        padding: 15px 15px 80px 15px; 
    }
    .topbar { flex-direction: column; align-items: flex-start; gap: 15px; }
    .topbar h1 { font-size: 1.5rem; }
    
    .grid-cards { grid-template-columns: 1fr !important; }
    .card { padding: 15px; }
}

/* Absensi Specific Mobile Adjustments */
.mobile-scanner-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (max-width: 600px) {
    .scanner-container { order: -1; }
}
