:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #7c3aed;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #1e293b;
    --sidebar-bg: #0f172a;
    --navbar-bg: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --card-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --card-hover-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --transition: all 0.3s ease;
}

/* Navbar */
.rta-navbar {
    background: var(--navbar-bg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    padding: 0.3rem 1rem;
    min-height: 48px;
}
.rta-navbar .brand-text {
    font-size: 1.1rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.rta-navbar .brand-sub {
    color: #94a3b8;
    font-size: 0.65rem;
    margin-left: 0.3rem;
}

/* Sidebar */
.rta-sidebar {
    position: fixed;
    left: 0;
    top: 60px;
    width: 250px;
    height: calc(100vh - 60px);
    background: var(--sidebar-bg);
    z-index: 100;
    overflow-y: auto;
    transition: var(--transition);
}
.rta-sidebar .sidebar-user {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.avatar-circle {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}
.avatar-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}
.sidebar-nav .nav-link {
    color: #94a3b8;
    padding: 0.75rem 1.25rem;
    border-left: 3px solid transparent;
    transition: var(--transition);
}
.sidebar-nav .nav-link:hover {
    color: white;
    background: rgba(255,255,255,0.05);
    border-left-color: var(--primary);
}
.sidebar-nav .nav-link.active {
    color: white;
    background: rgba(37,99,235,0.1);
    border-left-color: var(--primary);
}
.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
    margin-right: 0.75rem;
}

/* Main Content */
.main-content {
    margin-left: 250px;
    margin-top: 60px;
    min-height: calc(100vh - 60px);
    background: #f1f5f9;
}
body.has-sidebar {
    background: #f1f5f9;
}

/* Cards */
.card {
    border: none;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    border-radius: 12px;
}
.card:hover {
    box-shadow: var(--card-hover-shadow);
}
.card-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
    border-radius: 12px 12px 0 0 !important;
}

/* Stat Cards */
.stat-card {
    padding: 1.5rem;
    border-radius: 12px;
    color: white;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}
