/* --- Global Styles & Variables --- */
:root {
    --primary-blue: #00aaff;
    --secondary-blue: #0077cc;
    --dark-bg: #05080d;
    --card-bg: rgba(10, 23, 46, 0.7);
    --glass-bg: rgba(0, 170, 255, 0.05);
    --border-color: rgba(0, 170, 255, 0.2);
    --border-hover: #00aaff;
    --text-primary: #e6f7ff;
    --text-secondary: #a0c8e0;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --gradient-primary: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- Background Effects --- */
.cyber-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -2;
    background: radial-gradient(circle at 20% 80%, rgba(0,102,255,0.1) 0%, transparent 40%),
                radial-gradient(circle at 80% 20%, rgba(0,170,255,0.08) 0%, transparent 40%);
}
.matrix-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
    background-image: linear-gradient(var(--border-color) 1px, transparent 1px),
                      linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.1;
    animation: matrixMove 20s linear infinite;
}
@keyframes matrixMove {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

/* --- General Components --- */
.btn {
    padding: 0.75rem 1.5rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}
.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 170, 255, 0.2);
}
.btn-secondary {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}
.btn-danger {
    background: linear-gradient(135deg, #c23616, #e84118);
}
.btn-danger:hover {
    box-shadow: 0 10px 20px rgba(232, 65, 24, 0.2);
}
.btn-logout { background: transparent; border: 1px solid var(--border-color); }

.section-title {
    font-size: clamp(2rem, 5vw, 2.5rem);
    text-align: center;
    margin-bottom: 3rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Navigation --- */
.nav {
    position: fixed; top: 0; left: 0; width: 100%;
    background: rgba(5, 8, 13, 0.8);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: transform 0.3s ease;
}
.nav-container {
    max-width: 1400px; margin: 0 auto;
    padding: 1rem 2rem; display: flex;
    justify-content: space-between; align-items: center;
}
.nav-logo {
    font-size: 1.5rem; font-weight: 700; color: var(--text-primary);
    text-decoration: none;
}
.nav-menu { display: flex; align-items: center; gap: 2rem; }
.nav-list { display: flex; list-style: none; gap: 1.5rem; }
.nav-link { color: var(--text-secondary); text-decoration: none; transition: color 0.3s ease; }
.nav-link:hover { color: var(--primary-blue); }
.nav-auth { display: flex; align-items: center; gap: 1rem; }
.user-info { display: flex; align-items: center; gap: 1rem; }
.user-role { background: var(--primary-blue); padding: 0.2rem 0.6rem; border-radius: 5px; font-size: 0.75rem; font-weight: bold; }
.login-form { display: flex; gap: 0.5rem; }
.login-form input {
    width: 140px; padding: 0.5rem; background: #111;
    border: 1px solid var(--border-color); border-radius: 6px;
    color: var(--text-primary);
}
.nav-toggle { display: none; font-size: 1.5rem; cursor: pointer; }

/* --- Hero Section --- */
.hero {
    height: 100vh; display: flex; align-items: center; justify-content: center;
    text-align: center; padding: 0 2rem;
}
.hero-content {
    max-width: 800px;
    animation: fadeIn 1s ease-out;
}
.hero-title {
    font-size: clamp(3rem, 10vw, 5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-subtitle {
    font-size: clamp(1rem, 4vw, 1.25rem);
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 600px; margin-left: auto; margin-right: auto;
}
.hero-cta:hover { transform: translateY(-5px) scale(1.05); }

/* --- Main Content --- */
.main-content { padding: 8rem 2rem 4rem; max-width: 1400px; margin: 0 auto; }

/* --- Admin Panel --- */
.admin-panel {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem; margin-bottom: 4rem;
    backdrop-filter: blur(10px);
}
.admin-subtitle { color: var(--primary-blue); margin-bottom: 1.5rem; font-size: 1.25rem; }
.form-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem; margin-bottom: 1.5rem;
}
.form-group { display: flex; flex-direction: column; }
.form-group label { margin-bottom: 0.5rem; color: var(--text-secondary); font-size: 0.9rem; }
.form-group input, .form-group textarea {
    width: 100%; padding: 0.75rem;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px; color: var(--text-primary);
    font-size: 1rem; transition: all 0.3s ease;
}
.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--border-hover);
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.2);
}

