/* ============================================
   Haf.id FTP — Premium Dark Theme
   Colors: Black + Blue + Gold
   ============================================ */

/* ---- CSS Custom Properties ---- */
:root {
    /* Dark backgrounds */
    --bg-deepest: #06080d;
    --bg-deep: #0a0e1a;
    --bg-dark: #0f1524;
    --bg-surface: #141c2e;
    --bg-elevated: #1a2540;
    --bg-hover: #1f2d4d;

    /* Blue spectrum */
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-200: #bfdbfe;
    --blue-300: #93c5fd;
    --blue-400: #60a5fa;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    --blue-800: #1e40af;
    --blue-900: #1e3a8a;

    /* Gold spectrum */
    --gold-50: #fefce8;
    --gold-100: #fef9c3;
    --gold-200: #fef08a;
    --gold-300: #fde047;
    --gold-400: #f5c542;
    --gold-500: #d4a017;
    --gold-600: #b8860b;
    --gold-700: #92710c;
    --gold-800: #7a5f0e;
    --gold-900: #654d12;

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: var(--gold-400);

    /* Status */
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: var(--blue-400);

    /* Gradients */
    --gradient-blue: linear-gradient(135deg, var(--blue-600), var(--blue-400));
    --gradient-gold: linear-gradient(135deg, var(--gold-600), var(--gold-400));
    --gradient-mixed: linear-gradient(135deg, var(--blue-600), var(--gold-500));
    --gradient-dark: linear-gradient(180deg, var(--bg-deepest), var(--bg-dark));
    --gradient-surface: linear-gradient(135deg, rgba(20, 28, 46, 0.9), rgba(26, 37, 64, 0.6));

    /* Glassmorphism */
    --glass-bg: rgba(14, 20, 36, 0.75);
    --glass-border: rgba(59, 130, 246, 0.15);
    --glass-blur: blur(20px);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-blue: 0 0 30px rgba(59, 130, 246, 0.15);
    --shadow-gold: 0 0 30px rgba(212, 160, 23, 0.15);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--gradient-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--blue-400);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--blue-300);
}

img {
    max-width: 100%;
    height: auto;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--blue-700);
}

/* ---- Animated Background ---- */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: 0;
    pointer-events: none;
}

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 0;
    pointer-events: none;
    animation: glowPulse 8s ease-in-out infinite alternate;
}

.bg-glow-1 {
    width: 500px;
    height: 500px;
    background: rgba(59, 130, 246, 0.08);
    top: -150px;
    right: -100px;
    animation-delay: 0s;
}

.bg-glow-2 {
    width: 400px;
    height: 400px;
    background: rgba(212, 160, 23, 0.06);
    bottom: -100px;
    left: -100px;
    animation-delay: 3s;
}

.bg-glow-3 {
    width: 300px;
    height: 300px;
    background: rgba(59, 130, 246, 0.05);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 5s;
}

@keyframes glowPulse {
    0% { opacity: 0.5; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.15); }
}

/* ---- Navbar ---- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--space-md) var(--space-xl);
    background: rgba(6, 8, 13, 0.85);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    transition: all var(--transition-base);
}

.navbar.scrolled {
    padding: var(--space-sm) var(--space-xl);
    box-shadow: var(--shadow-lg);
}

.navbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.navbar-brand svg {
    flex-shrink: 0;
}

.brand-text {
    background: var(--gradient-mixed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.625rem 1.25rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--gradient-blue);
    color: white;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
    color: white;
}

.btn-gold {
    background: var(--gradient-gold);
    color: var(--bg-deepest);
    box-shadow: 0 2px 12px rgba(212, 160, 23, 0.3);
}

.btn-gold:hover {
    box-shadow: 0 4px 20px rgba(212, 160, 23, 0.5);
    transform: translateY(-1px);
    color: var(--bg-deepest);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--blue-500);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
    box-shadow: 0 2px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn-download {
    background: var(--gradient-mixed);
    color: white;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.25), 0 2px 12px rgba(212, 160, 23, 0.15);
    width: 100%;
    padding: 0.75rem 1.25rem;
}

.btn-download:hover {
    box-shadow: 0 4px 24px rgba(59, 130, 246, 0.4), 0 4px 24px rgba(212, 160, 23, 0.25);
    transform: translateY(-2px);
    color: white;
}

/* ---- Main Content ---- */
.main-content {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: calc(80px + var(--space-2xl)) var(--space-xl) var(--space-3xl);
}