.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.5;
    position: absolute;
    top: 1rem;
    right: 1rem;
}
.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
}
.stat-card .stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}
.stat-primary { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.stat-secondary { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.stat-success { background: linear-gradient(135deg, #10b981, #059669); }
.stat-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-danger { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-info { background: linear-gradient(135deg, #06b6d4, #0891b2); }

/* Status Badges */
.badge-topic { font-size: 0.8rem; padding: 0.35rem 0.65rem; border-radius: 20px; }
.badge-open { background: #dbeafe; color: #1d4ed8; }
.badge-in-progress { background: #fef3c7; color: #d97706; }
.badge-completed { background: #d1fae5; color: #059669; }
.badge-pending { background: #f3e8ff; color: #7c3aed; }
.badge-rejected { background: #fee2e2; color: #dc2626; }

/* Progress Bar */
.progress {
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
}
.progress-bar {
    border-radius: 4px;
}

/* Tables */
.table th {
    border-top: none;
    color: #64748b;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.table td {
    vertical-align: middle;
    padding: 0.75rem;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}
.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 0.25rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
}

/* Kanban */
.kanban-column {
    min-height: 200px;
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
}
.kanban-card {
    cursor: pointer;
    margin-bottom: 0.75rem;
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}
.auth-card {
    width: 100%;
    max-width: 450px;
    border-radius: 16px;
}
.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-logo .brand-text {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Footer */
.rta-footer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}
.rta-footer a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s ease;
}
.rta-footer a:hover {
    color: var(--primary);
}
.rta-footer .footer-brand {
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Notifications */
.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 0.6rem;
}
.notification-dropdown {
    width: 350px;
    max-height: 400px;
    overflow-y: auto;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Forms */
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(37,99,235,0.15);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in {
    animation: fadeIn 0.5s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}
.slide-in {
    animation: slideIn 0.3s ease;
}

/* ── Global Link Styling ──────────────────────────────────── */
a, a:link, a:visited {
    text-decoration: none !important;
    color: var(--primary);
    transition: color 0.2s ease;
}
a:hover, a:focus {
    color: var(--primary-dark);
    text-decoration: none !important;
}
a.text-danger:hover {
    color: #dc2626 !important;
}
a.text-muted:hover {
    color: var(--primary) !important;
}

/* ── Navbar Links ────────────────────────────────────────── */
.rta-navbar .nav-link {
    color: rgba(255,255,255,0.8) !important;
    text-decoration: none !important;
    padding: 0.35rem 0.55rem !important;
    border-radius: 5px;
    transition: all 0.2s ease;
    font-size: 0.82rem;
    font-weight: 500;
}
.rta-navbar .nav-link i {
    font-size: 0.75rem;
    margin-right: 0.25rem;
}
.rta-navbar .nav-link:hover {
    color: white !important;
    background: rgba(255,255,255,0.1);
}
.rta-navbar .navbar-brand {
    text-decoration: none !important;
}
.rta-navbar .dropdown-item {
    text-decoration: none !important;
    transition: background 0.2s ease;
}
.rta-navbar .dropdown-item:hover {
    background: #f1f5f9;
}

/* ── Sidebar Links ───────────────────────────────────────── */
.sidebar-nav .nav-link {
    text-decoration: none !important;
}

/* ── Table Links ─────────────────────────────────────────── */
.table a:not(.btn) {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none !important;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}
.table a:not(.btn):hover {
    color: var(--primary-dark);
    border-bottom-color: var(--primary);
}
.table .btn {
    text-decoration: none !important;
}

/* ── Card Links ──────────────────────────────────────────── */
.card a:not(.btn):not(.nav-link):not(.dropdown-item) {
    text-decoration: none !important;
}

/* ── Project Cards / Topic Cards ─────────────────────────── */
.project-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}
.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow);
    border-color: var(--primary);
}
.project-card .card-title a {
    color: var(--dark);
    font-weight: 600;
}
.project-card .card-title a:hover {
    color: var(--primary);
}

/* ── Table Enhancements ──────────────────────────────────── */
.table-hover tbody tr {
    transition: background 0.2s ease;
}
.table-hover tbody tr:hover {
    background: #f0f4ff !important;
}
.table td .badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
}
.table td .progress {
    margin-bottom: 0;
    min-width: 80px;
}

/* ── Search & Filter Bar ─────────────────────────────────── */
.filter-bar {
    background: white;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
}
.filter-bar .form-control,
.filter-bar .form-select {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.875rem;
}
.filter-bar .form-control:focus,
.filter-bar .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(37,99,235,0.1);
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
    gap: 0.25rem;
}
.page-link {
    border: none;
    border-radius: 8px !important;
    color: #64748b;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    text-decoration: none !important;
}
.page-link:hover {
    background: #f1f5f9;
    color: var(--primary);
}
.page-item.active .page-link {
    background: var(--primary);
    color: white;
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}
.empty-state i {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
}
.empty-state h5 {
    color: #64748b;
    margin-bottom: 0.5rem;
}
.empty-state p {
    color: #94a3b8;
    font-size: 0.875rem;
}

/* ── Section Headers ─────────────────────────────────────── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.section-header h4 {
    margin-bottom: 0;
    font-weight: 600;
    color: var(--dark);
}
.section-header h4 i {
    margin-right: 0.5rem;
}

/* ── Stat Row / Quick Stats ──────────────────────────────── */
.quick-stats .stat-card {
    cursor: default;
}
.quick-stats .stat-card:hover {
    transform: translateY(-2px);
}

/* ── Action Buttons Group ────────────────────────────────── */
.action-group {
    display: flex;
    gap: 0.375rem;
}
.action-group .btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* ── Detail Page Styling ─────────────────────────────────── */
.detail-label {
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.detail-value {
    font-size: 1rem;
    color: var(--dark);
    font-weight: 500;
}

/* ── Form Enhancements ───────────────────────────────────── */
.form-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
}
.form-section h5 {
    color: var(--dark);
    font-weight: 600;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}
.form-label {
    font-weight: 500;
    color: #475569;
    font-size: 0.875rem;
}
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 0.55rem 0.875rem;
    font-size: 0.9rem;
}

/* ── Info Alert / Banner ─────────────────────────────────── */
.info-banner {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.info-banner i {
    color: var(--primary);
    margin-right: 0.5rem;
}

/* ── Modal Overrides ─────────────────────────────────────── */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 1.25rem 1.5rem;
}
.modal-body {
    padding: 1.5rem;
}
.modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
}

/* ── Responsive Table ────────────────────────────────────── */
@media (max-width: 768px) {
    .table-responsive-cards thead {
        display: none;
    }
    .table-responsive-cards tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        padding: 0.75rem;
    }
    .table-responsive-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none;
        border-bottom: 1px solid #f1f5f9;
    }
    .table-responsive-cards tbody td:last-child {
        border-bottom: none;
    }
    .table-responsive-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: 0.8rem;
        text-transform: uppercase;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* Responsive */
@media (max-width: 768px) {
    .rta-sidebar {
        transform: translateX(-100%);
    }
    .rta-sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .rta-footer {
        margin-left: 0;
    }
}

/* ═══════════════════════════════════════════════════════════=
   PWA Install Banner
   ═══════════════════════════════════════════════════════════= */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: white;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    padding: 0.75rem 1rem;
}
.pwa-install-banner.show {
    transform: translateY(0);
}
.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 1200px;
    margin: 0 auto;
}
.pwa-install-icon {
    flex-shrink: 0;
}
.pwa-install-icon img {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.pwa-install-text {
    flex: 1;
    min-width: 0;
}
.pwa-install-text strong {
    display: block;
    font-size: 0.9rem;
    color: var(--dark);
}
.pwa-install-text small {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
}

/* ═══════════════════════════════════════════════════════════=
   Offline Indicator
   ═══════════════════════════════════════════════════════════= */
body.offline .rta-navbar::after {
    content: '📡 Offline — beberapa fitur mungkin terbatas';
    position: absolute;
    bottom: -28px;
    left: 0;
    right: 0;
    background: #f59e0b;
    color: white;
    text-align: center;
    font-size: 0.8rem;
    padding: 4px;
    z-index: 999;
}

/* ═══════════════════════════════════════════════════════════=
   PWA Standalone Mode (hidden sidebar toggle etc)
   ═══════════════════════════════════════════════════════════= */
@media (display-mode: standalone) {
    .rta-navbar {
        padding-top: env(safe-area-inset-top, 0px);
    }
    .pwa-install-banner {
        display: none !important;
    }
}
@media (display-mode: minimal-ui) {
    .pwa-install-banner {
        display: none !important;
    }
}
