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

:root {
    --primary: #008744;
    --primary-light: #00a651;
    --primary-dark: #006633;
    --primary-bg: #e6f7ed;
    --secondary: #0072ce;
    --accent: #f59e0b;
    --danger: #dc2626;
    --success: #10b981;

    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-text: #cbd5e1;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;

    --excel-header-bg: #1e293b;
    --excel-header-text: #ffffff;
    --excel-cell-bg: #ffffff;
    --excel-cell-border: #cbd5e1;
    --excel-cell-focus: #00a651;
    --excel-row-num-bg: #f1f5f9;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    font-size: 14px;
    line-height: 1.5;
}

/* Sidebar Navigation */
.app-sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 50;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

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

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.3);
}

.brand-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.menu-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 12px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
    transform: translateX(4px);
}

.nav-link.active {
    background: linear-gradient(90deg, var(--primary-light), var(--primary));
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.3);
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.user-role {
    font-size: 11px;
    color: #94a3b8;
}

.btn-logout {
    background: rgba(220, 38, 38, 0.15);
    color: #ef4444;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Main Content Area */
.app-main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    height: 70px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: var(--shadow-sm);
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--primary-bg);
    color: var(--primary-dark);
    border: 1px solid rgba(0, 166, 81, 0.2);
}

.badge-status.offline {
    background: #fef2f2;
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.2);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-light);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 166, 81, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(0, 166, 81, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 166, 81, 0); }
}

.content-wrapper {
    padding: 32px;
    flex: 1;
}

/* Cards & Containers */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.card-body {
    padding: 24px;
}

/* Stat Grid */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--primary-light);
}

.stat-info .stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-info .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: var(--primary-bg);
    color: var(--primary-dark);
}

/* Excel-Like Spreadsheet Table */
.excel-wrapper {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.excel-toolbar {
    padding: 16px 24px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.excel-search {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    width: 300px;
}

.excel-search input {
    border: none;
    outline: none;
    width: 100%;
    margin-left: 8px;
    font-size: 13px;
}

.excel-table-container {
    overflow-x: auto;
    max-height: 68vh;
}

.excel-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    font-family: 'JetBrains Mono', 'Outfit', monospace;
}

.excel-table th {
    background: var(--excel-header-bg);
    color: var(--excel-header-text);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    padding: 12px 14px;
    text-align: center;
    border: 1px solid #334155;
    position: sticky;
    top: 0;
    z-index: 10;
    user-select: none;
    letter-spacing: 0.5px;
}

.excel-table td {
    border: 1px solid var(--excel-cell-border);
    padding: 0;
    text-align: center;
    background: var(--excel-cell-bg);
    height: 42px;
    font-size: 13px;
    transition: background 0.15s;
}

.excel-table td.row-num {
    background: var(--excel-row-num-bg);
    color: var(--text-muted);
    font-weight: 600;
    width: 48px;
    border-right: 2px solid #94a3b8;
    user-select: none;
}

.excel-table td.cell-text {
    padding: 8px 12px;
    font-weight: 600;
    color: var(--text-main);
    text-align: left;
}

.excel-table td.cell-badge {
    padding: 8px 12px;
}

.badge-kelas {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: #e0e7ff;
    color: #4338ca;
}

.excel-input {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    text-align: center;
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    background: transparent;
    padding: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.excel-input:focus {
    background: #f0fdf4;
    box-shadow: inset 0 0 0 2px var(--excel-cell-focus);
    cursor: text;
}

.excel-input.updated-flash {
    animation: cellFlash 1s ease;
}

@keyframes cellFlash {
    0% { background: #bbf7d0; }
    100% { background: transparent; }
}

/* Excel Status Bar (Summary Totals) */
.excel-statusbar {
    background: #1e293b;
    color: white;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
}

.excel-statusbar .sum-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.excel-statusbar .sum-label {
    color: #94a3b8;
}

.excel-statusbar .sum-value {
    color: #4ade80;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 15px;
}

/* Auto-Save indicator badge */
.autosave-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    transition: opacity 0.3s ease;
}

.autosave-indicator.saving {
    background: #fffbeb;
    color: #d97706;
    border-color: #fde68a;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 166, 81, 0.35);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-danger {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

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

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

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: white;
    color: var(--text-main);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.15);
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Modal Add Row */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: var(--transition);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f8fafc;
}