/* ---- Hero Section ---- */
.hero {
    text-align: center;
    padding: var(--space-3xl) 0 var(--space-2xl);
    position: relative;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.375rem 1rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    color: var(--blue-400);
    margin-bottom: var(--space-lg);
    font-weight: 500;
}

.hero-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.1;
    margin-bottom: var(--space-md);
}

.hero h1 .gradient-text {
    background: linear-gradient(135deg, var(--blue-400), var(--gold-400), var(--blue-300));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 6s ease-in-out infinite;
}

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

.hero-description {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto var(--space-2xl);
    line-height: 1.7;
}

/* ---- Search Bar ---- */
.search-container {
    max-width: 560px;
    margin: 0 auto var(--space-2xl);
    position: relative;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 2;
    transition: color var(--transition-fast);
}

.search-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    transition: all var(--transition-base);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), var(--shadow-blue);
}

.search-input:focus ~ .search-icon,
.search-input:focus + .search-icon {
    color: var(--blue-400);
}

.search-clear {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: none;
    transition: color var(--transition-fast);
}

.search-clear:hover {
    color: var(--text-primary);
}

.search-clear.visible {
    display: block;
}

/* ---- Stats Bar ---- */
.stats-bar {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
    flex-wrap: wrap;
    justify-content: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.625rem 1.25rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    color: var(--text-secondary);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.stat-item .stat-value {
    font-weight: 700;
    color: var(--text-primary);
}

.stat-item .stat-icon {
    font-size: 1.125rem;
}

/* ---- File Grid ---- */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.file-card {
    background: var(--gradient-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.file-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-mixed);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.file-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-blue);
}

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

.file-card-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.file-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.4;
    margin-bottom: 2px;
}

.file-ext {
    font-size: 0.75rem;
    color: var(--gold-400);
    font-family: var(--font-mono);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.file-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: var(--space-md);
}

.file-meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.file-meta-item svg {
    opacity: 0.7;
    flex-shrink: 0;
}

.file-actions {
    display: flex;
    gap: var(--space-sm);
}

/* ---- Admin Dashboard ---- */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
}

.admin-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.admin-title .gradient-text {
    background: var(--gradient-mixed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Admin Stats Cards */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
}

.admin-stat-card {
    background: var(--gradient-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    position: relative;
    overflow: hidden;
}

.admin-stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0.05;
}

.admin-stat-card.stat-files::after { background: var(--blue-400); }
.admin-stat-card.stat-downloads::after { background: var(--gold-400); }
.admin-stat-card.stat-storage::after { background: var(--success); }

.admin-stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.admin-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.admin-stat-card.stat-files .admin-stat-value { color: var(--blue-400); }
.admin-stat-card.stat-downloads .admin-stat-value { color: var(--gold-400); }
.admin-stat-card.stat-storage .admin-stat-value { color: var(--success); }

/* Upload Zone */
.upload-section {
    margin-bottom: var(--space-2xl);
}

.section-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.upload-zone {
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-3xl) var(--space-xl);
    text-align: center;
    background: var(--glass-bg);
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--blue-500);
    background: rgba(59, 130, 246, 0.05);
    box-shadow: var(--shadow-blue);
}

.upload-zone.dragover {
    border-color: var(--gold-400);
    background: rgba(212, 160, 23, 0.05);
    box-shadow: var(--shadow-gold);
}

.upload-zone-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    border-radius: var(--radius-lg);
    color: var(--blue-400);
    transition: all var(--transition-base);
}

.upload-zone:hover .upload-zone-icon,
.upload-zone.dragover .upload-zone-icon {
    transform: scale(1.1);
    background: rgba(59, 130, 246, 0.15);
}

.upload-zone-text {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.upload-zone-text strong {
    color: var(--blue-400);
}

.upload-zone-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.upload-input {
    display: none;
}

/* Upload Progress */
.upload-progress {
    display: none;
    margin-top: var(--space-lg);
}

.upload-progress.active {
    display: block;
}

.progress-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
}

.progress-item .file-name {
    flex: 1;
    font-size: 0.875rem;
}

.progress-bar-container {
    flex: 2;
    height: 6px;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-blue);
    border-radius: var(--radius-full);
    width: 0%;
    transition: width var(--transition-base);
}

.progress-bar.complete {
    background: var(--gradient-gold);
}

.progress-status {
    font-size: 0.8125rem;
    color: var(--text-muted);
    min-width: 60px;
    text-align: right;
}

