/* ============================================
   Admin File Manager - Stylesheet
   Clean, Modern, Professional UI
   ============================================ */

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --success: #10b981;
    --success-bg: #d1fae5;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --dark: #1e293b;
    --gray-700: #334155;
    --gray-600: #475569;
    --gray-500: #64748b;
    --gray-400: #94a3b8;
    --gray-300: #cbd5e1;
    --gray-200: #e2e8f0;
    --gray-100: #f1f5f9;
    --gray-50: #f8fafc;
    --white: #ffffff;
    --body-bg: #f1f5f9;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --card-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--body-bg);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* === Login Page === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow-lg);
    padding: 40px 35px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    font-size: 48px;
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 22px;
    color: var(--dark);
    margin-bottom: 5px;
}

.login-header p {
    color: var(--gray-500);
    font-size: 14px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--gray-500);
}

/* === Forms === */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0.5;
}

.input-wrapper input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
    background: var(--gray-50);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

input[type="text"],
input[type="date"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--white);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

textarea {
    resize: vertical;
    min-height: 60px;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-logout {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-radius: var(--radius);
    padding: 6px 14px;
}

.btn-logout:hover {
    background: var(--danger);
    color: var(--white);
}

/* === Alerts === */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-error {
    background: var(--danger-bg);
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

.alert-success {
    background: var(--success-bg);
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-warning {
    background: var(--warning-bg);
    color: #92400e;
    border-left: 4px solid var(--warning);
}

/* === Navbar === */
.navbar {
    background: var(--white);
    box-shadow: var(--card-shadow);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-logo {
    font-size: 24px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-link {
    color: var(--gray-600);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary);
    background: var(--gray-100);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-600);
}

.user-badge {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-badge.uploader {
    background: #dbeafe;
    color: #1d4ed8;
}

.user-badge.manager {
    background: #fce7f3;
    color: #be185d;
}

/* === Container === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 25px 30px;
}

/* === Page Header === */
.page-header {
    margin-bottom: 25px;
}

.page-header h2 {
    font-size: 24px;
    color: var(--dark);
    margin-bottom: 4px;
}

.page-header p {
    color: var(--gray-500);
    font-size: 14px;
}

/* === Cards === */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.card-header h3 {
    font-size: 16px;
    color: var(--dark);
}

.card-body {
    padding: 24px;
}

/* === Stats Row === */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--card-shadow-lg);
    transform: translateY(-2px);
}

.stat-number {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 4px;
    font-weight: 500;
}

/* === Upload Zone === */
.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--gray-50);
}

.upload-zone:hover,
.upload-zone.highlight {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.04);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.upload-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.upload-hint {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 16px;
}

/* === File Preview === */
.file-preview {
    background: var(--gray-50);
    border: 2px solid var(--primary-light);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
}

.preview-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-icon {
    font-size: 32px;
}

.preview-info strong {
    display: block;
    font-size: 14px;
    color: var(--dark);
}

.preview-info .text-muted {
    font-size: 12px;
    color: var(--gray-500);
}

.preview-info .btn {
    margin-left: auto;
}

/* === Preview Image === */
.preview-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
    margin-top: 12px;
    box-shadow: var(--card-shadow);
}

.file-preview-area {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.file-preview-area h4 {
    margin-bottom: 12px;
    color: var(--gray-700);
}

/* === Tables === */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    background: var(--gray-50);
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.file-name-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 300px;
}

.file-type-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.desc-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === Badges === */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-image { background: #dbeafe; color: #1d4ed8; }
.badge-pdf { background: #fee2e2; color: #dc2626; }
.badge-excel { background: #d1fae5; color: #059669; }
.badge-csv { background: #fef3c7; color: #d97706; }
.badge-other { background: var(--gray-200); color: var(--gray-600); }

.status-badge {
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active { color: var(--success); }

.uploader-name {
    color: var(--primary);
    font-weight: 600;
}

/* === Filter Form === */
.filter-form {
    width: 100%;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.filter-actions {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: end;
}

/* === File Details Grid === */
.file-details-grid {
    display: grid;
    gap: 12px;
}

.detail-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}

.detail-label {
    font-weight: 600;
    color: var(--gray-600);
    min-width: 140px;
    font-size: 13px;
}

.detail-value {
    color: var(--dark);
    font-size: 14px;
}

/* === Pagination === */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* === Footer === */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--gray-400);
    font-size: 13px;
    margin-top: 20px;
}

/* === Utilities === */
.text-muted { color: var(--gray-500); }

/* === Responsive === */
@media (max-width: 768px) {
    .navbar {
        padding: 0 15px;
        flex-wrap: wrap;
        height: auto;
        padding: 10px 15px;
    }

    .nav-links {
        flex-wrap: wrap;
        gap: 8px;
    }

    .container {
        padding: 15px;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .file-name-cell {
        max-width: 150px;
    }

    .login-card {
        padding: 25px 20px;
    }

    .table thead th,
    .table tbody td {
        padding: 8px 10px;
        font-size: 12px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
}
