/* ============================================================
   Sistem Arsip Digital - Light Theme
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --accent: #7c3aed;
    --surface: #f0f2f5;
    --surface-2: #ffffff;
    --surface-3: #e5e7eb;
    --border: rgba(0, 0, 0, 0.08);
    --text: #1e293b;
    --text-muted: #6b7280;
    --gradient-start: #7c3aed;
    --gradient-end: #2563eb;
}

/* ---- Global ---- */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(37, 99, 235, 0.25) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: rgba(37, 99, 235, 0.25);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(37, 99, 235, 0.4);
}

html {
    font-size: 14px;
}

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

@media (max-width: 768px) {
    body {
        zoom: 1.0;
    }
}

/* ---- Animated Background (Login) ---- */
.bg-animated {
    background: linear-gradient(-45deg, #e0e7ff, #f0f2f5, #ede9fe, #dbeafe);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* ---- Card ---- */
.glass-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1rem !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    border-color: rgba(37, 99, 235, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.glass-card-light {
    background: var(--surface-2);
    border: 1px solid var(--border);
}

/* ---- Glow Effects (light mode - subtle shadows) ---- */
.glow-primary {
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

.glow-accent {
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.12);
}

/* ---- Animations ---- */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(37, 99, 235, 0.15);
    }

    50% {
        box-shadow: 0 0 30px rgba(37, 99, 235, 0.25);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

.animate-slide-out {
    animation: slideOut 0.3s ease-in forwards;
}

.animate-scale-in {
    animation: scaleIn 0.25s ease-out;
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.4s ease-out;
}

.animate-pulse-glow {
    animation: pulse-glow 3s ease-in-out infinite;
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.stagger-1 {
    animation-delay: 0.05s;
}

.stagger-2 {
    animation-delay: 0.1s;
}

.stagger-3 {
    animation-delay: 0.15s;
}

.stagger-4 {
    animation-delay: 0.2s;
}

/* ---- Sidebar ---- */
.no-sidebar #sidebar {
    display: none !important;
}

.no-sidebar #main-content {
    margin-left: 0 !important;
    width: 100% !important;
}

#sidebar {
    height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.sidebar {
    transition: width 0.3s ease, transform 0.3s ease;
    background: var(--surface-2);
    border-right: 1px solid var(--border);
    height: 100vh !important;
    overflow-y: auto !important;
}

.sidebar-link {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    color: var(--text-muted);
}

.sidebar-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform 0.2s ease;
    border-radius: 0 4px 4px 0;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary);
}

.sidebar-link:hover::before,
.sidebar-link.active::before {
    transform: scaleY(1);
}

/* ---- Sidebar Dropdown ---- */
.sidebar-dropdown-btn {
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.sidebar-dropdown-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text);
}

.sidebar-dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-dropdown-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-dropdown.expanded .sidebar-dropdown-icon,
#sidebar-parent.expanded .sidebar-dropdown-icon {
    transform: rotate(180deg);
}

.sidebar-dropdown-content .sidebar-link {
    padding-left: 3rem;
    font-size: 0.8125rem;
}

/* ---- Data Tables ---- */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
    font-size: 0.85rem;
}

.data-table th,
.data-table td {
    padding: 0.875rem 1rem;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.data-table th:nth-child(1),
.data-table td:nth-child(1) {
    width: 48px;
    text-align: center;
    padding-left: 1.5rem;
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
    min-width: 200px;
    max-width: 400px;
}

.data-table th:nth-child(3),
.data-table td:nth-child(3) {
    width: 120px;
}

.data-table th:nth-child(4),
.data-table td:nth-child(4) {
    width: 80px;
}

.data-table th:nth-child(5),
.data-table td:nth-child(5),
.data-table th:nth-child(6),
.data-table td:nth-child(6) {
    width: auto;
    min-width: 100px;
}

.data-table th:nth-child(7),
.data-table td:nth-child(7) {
    width: 130px;
}

.data-table th:nth-child(8),
.data-table td:nth-child(8) {
    width: 100px;
}

.data-table th:nth-child(9),
.data-table td:nth-child(9) {
    width: 64px;
    text-align: right;
    padding-right: 1.5rem;
}

.data-table thead th {
    background: #f8fafc;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.data-table tbody tr {
    transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.04);
}

.data-table tbody td {
    padding: 12px 16px;
    font-size: 0.875rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

/* ---- Drag & Drop Zone ---- */
.drop-zone {
    border: 2px dashed rgba(37, 99, 235, 0.3);
    transition: all 0.3s ease;
}

.drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.06);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.08) inset;
}

/* ---- Progress Bar ---- */
.progress-bar {
    height: 6px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 999px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
    animation: progressShimmer 1.5s ease infinite;
}

@keyframes progressShimmer {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(100%);
    }
}

/* ---- Custom Inputs ---- */
.input-field {
    background: var(--surface-2);
    border: 1px solid #d1d5db;
    color: var(--text);
    transition: all 0.2s ease;
    border-radius: 0.5rem;
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    outline: none;
}

.input-field::placeholder {
    color: #9ca3af;
}

