@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Modern Color Palette */
    --primary: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    --primary-solid: #4e73df;
    --primary-dark: #224abe;
    --secondary: #718096;
    --success: #48bb78;
    --info: #4299e1;
    --warning: #ed8936;
    --danger: #f56565;
    --light: #f7fafc;
    --dark: #2d3748;
    --white: #ffffff;
    --accent: #e6fffa;
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.18);
    --shadow-soft: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --shadow-card: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.3);

    /* Theme Variables (Default Light) */
    --bg-body: #f8f9fc;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-input: rgba(255, 255, 255, 0.8);
    --text-main: #2d3748;
    --text-heading: #1a202c;
    --text-meta: #718096;
    --border-color: rgba(255, 255, 255, 0.2);
    --backdrop-blur: blur(10px);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-body);
    margin: 0;
    color: var(--text-main);
    line-height: 1.6;
    font-size: 16px;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden; /* Mencegah scroll horizontal yang merusak tampilan mobile */
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Navbar */
nav {
    background: var(--primary);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav .brand {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
}

nav a {
    color: white;
    text-decoration: none;
    margin-left: 20px;
    font-weight: 500;
    transition: opacity 0.3s;
}

nav .btn-login {
    background: rgba(255,255,255,0.2);
    padding: 8px 20px;
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.3);
}

/* Theme Switch Button */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    margin-left: 20px;
}

.theme-switch {
    display: inline-block;
    height: 26px;
    position: relative;
    width: 50px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: rgba(255,255,255,0.3);
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
    border-radius: 34px;
    border: 1px solid rgba(255,255,255,0.5);
}

.slider:before {
    background-color: #fff;
    bottom: 3px;
    content: "";
    height: 18px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 18px;
    border-radius: 50%;
    /* Sun Icon (Default/Light Mode) */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f6c23e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cline x1='12' y1='1' x2='12' y2='3'/%3E%3Cline x1='12' y1='21' x2='12' y2='23'/%3E%3Cline x1='4.22' y1='4.22' x2='5.64' y2='5.64'/%3E%3Cline x1='18.36' y1='18.36' x2='19.78' y2='19.78'/%3E%3Cline x1='1' y1='12' x2='3' y2='12'/%3E%3Cline x1='21' y1='12' x2='23' y2='12'/%3E%3Cline x1='4.22' y1='19.78' x2='5.64' y2='18.36'/%3E%3Cline x1='18.36' y1='5.64' x2='19.78' y2='4.22'/%3E%3C/svg%3E");
    background-size: 12px;
    background-repeat: no-repeat;
    background-position: center;
}

input:checked + .slider {
    background-color: var(--primary-dark);
}

input:checked + .slider:before {
    transform: translateX(22px);
    /* Moon Icon (Dark Mode) */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234e73df' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.hamburger:hover {
    background-color: rgba(255,255,255,0.1);
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: white;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Mobile Menu Overlay */
.mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    background: var(--primary);
    z-index: 999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: left 0.3s ease;
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu a {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    margin: 20px 0;
    padding: 15px 30px;
    border-radius: 10px;
    transition: all 0.3s;
    width: 200px;
    text-align: center;
}

.mobile-menu a:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}

.mobile-menu .btn-login {
    margin-top: 30px;
    padding: 15px 30px;
    font-size: 1.2rem;
}

/* Hero Section */
.hero {
    background: var(--primary);
    color: white;
    padding: 4rem 1rem 6rem;
    text-align: center;
    border-radius: 0 0 50% 50% / 20px;
    margin-bottom: 3rem;
}

.hero h1 { font-size: 3rem; margin-bottom: 15px; }
.hero p { font-size: 1.25rem; opacity: 0.9; max-width: 650px; margin: 0 auto 35px; }