/* --- Categories Grid --- */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 2rem;
}
.category-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px; padding: 1.5rem;
    transition: all 0.3s ease;
    display: flex; flex-direction: column;
}
.category-card:hover {
    transform: translateY(-8px);
    border-color: var(--border-hover);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}
.category-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.category-icon { font-size: 1.5rem; color: var(--primary-blue); }
.category-title { font-size: 1.25rem; font-weight: 600; }
.category-meta { font-size: 0.8rem; color: var(--text-secondary); }
.category-description { color: var(--text-secondary); margin-bottom: 1.5rem; flex-grow: 1; }
.files-list { max-height: 250px; overflow-y: auto; padding-right: 0.5rem; margin-bottom: 1.5rem; }
.files-list::-webkit-scrollbar { width: 6px; }
.files-list::-webkit-scrollbar-track { background: transparent; }
.files-list::-webkit-scrollbar-thumb { background: var(--secondary-blue); border-radius: 3px; }

.file-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: 0.75rem;
    background: rgba(0, 170, 255, 0.05);
    border-radius: 8px; margin-bottom: 0.5rem;
    transition: background-color 0.3s;
}
.file-item:hover { background: rgba(0, 170, 255, 0.1); }
.file-info { display: flex; flex-direction: column; }
.file-name { color: var(--text-primary); text-decoration: none; font-weight: 500; }
.file-name:hover { text-decoration: underline; color: var(--primary-blue); }
.file-name i { margin-right: 0.5rem; color: var(--primary-blue); }
.file-meta { font-size: 0.8rem; color: var(--text-secondary); display: flex; gap: 1rem; }
.action-btn {
    background: none; border: none; color: var(--text-secondary);
    font-size: 1rem; cursor: pointer; transition: color 0.3s; padding: 0.5rem;
}
.action-btn.delete:hover { color: var(--error-color); }

.category-actions {
    margin-top: auto; display: flex; gap: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem; flex-wrap: wrap;
}
.upload-form { display: flex; gap: 1rem; flex-grow: 1; }
.file-input { display: none; }
.empty-state {
    text-align: center; padding: 2rem; color: var(--text-secondary);
    font-style: italic; grid-column: 1 / -1;
}

/* --- Alerts --- */
.alert {
    padding: 1rem 1.5rem; border-radius: 8px;
    margin: 0 auto 2rem auto; max-width: 1200px;
    border-left: 5px solid; text-align: center;
}
.alert-success { background-color: rgba(34, 197, 94, 0.1); border-color: var(--success-color); color: var(--success-color); }
.alert-error { background-color: rgba(239, 68, 68, 0.1); border-color: var(--error-color); color: var(--error-color); }
.fade-in-out { animation: fadeInOut 5s forwards; }
@keyframes fadeInOut {
    0%, 100% { opacity: 0; transform: translateY(-20px); }
    10%, 90% { opacity: 1; transform: translateY(0); }
}

/* --- Footer --- */
.footer {
    text-align: center; padding: 2rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* --- Animations --- */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn forwards 0.5s ease-out;
    animation-delay: var(--delay, 0s);
}
@keyframes fadeIn {
    to { opacity: 1; transform: translateY(0); }
}

/* --- Responsive Design --- */
@media (max-width: 992px) {
    .categories-grid { grid-template-columns: 1fr; }
    .nav-auth { flex-direction: column; align-items: stretch; gap: 1rem; width: 100%; }
    .login-form { flex-direction: column; }
    .login-form input { width: 100%; }
    .user-info { justify-content: space-between; }
    .nav-menu {
        position: fixed; top: 0; right: -100%;
        width: 70%; height: 100vh;
        background: #0a1322;
        padding: 4rem 2rem 2rem;
        flex-direction: column;
        align-items: flex-start;
        transition: right 0.4s ease-in-out;
        box-shadow: -10px 0 30px rgba(0,0,0,0.2);
    }
    .nav-menu.show-menu { right: 0; }
    .nav-list { flex-direction: column; gap: 2rem; width: 100%; }
    .nav-toggle { display: block; }
}

@media (max-width: 480px) {
    .nav-container, .main-content { padding: 1rem; }
    .main-content { padding-top: 6rem; }
    .category-actions { flex-direction: column; }
    .file-item { flex-direction: column; align-items: flex-start; }
}