/* ---- File Table (Admin) ---- */
.file-table-container {
    background: var(--gradient-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

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

.file-table thead {
    background: rgba(0, 0, 0, 0.3);
}

.file-table th {
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--glass-border);
}

.file-table td {
    padding: var(--space-md) var(--space-lg);
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.file-table tbody tr {
    transition: background var(--transition-fast);
}

.file-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

.file-table tbody tr:last-child td {
    border-bottom: none;
}

.table-file-name {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 500;
}

.table-file-name .emoji {
    font-size: 1.25rem;
}

.table-file-name .name-text {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.download-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.25rem 0.625rem;
    background: rgba(212, 160, 23, 0.1);
    border: 1px solid rgba(212, 160, 23, 0.2);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--gold-400);
    font-weight: 600;
}

.table-actions {
    display: flex;
    gap: var(--space-xs);
}

/* ---- Login Page ---- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-xl);
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--gradient-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-mixed);
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.login-logo {
    margin-bottom: var(--space-md);
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-lg);
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: var(--space-xs);
}

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

/* ---- Form Elements ---- */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 0.875rem;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 2;
    transition: color var(--transition-fast);
}

.input-wrapper input {
    width: 100%;
    padding: 0.75rem 0.875rem 0.75rem 2.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    outline: none;
    transition: all var(--transition-base);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-wrapper input:focus {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-wrapper input:focus ~ .input-icon,
.input-wrapper input:focus + .input-icon {
    color: var(--blue-400);
}

.toggle-password {
    position: absolute;
    right: 0.875rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    z-index: 2;
    transition: color var(--transition-fast);
}

.toggle-password:hover {
    color: var(--text-primary);
}

.btn-login {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    margin-top: var(--space-sm);
}

.login-footer {
    text-align: center;
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: 0.875rem;
    transition: color var(--transition-fast);
}

.back-link:hover {
    color: var(--blue-400);
}

/* ---- Alert Messages ---- */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-lg);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--info);
}

/* ---- Toast Notifications ---- */
.toast-container {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    animation: toastIn 0.4s var(--transition-spring);
    max-width: 360px;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--error); }
.toast-info { border-left: 3px solid var(--info); }

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.empty-state p {
    font-size: 0.875rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ---- Footer ---- */
.footer {
    text-align: center;
    padding: var(--space-2xl) var(--space-xl);
    border-top: 1px solid var(--glass-border);
    margin-top: var(--space-3xl);
    color: var(--text-muted);
    font-size: 0.8125rem;
    position: relative;
    z-index: 1;
}

.footer a {
    color: var(--gold-400);
    font-weight: 600;
}

.footer a:hover {
    color: var(--gold-300);
}

/* ---- Confirm Modal ---- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    max-width: 420px;
    width: 100%;
    text-align: center;
    animation: modalIn 0.3s ease;
    box-shadow: var(--shadow-xl);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.modal-content p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: var(--space-xl);
}

.modal-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
}

/* ---- No Results ---- */
.no-results {
    display: none;
    text-align: center;
    padding: var(--space-3xl);
    color: var(--text-muted);
}

.no-results.active {
    display: block;
}

/* ---- Responsive Design ---- */

/* Tablets */
@media (max-width: 1024px) {
    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

/* Mobile Large */
@media (max-width: 768px) {
    .navbar {
        padding: var(--space-sm) var(--space-md);
    }

    .navbar-brand {
        font-size: 1.1rem;
    }

    .main-content {
        padding-left: var(--space-md);
        padding-right: var(--space-md);
    }

    .hero {
        padding: var(--space-2xl) 0 var(--space-lg);
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .file-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .admin-stats {
        grid-template-columns: 1fr;
    }

    .admin-header {
        flex-direction: column;
        align-items: stretch;
    }

    /* Responsive table → cards */
    .file-table thead {
        display: none;
    }

    .file-table, .file-table tbody, .file-table tr, .file-table td {
        display: block;
    }

    .file-table tr {
        background: var(--bg-surface);
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-md);
        padding: var(--space-md);
        margin-bottom: var(--space-sm);
    }

    .file-table td {
        padding: var(--space-xs) 0;
        border-bottom: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .file-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-right: var(--space-md);
    }

    .table-file-name .name-text {
        max-width: 180px;
    }

    .table-actions {
        justify-content: flex-end;
    }

    .upload-zone {
        padding: var(--space-2xl) var(--space-md);
    }

    .stats-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .stat-item {
        justify-content: center;
    }
}

/* Mobile Small */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.5rem;
    }

    .hero-description {
        font-size: 0.9rem;
    }

    .login-card {
        padding: var(--space-xl);
    }

    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 0.9375rem;
    }

    .file-card {
        padding: var(--space-md);
    }

    .modal-content {
        padding: var(--space-xl);
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }
}