.search-box {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}
.search-box input {
    width: 100%;
    padding: 15px 50px 15px 25px;
    border-radius: 50px;
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    font-size: 1rem;
    outline: none;
    color: #444;
    box-sizing: border-box;
    transition: all 0.3s ease;
}
.search-box input:focus {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}

/* Highlight Search Terms */
.highlight {
    background-color: rgba(246, 194, 62, 0.4);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}
.search-box i {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
}

/* Container */
.container {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    position: relative;
    z-index: 10;
}

.hero + .container {
    margin-top: -13rem;
}

/* Cards */
.card {
    background: var(--glass-bg);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-soft);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 5px solid var(--primary-solid);
    animation: fadeInUp 0.6s ease-out;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover::before {
    opacity: 1;
}

/* Hover effects moved to @media (hover: hover) at bottom */

.card h3 {
    margin-top: 0;
    color: var(--text-heading);
    font-size: 1.6rem;
    margin-bottom: 12px;
}

.meta {
    color: var(--text-meta);
    font-size: 0.95rem;
    margin-bottom: 18px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}
.meta i { color: var(--primary); margin-right: 5px; }

.desc {
    color: #5a5c69;
    margin-bottom: 20px;
    font-size: 1.1rem;
    line-height: 1.8;
    text-align: justify;
    flex-grow: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-down { background: var(--success); }

.btn-del { background: var(--danger); }

.btn-edit { background: var(--warning); color: #fff; }

.btn-add { background: var(--primary); margin-bottom: 20px; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #444; }
.form-group input, .form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    transition: border 0.3s;
    box-sizing: border-box;
}
.form-group input:focus, .form-group textarea:focus {
    border-color: var(--primary);
    outline: none;
    background: white;
}

/* Table for Admin */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 10px;
    overflow: hidden;
}
th {
    background-color: #f8f9fc;
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    padding: 18px;
    border-bottom: 2px solid #e3e6f0;
    text-align: left;
    border-right: 1px solid #e3e6f0;
}
td {
    padding: 18px;
    font-size: 1rem;
    border-bottom: 1px solid #e3e6f0;
    vertical-align: middle;
    border-right: 1px solid #e3e6f0;
}
tr:last-child td { border-bottom: none; }
th:last-child, td:last-child { border-right: none; }

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes bounceIn {
    0% { opacity: 0; transform: scale(0.3); }
    50% { opacity: 1; transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Interactive Animation Classes */
.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.animate-slide-in-left {
    animation: slideInLeft 0.8s ease-out;
}

.animate-slide-in-right {
    animation: slideInRight 0.8s ease-out;
}

.animate-bounce-in {
    animation: bounceIn 0.8s ease-out;
}

.animate-fade-in {
    animation: fadeIn 1s ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    animation: bounceIn 0.8s ease-out;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.fab:active {
    transform: scale(0.95);
}

/* Notification System */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    max-width: 300px;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    border-left: 4px solid var(--primary);
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left-color: var(--success);
}

.notification.error {
    border-left-color: var(--danger);
}

.notification.warning {
    border-left-color: var(--warning);
}

.notification .close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Enhanced Card Interactions */
.card-interactive {
    position: relative;
    overflow: hidden;
}

.card-interactive::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.card-interactive:hover::before {
    left: 100%;
}

/* Micro-interactions */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--light);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Enhanced Search Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-suggestions.show {
    display: block;
}

.search-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.search-suggestion-item:hover,
.search-suggestion-item.active {
    background-color: var(--light);
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

/* --- ENHANCED DASHBOARD FEATURES --- */

/* Search Filters & Tags (Interactive) */
.filter-tags {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
    animation: fadeIn 1s ease-out;
}

.filter-tag {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 10px 24px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    backdrop-filter: blur(5px);
}

.filter-tag:hover, .filter-tag.active {
    background: white;
    color: var(--primary-dark);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* File Type Badges & Card Stats */
.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.file-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.file-badge.pdf { background: #ffebee; color: #e74a3b; }
.file-badge.doc { background: #e3f2fd; color: #4e73df; }
.file-badge.xls { background: #e8f5e9; color: #1cc88a; }

.card-stats {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
    font-size: 0.85rem;
    color: #858796;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.3s;
}
.stat-item:hover { color: var(--primary); }

/* Pagination Styling */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 40px 0;
    list-style: none;
    padding: 0;
}

.pagination a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    color: var(--primary);
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 600;
}

.pagination a:hover, .pagination .active a {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(78, 115, 223, 0.3);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--secondary);
    grid-column: 1 / -1;
}
.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    color: var(--primary);
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Navbar Mobile */
    nav {
        padding: 0.75rem 1rem;
        justify-content: space-between;
    }
    
    nav .brand {
        font-size: 1.2rem;
        display: flex;
        width: auto;
    }

    .theme-switch-wrapper {
        margin-left: auto;
        margin-right: 15px;
    }

    /* Hide desktop menu items */
    nav a:not(.brand), 
    nav .btn-login {
        display: none;
    }

    /* Show Hamburger */
    .hamburger {
        display: flex;
    }

    /* Mobile Menu Overlay */
    .mobile-menu {
        display: flex;
    }

    /* Hero Section */
    .hero {
        padding: 3rem 1rem 4rem;
        margin-bottom: 2rem;
    }
    .hero h1 {
        font-size: 1.8rem;
    }
    .hero p {
        font-size: 1rem;
    }
    .hero + .container {
        margin-top: -2rem;
    }

    /* Search Box */
    .search-box {
        margin: 0 auto 2rem;
    }
    .search-box input {
        padding: 12px 45px 12px 20px;
        font-size: 16px; /* Prevent iOS zoom */
    }

    /* Cards */
    .card {
        padding: 1.25rem;
        margin-bottom: 1.5rem;
        border-radius: 12px;
        box-shadow: var(--shadow-soft);
        overflow-x: auto; /* Table scrolling */
        background: var(--glass-bg);
        backdrop-filter: var(--backdrop-blur);
        -webkit-backdrop-filter: var(--backdrop-blur);
        border: 1px solid var(--glass-border);
    }
    .card h3 {
        font-size: 1.2rem;
    }

    /* Meta & Actions */
    .meta {
        font-size: 0.8rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    .card-actions {
        flex-direction: column;
        gap: 8px;
    }
    .card-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 12px;
        margin-right: 0 !important;
    }

    /* Buttons */
    .btn {
        width: 100%;
        justify-content: center;
        margin-bottom: 8px;
        min-height: 44px; /* iOS touch target minimum */
        font-size: 0.9rem;
    }

    /* Forms */
    .form-group input, .form-group textarea {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 14px 16px;
    }
    .form-inline-responsive {
        flex-direction: column;
        align-items: stretch;
    }
    .form-inline-responsive > div {
        width: 100%;
    }

    /* Utilities */
    .section-title {
        margin-top: 60px;
        margin-bottom: 20px;
        font-size: 1.5rem;
    }
    table {
        min-width: 600px;
    }
}

/* Tablet Responsiveness */
@media (min-width: 769px) and (max-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }

    .card-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }

    .hero h1 {
        font-size: 3rem;
    }

    .hero p {
        font-size: 1.2rem;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --primary: #0000ff;
        --primary-dark: #000080;
        --success: #008000;
        --danger: #ff0000;
        --warning: #ffff00;
    }
}

/* Print Styles */
@media print {
    nav, .search-box, .btn {
        display: none !important;
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .hero {
        background: white !important;
        color: black !important;
        padding: 1rem !important;
    }
}

/* --- RESPONSIVE & UTILITIES --- */

/* Class pengganti inline style di index.php */
.section-title {
    margin-top: 220px;
    margin-bottom: 30px;
    border-left: 5px solid var(--primary);
    padding-left: 15px;
}

/* Class pengganti inline style di master.php */
.form-inline-responsive {
    display: flex; 
    gap: 10px; 
    flex-wrap: wrap; 
    align-items: flex-end;
}
.form-inline-responsive > div {
    flex: 1;
}

/* Grid Layout for Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.card-grid .card {
    height: 100%;
    margin-bottom: 0;
}

.card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Filter Controls (Moved from inline) */
.filter-controls {
    display: flex; 
    gap: 15px; 
    margin-bottom: 2rem; 
    flex-wrap: wrap; 
    align-items: center;
}

.view-toggle {
    margin-left: auto;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* Hover Effects for Non-Touch Devices (PC) */
@media (hover: hover) {
    .card:hover {
        transform: translateY(-8px) scale(1.02);
        box-shadow: var(--shadow-glow);
        border-color: rgba(102, 126, 234, 0.4);
    }
    nav a:hover { opacity: 0.8; }
    nav .btn-login:hover { background: rgba(255,255,255,0.3); }
    .btn:hover { transform: translateY(-2px); box-shadow: 0 5px 10px rgba(0,0,0,0.15); }
    .btn-down:hover { background: #17a673; }
    .btn-del:hover { background: #c0392b; }
    .btn-edit:hover { background: #d4a626; }
    tr:hover td { background-color: #fafafa; }
}

/* --- DARK MODE SUPPORT --- */
/* Definisi Variabel Dark Mode */
body.dark-mode {
    --bg-body: #131418;
    --bg-card: #1f2129;
    --bg-input: #2d2f36;
    --text-main: #e2e8f0;
    --text-heading: #f8f9fc;
    --text-meta: #a0aec0;
    --border-color: #2d2f36;
}

/* Penyesuaian elemen spesifik saat Dark Mode aktif */
body.dark-mode .card, 
body.dark-mode table, 
body.dark-mode .search-suggestions {
    border: 1px solid #2d2f36;
    box-shadow: none;
}

body.dark-mode .search-box input:focus, 
body.dark-mode .form-group input:focus {
    background-color: #373942;
}

body.dark-mode .file-badge.pdf { background: rgba(231, 74, 59, 0.2); color: #ff6b6b; }

body.dark-mode .file-badge.doc { background: rgba(78, 115, 223, 0.2); color: #6ea8fe; }

body.dark-mode .file-badge.xls { background: rgba(28, 200, 138, 0.2); color: #20c997; }

/* --- LIST VIEW STYLES --- */
.card-grid.list-view {
    grid-template-columns: 1fr !important;
}

.card-grid.list-view .card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    padding: 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
}

.card-grid.list-view .card-header {
    margin-bottom: 0 !important;
    min-width: 120px;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
}

.card-grid.list-view .card h3 {
    margin: 0;
    font-size: 1.3rem;
    flex: 1;
}

.card-grid.list-view .meta {
    margin: 0 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    min-width: 150px;
}

.card-grid.list-view .desc, 
.card-grid.list-view .card-stats {
    display: none !important; /* Sederhanakan tampilan list */
}

.card-grid.list-view .card-actions {
    flex-direction: row;
    gap: 10px;
}

@media (max-width: 768px) {
    .card-grid.list-view .card {
        flex-direction: column;
        align-items: stretch;
    }
    
    /* Enhanced Mobile Styles */
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .filter-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    .filter-group label {
        margin-bottom: 5px;
    }
    
    .filter-group select {
        width: 100%;
    }

    .view-toggle {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-left: 0;
    }
    
    .view-toggle button {
        flex: 1;
    }
    
    /* Detail Page Mobile Fixes */
    .desc {
        text-align: left !important;
        font-size: 1rem !important;
    }
    
    .card-stats {
        flex-wrap: wrap;
    }
    
    table {
        min-width: 600px; /* Force scroll on small screens */
    }

    .desktop-only {
        display: none !important;
    }

    .nav-actions {
        margin-left: auto;
        margin-right: 15px;
    }
}