input[type="date"].input-field {
    color-scheme: light;
}

input[type="date"].input-field::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s ease;
}

input[type="date"].input-field::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

select.input-field {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2em;
    padding-right: 2.5rem;
    cursor: pointer;
}

select.input-field option {
    background-color: var(--surface-2);
    color: var(--text);
    padding: 12px 16px;
    font-size: 14px;
}

/* ---- Buttons ---- */
.btn-primary {
    background: var(--primary);
    color: white;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-ghost {
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.btn-ghost:hover {
    background: #f3f4f6;
    color: var(--text);
    border-color: #d1d5db;
}

/* Override span in table cells - for status text */
td > span {
    font-size: 15px !important;
    font-weight: 900 !important;
    display: inline-block !important;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 40;
    }

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

    .mobile-overlay {
        display: none;
    }

    .mobile-overlay.active {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 35;
    }

    #main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* ---- Preview Modal ---- */
.preview-modal {
    animation: fadeIn 0.2s ease-out;
}

.preview-modal-content {
    animation: scaleIn 0.25s ease-out;
}

/* ---- Stats Card ---- */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover::before {
    opacity: 1;
}

/* ---- Empty State ---- */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
    color: #9ca3af;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    opacity: 0.3;
}

/* ---- Custom Checkbox ---- */
.custom-checkbox {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--surface-2);
}

.custom-checkbox:hover {
    border-color: var(--primary-light);
    background: rgba(37, 99, 235, 0.04);
}

.custom-checkbox:checked {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.custom-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ---- Bulk Action Bar ---- */
.bulk-floating-bar {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    pointer-events: none;
}

.bulk-floating-bar.active {
    bottom: 32px;
    pointer-events: auto;
}

.bulk-inner {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 12px 24px;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 20px;
}

/* ============================================================ 
   ANTI-SPOILER / FLASH OF UNAUTHORIZED CONTENT (FOUC)
   ============================================================ */
html.auth-loading body {
    opacity: 0;
}

body {
    transition: opacity 0.25s ease-in-out;
}

.role-admin-zona [data-role="super_admin"],
.role-admin-zona [data-permission],
.role-admin-zona #sidebar {
    display: none !important;
}

.role-admin-zona #main-content {
    margin-left: 0 !important;
    width: 100% !important;
}

/* ---- Select & Dropdown Fixes ---- */
select {
    background-color: var(--surface-2) !important;
    color: var(--text) !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0.5rem;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(107,114,128,0.8)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

select:focus {
    border-color: var(--primary) !important;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select option {
    background-color: var(--surface-2) !important;
    color: var(--text) !important;
    padding: 10px;
}

/* ---- Premium Loader ---- */
.premium-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.loader-rings {
    position: relative;
    width: 64px;
    height: 64px;
}

.loader-ring {
    position: absolute;
    inset: 0;
    border: 4px solid transparent;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loader-ring:nth-child(2) {
    inset: 8px;
    border-top-color: var(--accent);
    animation-duration: 1s;
    animation-direction: reverse;
}

.loader-ring:nth-child(3) {
    inset: 16px;
    border-top-color: #f59e0b;
    animation-duration: 0.8s;
}

.loader-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    animation: pulse 2s ease-in-out infinite;
}

/* ---- Modern Broadcast Bar ---- */
.modern-broadcast-bar {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    height: 42px;
    overflow: hidden;
    position: relative;
    z-index: 25;
}

.broadcast-badge {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    background: linear-gradient(to right, var(--accent), var(--primary));
    color: white;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    position: relative;
    z-index: 2;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
}

.broadcast-badge::after {
    content: '';
    position: absolute;
    right: -9.8px;
    top: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 42px 10px 0 0;
    border-color: var(--primary) transparent transparent transparent;
}

.broadcast-content-wrapper {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.broadcast-ticker {
    white-space: nowrap;
    display: inline-block;
    padding-left: 100%;
    animation: ticker 30s linear infinite;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.broadcast-ticker:hover {
    animation-play-state: paused;
    cursor: default;
}

@keyframes ticker {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(0.98);
    }

    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

/* ---- Mini Loader ---- */
.loader-mini {
    position: relative;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.loader-mini .loader-ring {
    border-width: 2px;
}

/* ---- Modal Enhancements ---- */
.modal-header-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

/* ---- Welcome Banner ---- */
.welcome-banner {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: 1rem;
    padding: 1.5rem 2rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

/* ---- Badge (Light) ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 9999px;
    border: 1px solid;
}

/* ---- Notification & Header Enhancements ---- */
.notification-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background-color: #ef4444;
    border-radius: 999px;
    border: 2px solid #ffffff;
    display: none;
    z-index: 10;
}

.notification-dot.active {
    display: block;
    animation: ping-small 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping-small {

    75%,
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

.dropdown-container {
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Modal Enhancements */
.profile-modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.animate-pulse-slow {
    animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .7;
    }
}

/* ---- Main Content Layout ---- */
.main-content {
    margin-left: 280px;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    background: var(--surface);
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
    }
}