/* ---- Utility Classes ---- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold-400); }
.text-blue { color: var(--blue-400); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.hidden { display: none !important; }

/* ---- Fade-in animation for cards ---- */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}

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

.file-card:nth-child(1) { animation-delay: 0.05s; }
.file-card:nth-child(2) { animation-delay: 0.1s; }
.file-card:nth-child(3) { animation-delay: 0.15s; }
.file-card:nth-child(4) { animation-delay: 0.2s; }
.file-card:nth-child(5) { animation-delay: 0.25s; }
.file-card:nth-child(6) { animation-delay: 0.3s; }
.file-card:nth-child(7) { animation-delay: 0.35s; }
.file-card:nth-child(8) { animation-delay: 0.4s; }
.file-card:nth-child(9) { animation-delay: 0.45s; }

/* ---- Skeleton loading ---- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-hover) 50%, var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---- Change password section ---- */
.settings-section {
    background: var(--gradient-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-top: var(--space-2xl);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.settings-section .form-group {
    max-width: 400px;
}

/* ---- Minimal Hero ---- */
.hero-minimal {
    padding: var(--space-xl) 0 var(--space-lg);
}

.hero-minimal h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin-bottom: var(--space-sm);
}

.hero-stats-inline {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.375rem 0.875rem;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-pill-icon {
    font-size: 0.875rem;
}

/* ---- File Lock Badge ---- */
.file-ext-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.file-lock-badge {
    font-size: 0.75rem;
    cursor: default;
}

/* ---- Admin Section ---- */
.admin-section {
    margin-bottom: var(--space-2xl);
}

.section-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: rgba(212, 160, 23, 0.15);
    border: 1px solid rgba(212, 160, 23, 0.25);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gold-400);
    font-style: normal;
    text-transform: none;
    letter-spacing: 0;
}

/* ---- Admin File Grid (Card-based) ---- */
.admin-file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-md);
}

.admin-file-card {
    background: var(--gradient-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    transition: all var(--transition-base);
    position: relative;
    opacity: 0;
    transform: translateY(15px);
}

.admin-file-card.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.admin-file-card:hover {
    border-color: rgba(59, 130, 246, 0.25);
    box-shadow: var(--shadow-md), 0 0 20px rgba(59, 130, 246, 0.08);
}

.afc-top {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.afc-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: var(--radius-sm);
    font-size: 1.375rem;
    flex-shrink: 0;
}

.afc-info {
    flex: 1;
    min-width: 0;
}

.afc-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.35;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.afc-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.afc-ext {
    color: var(--gold-400);
    font-family: var(--font-mono);
    font-weight: 600;
    letter-spacing: 0.04em;
}

.afc-downloads {
    color: var(--blue-400);
}

.afc-locked {
    font-size: 0.6875rem;
}

.afc-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    line-height: 1.5;
    padding: var(--space-sm);
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm);
    border-left: 2px solid var(--glass-border);
}

.afc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: var(--space-sm);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.afc-date {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: var(--space-sm);
    opacity: 0.7;
}

.afc-updated {
    color: var(--gold-400);
    font-style: italic;
}

/* ---- Modal Enhancements ---- */
.modal-wide {
    max-width: 480px;
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.modal-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-icon-wrap {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(212, 160, 23, 0.1);
    border: 1px solid rgba(212, 160, 23, 0.15);
    border-radius: var(--radius-md);
    margin: 0 auto var(--space-md);
}

.modal-content {
    text-align: left;
}

.modal-content h3 {
    text-align: center;
}

.modal-content .modal-actions {
    margin-top: var(--space-md);
}

/* ---- Upload Zone Small (Re-upload) ---- */
.upload-zone-sm {
    padding: var(--space-xl) var(--space-md);
}

/* ---- Settings Form Row ---- */
.settings-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

/* ---- Password Error ---- */
.pwd-error {
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ---- Responsive: Admin File Grid ---- */
@media (max-width: 768px) {
    .admin-file-grid {
        grid-template-columns: 1fr;
    }

    .afc-actions {
        flex-wrap: wrap;
    }

    .settings-form-row {
        grid-template-columns: 1fr;
    }

    .modal-wide {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .admin-file-card {
        padding: var(--space-md);
    }

    .afc-top {
        gap: var(--space-sm);
    }

    .afc-icon {
        width: 38px;
        height: 38px;
        font-size: 1.125rem;
    }
}
