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

:root {
    --bg-main: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-card: #ffffff;
    --bg-input: #f8fafc;
    --border-color: #e2e8f0;
    --border-focus: #0ea5e9;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-glow: rgba(2, 132, 199, 0.12);
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --font-sans: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Layout Utilities */
/* ===== LAYOUT UTAMA ===== */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 200;
    padding: 2rem 1.5rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding: 2.5rem;
    margin-left: var(--sidebar-width);
    min-width: 0;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== HAMBURGER TOGGLE ===== */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 300;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-sm);
    background-color: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(2,132,199,0.35);
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background-color: var(--primary-hover);
}

/* ===== OVERLAY ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

/* ===== MOBILE BREAKPOINT ===== */
@media (max-width: 1024px) {
    /* Tampilkan hamburger */
    .sidebar-toggle {
        display: flex;
    }

    /* Sidebar bersembunyi ke kiri secara default di mobile */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    /* Saat sidebar terbuka di mobile */
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0,0,0,0.15);
    }

    /* Main content memenuhi seluruh lebar di mobile */
    .main-content {
        margin-left: 0;
        padding: 1.25rem;
        padding-top: 4.5rem; /* ruang untuk tombol hamburger */
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
}

/* Pastikan tidak ada overflow horizontal */
body {
    overflow-x: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2.5rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.sidebar-item a:hover, .sidebar-item.active a {
    background-color: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
}

.sidebar-item.active a {
    background: linear-gradient(90deg, var(--primary-glow), transparent);
    border-left: 4px solid var(--primary);
    padding-left: calc(1rem - 4px);
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

.user-info {
    min-width: 0;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Card Styling */
.card {
    background-color: var(--bg-surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.08);
    border-color: var(--border-color);
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Grid helper */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Page Header Component */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    width: 100%;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

@media (max-width: 1024px) {
    .grid-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .grid-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .grid-cols-4, .grid-cols-3, .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    .page-header .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Button Component */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

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

.btn-secondary {
    background-color: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

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

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.table th {
    background-color: rgba(0, 0, 0, 0.02);
    color: var(--text-muted);
    font-weight: 600;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.015);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background-color: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background-color: var(--warning-bg);
    color: var(--warning);
}

.badge-danger {
    background-color: var(--danger-bg);
    color: var(--danger);
}

/* Stats / Dashboard Units */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background-color: var(--bg-surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}


.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.primary { background-color: var(--primary); }
.stat-icon.success { background-color: var(--success); }
.stat-icon.warning { background-color: var(--warning); }
.stat-icon.danger { background-color: var(--danger); }

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

.stat-lbl {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background-color: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-danger {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Public Event Page Styles */
.public-container {
    max-width: 800px;
    margin: 4rem auto;
    padding: 0 1.5rem;
}

.public-header {
    text-align: center;
    margin-bottom: 3rem;
}

.public-title {
    font-size: 2.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.75rem;
}

.public-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.public-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
}

@media (max-width: 640px) {
    .public-container {
        margin: 2rem auto;
    }
    .public-card {
        padding: 1.5rem;
    }
}

/* Login Panel Page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    background: radial-gradient(circle at top right, rgba(96, 165, 250, 0.08), transparent 40%),
                radial-gradient(circle at bottom left, rgba(192, 132, 252, 0.08), transparent 40%),
                var(--bg-main);
}

.login-card {
    width: 100%;
    max-width: 440px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.7);
}

/* Drag & Drop Form Builder UI */
.builder-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
}

.field-templates {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    height: fit-content;
}

.field-template-item {
    padding: 0.75rem 1rem;
    background-color: var(--bg-surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    cursor: grab;
    font-weight: 500;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
}

.field-template-item:hover {
    border-color: var(--primary);
    background-color: rgba(37, 99, 235, 0.05);
}

.form-canvas {
    background-color: var(--bg-surface);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-canvas.dragover {
    border-color: var(--primary);
    background-color: var(--primary-glow);
}

.canvas-field-item {
    background-color: var(--bg-surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.canvas-field-item .field-remove {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.1rem;
}

.canvas-field-row {
    display: grid;
    grid-template-columns: 2fr 2fr 1.5fr 1fr;
    gap: 1rem;
    align-items: center;
}

@media (max-width: 900px) {
    .builder-layout {
        grid-template-columns: 1fr;
    }
    .canvas-field-row {
        grid-template-columns: 1fr;
    }
}
