/* 
 * Design System for Aplikasi Konfirmasi Kegiatan
 * Premium, Modern, Dynamic & Responsive
 */

:root {
    --primary: #ea580c; /* Orange / Terracotta */
    --primary-dark: #c2410c; /* Deep Orange */
    --secondary: #064e3b; /* Deep Forest Green (Acehnese Green) */
    --secondary-dark: #065f46;
    --accent: #be123c; /* Royal Red */
    
    /* ACENHESE WARM MODE COLORS */
    --bg-dark: #fdf8f5; /* Warm ivory/cream background */
    --bg-card: rgba(255, 255, 255, 0.85); /* Translucent warm white cards */
    --text-white: #431407; /* Deep brown/charcoal text for elegant contrast */
    --text-muted: #78350f; /* Muted warm brown */
    --border-color: rgba(234, 88, 12, 0.2); /* Soft orange border hint */
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(234, 88, 12, 0.15);
    
    --success: #059669;
    --danger: #dc2626;
    --warning: #ea580c;
    --info: #0284c7;
    
    /* Small font size as requested */
    --font-base: 13px;
    --font-sm: 11px;
    --font-lg: 15px;
    --font-xl: 18px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-size: var(--font-base);
    line-height: 1.5;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(234, 88, 12, 0.12) 0%, transparent 60%),
        radial-gradient(circle at 85% 15%, rgba(6, 78, 59, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 50% 85%, rgba(190, 18, 60, 0.08) 0%, transparent 60%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* Glassmorphism Utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 1rem;
    color: var(--text-white);
}

.text-gradient {
    color: var(--text-white);
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    -webkit-text-fill-color: initial;
    font-weight: 800;
}

/* CKEditor 5 Fix for Dark Mode - Aggressive Overrides */
.ck.ck-content, 
.ck.ck-editor__editable,
.ck.ck-editor__editable_inline,
.ck.ck-content p,
.ck.ck-content li,
.ck.ck-content span,
.ck.ck-content h1,
.ck.ck-content h2,
.ck.ck-content h3 {
    color: #1e293b !important;
    background: #ffffff !important;
}

.ck.ck-editor__main>.ck-editor__editable:not(.ck-focused) {
    border-color: var(--glass-border) !important;
}

.ck-content {
    min-height: 200px;
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: var(--font-base);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

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

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

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: var(--font-sm);
}

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

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

/* Mobile Toggle Button */
.btn-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-white);
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.btn-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-toggle:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-white);
    font-size: var(--font-base);
    transition: all 0.2s;
}

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

/* Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
    min-width: 0; /* Prevents grid blowout from wide child tables */
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

/* Admin Sidebar */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: #1c1917; /* Dark warm charcoal */
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 2rem;
    min-width: 0; /* Critical for inner table overflow in flexbox */
}

.grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
}

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

.topbar-mobile {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(28, 25, 23, 0.98);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 998;
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 20px 0 30px rgba(0,0,0,0.5);
        z-index: 1000;
        width: 280px;
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 1.25rem;
        padding-top: 80px;
    }
    .topbar-mobile {
        display: flex;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.6);
        backdrop-filter: blur(4px);
        z-index: 999;
    }
    .sidebar-overlay.active {
        display: block;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.75rem !important;
    }
    .stat-card {
        padding: 1rem !important;
    }
    .stat-value {
        font-size: 1.5rem !important;
    }
    .grid-2-1 {
        grid-template-columns: 1fr !important;
    }
    .grid-1-1 {
        grid-template-columns: 1fr !important;
    }
}

.sidebar-brand {
    font-size: var(--font-xl);
    font-weight: 800;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.sidebar-nav-link:hover, .sidebar-nav-link.active {
    background: rgba(234, 88, 12, 0.15); /* var(--primary) with opacity */
    color: var(--primary);
}

.sidebar .text-gradient, .topbar-mobile .text-gradient {
    color: #ffffff;
    background: linear-gradient(135deg, #ffffff, var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.topbar-mobile .btn-toggle {
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Table Style */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    margin-bottom: 1rem;
    border-radius: 8px;
}

.table-responsive table {
    min-width: 650px; /* Balanced width to prevent squashing without overstretching */
    width: 100%;
    margin: 0;
}

/* Custom Scrollbar for Table */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}
.table-responsive::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

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

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--font-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    border-radius: 16px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    margin: 0.5rem 0;
}

.stat-label {
    color: var(--text-muted);
    font-size: var(--font-sm);
    font-weight: 500;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Badges */
.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

/* Form Builder styles */
.builder-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--glass-border);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    position: relative;
    cursor: grab;
}

.builder-item:active { cursor: grabbing; }

.builder-item .actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.3rem;
}

.builder-item.dragging {
    opacity: 0.5;
    background: var(--primary);
    border: 1px solid var(--text-white);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
