/* SparkStore Admin — Light Sidebar, Modern Layout */

/* ===== Layout ===== */
.admin-body {
    background: #f8fafc;
    min-height: 100vh;
    color: #0f172a;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    transition: transform 0.3s;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-brand h1 {
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    letter-spacing: -0.02em;
}

.sidebar-brand h1 i { color: #2563eb; }
.sidebar-brand .brand-sub {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 500;
    margin-top: 0.25rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: #64748b;
    text-decoration: none;
    border-radius: 0.6rem;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.sidebar-nav a:hover {
    background: #f1f5f9;
    color: #334155;
}

.sidebar-nav a.active {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}

.sidebar-nav a i {
    width: 1.25rem;
    text-align: center;
    font-size: 1rem;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid #e2e8f0;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: #ef4444;
    text-decoration: none;
    border-radius: 0.6rem;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.sidebar-footer a:hover {
    background: #fef2f2;
}

/* ===== Main Content ===== */
.admin-main {
    margin-left: 260px;
    flex: 1;
    min-height: 100vh;
}

.admin-topbar {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid #e2e8f0;
    padding: 0.9rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-container {
    padding: 2rem;
    max-width: 1400px;
}

/* Legacy nav — hide when using sidebar */
.admin-nav { display: none; }

/* ===== Alerts ===== */
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: 0.6rem;
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid;
    animation: slideDown 0.3s;
}

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

.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

.alert-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    transition: opacity 0.2s;
    line-height: 1;
}
.alert-close:hover { opacity: 1; }

/* ===== Login ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    background: #f1f5f9;
}

.login-box {
    background: #fff;
    padding: 2.5rem;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: #0f172a;
    font-size: 1.75rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.login-box h2 i { color: #2563eb; }

.login-subtitle {
    text-align: center;
    color: #64748b;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.login-form .form-group { margin-bottom: 1.25rem; }

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
}

.login-footer a {
    color: #2563eb;
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}
.login-footer a:hover { color: #1d4ed8; }

/* ===== Dashboard ===== */
.dashboard h1 {
    margin-bottom: 1.75rem;
    color: #0f172a;
    font-size: 1.75rem;
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 0.85rem;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 16px rgba(37,99,235,0.08);
    transform: translateY(-2px);
}

.stat-card:nth-child(1) .stat-icon { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.stat-card:nth-child(2) .stat-icon { background: linear-gradient(135deg, #06b6d4, #22d3ee); }
.stat-card:nth-child(3) .stat-icon { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.stat-card:nth-child(4) .stat-icon { background: linear-gradient(135deg, #10b981, #34d399); }

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    flex-shrink: 0;
}

.stat-content h3 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.15rem;
    line-height: 1.2;
}

.stat-content p {
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ===== Tables ===== */
.data-table {
    width: 100%;
    background: #fff;
    border-radius: 0.85rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.data-table thead {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.data-table th {
    padding: 0.85rem 1.25rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.data-table td {
    padding: 0.85rem 1.25rem;
    font-size: 0.9rem;
    color: #334155;
}

.data-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafc; }

.data-table code {
    background: #eff6ff;
    padding: 0.2rem 0.5rem;
    border-radius: 0.35rem;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: #2563eb;
}

/* ===== Forms ===== */
.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: #334155;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="file"],
.form-group select,
.form-control {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: #fff;
    color: #0f172a;
    font-family: inherit;
}

.form-group input:focus,
.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-group input::placeholder { color: #94a3b8; }

.form-help {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.35rem;
}

/* ===== Buttons ===== */
.btn-block { width: 100%; justify-content: center; }

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 0.4rem;
}

.btn-info {
    background: #ecfeff;
    color: #0891b2;
    border: 1px solid #a5f3fc;
}
.btn-info:hover {
    background: #cffafe;
}

.btn-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}
.btn-danger:hover {
    background: #fee2e2;
}

.btn-success {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}
.btn-success:hover {
    background: #d1fae5;
}

.btn-warning {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}
.btn-warning:hover {
    background: #fef3c7;
}

.btn-ghost {
    background: transparent;
    color: #64748b;
    border: 1px solid #e2e8f0;
}
.btn-ghost:hover {
    background: #f1f5f9;
    color: #334155;
}

/* ===== Page Header ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
}

.page-header h1 {
    color: #0f172a;
    font-size: 1.75rem;
    font-weight: 700;
}

/* ===== Cards ===== */
.card {
    background: #fff;
    padding: 1.75rem;
    border-radius: 0.85rem;
    border: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.card h3 {
    color: #0f172a;
    font-weight: 600;
}

/* ===== Badges ===== */
.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 2rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.badge-success { background: #ecfdf5; color: #059669; }
.badge-danger  { background: #fef2f2; color: #dc2626; }
.badge-info    { background: #eff6ff; color: #2563eb; }
.badge-warning { background: #fffbeb; color: #d97706; }
.badge-public  { background: #eff6ff; color: #2563eb; }
.badge-private { background: #fffbeb; color: #d97706; }

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.pagination span {
    color: #64748b;
    font-weight: 500;
    font-size: 0.9rem;
}

/* ===== Upload ===== */
.upload-container {
    background: #fff;
    padding: 2rem;
    border-radius: 0.85rem;
    border: 1px solid #e2e8f0;
    max-width: 640px;
}

.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #2563eb;
    background: #eff6ff;
}

.drop-zone-icon {
    font-size: 2.5rem;
    color: #94a3b8;
    margin-bottom: 1rem;
}

.drop-zone-text {
    color: #475569;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.drop-zone-hint {
    color: #94a3b8;
    font-size: 0.8rem;
}

.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* ===== Visibility Selector ===== */
.visibility-options {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.vis-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.65rem 1.1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.6rem;
    transition: all 0.2s;
    font-size: 0.9rem;
    color: #64748b;
}

.vis-option:hover { border-color: #93c5fd; color: #334155; }

.vis-option.selected {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1e40af;
}

.vis-option input[type="radio"] { display: none; }

.vis-option strong { color: inherit; }

/* ===== Recent Files ===== */
.recent-files {
    background: #fff;
    padding: 1.75rem;
    border-radius: 0.85rem;
    border: 1px solid #e2e8f0;
}

.recent-files h2 {
    margin-bottom: 1.25rem;
    color: #0f172a;
    font-size: 1.3rem;
    font-weight: 700;
}

/* ===== Actions Cell ===== */
.actions-cell {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

/* ===== File Detail Pill ===== */
.file-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #0f172a;
}

.file-name i {
    color: #94a3b8;
    font-size: 1.1rem;
}

/* ===== Mobile Toggle ===== */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: #334155;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }

    .admin-main { margin-left: 0; }

    .mobile-toggle { display: block; }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.3);
        z-index: 199;
        display: none;
    }
    .sidebar-overlay.show { display: block; }

    .admin-container { padding: 1rem; }

    .page-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-actions { flex-direction: column; }
    .visibility-options { flex-direction: column; }
    .actions-cell { flex-direction: column; }

    .data-table { font-size: 0.85rem; }
    .data-table th, .data-table td { padding: 0.6rem 0.75rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}
