/* ==========================================================================
   PHP Image Host - Pure CSS3 Design System
   Modern, responsive, clean, high-contrast typography, accessible colors.
   ========================================================================== */

:root {
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-color-dark: #cbd5e1;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-white: #ffffff;

    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #eff6ff;

    --color-success: #16a34a;
    --color-success-light: #f0fdf4;
    --color-warning: #d97706;
    --color-warning-light: #fffbeb;
    --color-danger: #dc2626;
    --color-danger-hover: #b91c1c;
    --color-danger-light: #fef2f2;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-pill: 9999px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-main);
    background-color: var(--bg-main);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--color-primary-hover);
}

/* ==========================================================================
   Layout: App Wrapper & Sidebar
   ========================================================================== */

.app-wrapper,
.app-layout {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-main);
    width: 100%;
}

.app-sidebar {
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    background-color: var(--bg-sidebar);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-height: 100vh;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 40;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.25s ease;
}

.sidebar-header,
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 700;
    font-size: 1.1rem;
    color: #ffffff;
    flex-shrink: 0;
}

.brand-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.brand-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.brand-title {
    letter-spacing: -0.01em;
    font-weight: 700;
    color: #ffffff;
}

.brand-badge {
    font-size: 0.65rem;
    background: rgba(37, 99, 235, 0.35);
    color: #93c5fd;
    border: 1px solid rgba(147, 197, 253, 0.25);
    border-radius: 4px;
    padding: 2px 6px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.sidebar-nav,
.sidebar-menu {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-section-title,
.menu-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 14px 12px 6px;
    font-weight: 700;
    display: block;
}

.nav-item,
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    color: #94a3b8;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    text-decoration: none;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.nav-item:hover,
.menu-item:hover {
    background-color: var(--bg-sidebar-hover);
    color: #ffffff;
}

.nav-item.active,
.menu-item.active {
    background-color: var(--color-primary);
    color: #ffffff;
    font-weight: 600;
}

.menu-item-danger {
    color: #f87171 !important;
}

.menu-item-danger:hover {
    background-color: rgba(220, 38, 38, 0.15) !important;
    color: #fca5a5 !important;
}

.nav-icon,
.menu-icon {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.sidebar-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.08);
    margin: 10px 4px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background-color: rgba(15, 23, 42, 0.4);
    flex-shrink: 0;
}

.user-profile-widget,
.user-pill {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-pill);
    background-color: var(--color-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-meta {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.user-handle {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 2px;
}

.user-role-badge {
    display: inline-block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1px 6px;
    border-radius: 4px;
    background-color: #1e293b;
    color: #94a3b8;
    font-weight: 600;
}

.btn-sidebar-logout {
    display: block;
    width: 100%;
    text-align: center;
    padding: 8px;
    border-radius: var(--radius-sm);
    background-color: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.15s ease;
}

.btn-sidebar-logout:hover {
    background-color: rgba(239, 68, 68, 0.25);
    color: #ffffff;
}

/* ==========================================================================
   Main Content Area & Topbar
   ========================================================================== */

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--bg-main);
}

.topbar,
.app-topbar {
    height: 64px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.btn-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-main);
    padding: 4px 8px;
    margin-right: 8px;
    border-radius: var(--radius-sm);
}

.btn-sidebar-toggle:hover {
    background-color: #f1f5f9;
}

.topbar-brand-mobile {
    display: none;
    font-weight: 700;
    font-size: 1.1rem;
}

.topbar-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.topbar-right,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.content-container,
.app-content {
    flex: 1;
    padding: 32px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.app-footer {
    padding: 18px 32px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.82rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* ==========================================================================
   Cards & UI Components
   ========================================================================== */

.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.p-8 { padding: 32px; }
.py-8 { padding-top: 32px; padding-bottom: 32px; }
.py-12 { padding-top: 48px; padding-bottom: 48px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.max-w-xl { max-width: 640px; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #ffffff;
}
.btn-primary:hover {
    background-color: var(--color-primary-hover);
    color: #ffffff;
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #1e293b;
}
.btn-secondary:hover {
    background-color: #cbd5e1;
    color: #0f172a;
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-danger {
    background-color: var(--color-danger);
    color: #ffffff;
}
.btn-danger:hover {
    background-color: var(--color-danger-hover);
}

.btn-danger-outline {
    background-color: transparent;
    border-color: #fecaca;
    color: var(--color-danger);
}
.btn-danger-outline:hover {
    background-color: var(--color-danger-light);
    border-color: #f87171;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.82rem;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-pill);
    white-space: nowrap;
}

.badge-primary { background-color: var(--color-primary-light); color: var(--color-primary); }
.badge-secondary { background-color: #f1f5f9; color: #475569; }
.badge-album { background-color: #eff6ff; color: #1d4ed8; font-size: 0.72rem; padding: 2px 6px; border-radius: 4px; }
.badge-user { background-color: #f8fafc; color: #64748b; font-size: 0.72rem; border: 1px solid #e2e8f0; padding: 1px 5px; border-radius: 4px; }

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}
.status-active { color: var(--color-success); }
.status-active::before { content: "●"; font-size: 0.8rem; }
.status-disabled { color: var(--color-danger); }
.status-disabled::before { content: "●"; font-size: 0.8rem; }

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    border: 1px solid transparent;
}
.alert-success { background-color: var(--color-success-light); border-color: #bbf7d0; color: #15803d; }
.alert-danger { background-color: var(--color-danger-light); border-color: #fecaca; color: #b91c1c; }
.alert-warning { background-color: var(--color-warning-light); border-color: #fde68a; color: #b45309; }
.alert-info { background-color: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }

/* ==========================================================================
   Forms & Inputs
   ========================================================================== */

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: 0.88rem;
    margin-bottom: 6px;
    color: var(--text-main);
}

.form-input,
.form-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.92rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #ffffff;
    color: var(--text-main);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-input-sm {
    padding: 6px 10px;
    font-size: 0.82rem;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group .btn,
.input-group .input-addon {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-addon {
    padding: 0 12px;
    background-color: #f1f5f9;
    border: 1px solid var(--border-color);
    border-left: none;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.album-select-row {
    display: flex;
    gap: 10px;
}

/* ==========================================================================
   Dashboard, Stats & Metrics
   ========================================================================== */

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 16px;
}

.view-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.welcome-banner {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: #ffffff;
    padding: 28px;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.welcome-title {
    font-size: 1.45rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.welcome-subtitle {
    color: #94a3b8;
    font-size: 0.95rem;
}

.welcome-actions {
    display: flex;
    gap: 12px;
}

.welcome-actions .btn-outline {
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.welcome-actions .btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.stat-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.stat-link {
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 10px;
    display: inline-block;
}

.stat-card-admin {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.stat-mini-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    font-size: 0.82rem;
    margin-top: 8px;
}

/* Progress Bars */
.progress-bar-wrap {
    width: 100%;
    height: 8px;
    background-color: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--color-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-warning { background-color: var(--color-warning); }
.progress-danger { background-color: var(--color-danger); }

/* ==========================================================================
   Albums Grid
   ========================================================================== */

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.album-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.album-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.album-icon {
    font-size: 2rem;
}

.album-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
}

.album-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

/* ==========================================================================
   Gallery Grid & Image Cards
   ========================================================================== */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.image-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #ffffff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.image-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.image-thumb-wrap {
    height: 170px;
    background-color: #f1f5f9;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}

.image-card:hover .image-thumb-wrap img {
    transform: scale(1.04);
}

.image-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.4);
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.image-card:hover .image-overlay {
    opacity: 1;
}

.btn-preview-badge {
    background-color: rgba(255, 255, 255, 0.95);
    color: #0f172a;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-md);
}

.image-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.image-name {
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
    font-family: monospace;
}

.image-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.image-actions {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 6px;
    margin-top: 8px;
}

/* Filter Card */
.filter-card {
    padding: 16px;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.filter-group {
    flex: 1;
    min-width: 140px;
}

/* ==========================================================================
   Upload Dropzone & Queue
   ========================================================================== */

.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    padding: 48px 24px;
    text-align: center;
    background-color: #f8fafc;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--color-primary);
    background-color: var(--color-primary-light);
}

.dropzone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.dropzone-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.dropzone-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.dropzone-link {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: underline;
}

.dropzone-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
}

.file-queue-box {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    background-color: #ffffff;
}

.file-queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.queue-list {
    list-style: none;
    max-height: 240px;
    overflow-y: auto;
}

.queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
}

.queue-item:last-child {
    border-bottom: none;
}

.upload-results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.upload-result-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}

.result-success {
    background-color: var(--color-success-light);
    border-color: #bbf7d0;
}

.result-error {
    background-color: var(--color-danger-light);
    border-color: #fecaca;
}

.result-status-icon {
    font-size: 1.3rem;
    font-weight: 800;
}

.result-success .result-status-icon { color: var(--color-success); }
.result-error .result-status-icon { color: var(--color-danger); }

.result-details {
    flex: 1;
}

.result-url-preview {
    display: flex;
    gap: 8px;
}

/* ==========================================================================
   Preview Standalone View
   ========================================================================== */

.preview-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.preview-image-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #0f172a;
    border-color: #1e293b;
}

.preview-stage {
    width: 100%;
    min-height: 400px;
    max-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-full-img {
    max-width: 100%;
    max-height: 560px;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.preview-actions-bar {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    width: 100%;
    justify-content: center;
}

.meta-list {
    list-style: none;
    font-size: 0.9rem;
}

.meta-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.meta-list li:last-child {
    border-bottom: none;
}

/* ==========================================================================
   Data Tables
   ========================================================================== */

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th {
    background-color: #f8fafc;
    padding: 12px 16px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination-wrap {
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    list-style: none;
    gap: 4px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    background-color: #ffffff;
    transition: all 0.15s ease;
}

.page-link:hover:not(.disabled) {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.page-link.active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
}

.page-link.disabled {
    color: var(--text-light);
    cursor: not-allowed;
    background-color: #f8fafc;
}

.page-dots {
    display: inline-flex;
    align-items: center;
    padding: 0 8px;
    color: var(--text-muted);
}

/* ==========================================================================
   Modal Overlay
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 820px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    animation: modalSlide 0.25s ease-out;
}

.modal-box-sm {
    max-width: 480px;
}

.btn-secondary-outline {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}
.btn-secondary-outline:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

.modal-stage {
    background-color: #0f172a;
    border-radius: var(--radius-md);
    min-height: 280px;
    max-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    overflow: hidden;
}

.modal-stage img {
    max-width: 100%;
    max-height: 420px;
    object-fit: contain;
}

.modal-image-wrap {
    background-color: #0f172a;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    min-height: 280px;
    max-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 16px;
}

.modal-image-wrap img {
    max-width: 100%;
    max-height: 55vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.modal-details {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    padding: 12px 16px;
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
}

.modal-url-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    background-color: #f8fafc;
}

/* ==========================================================================
   Auth Screens (Login & Install)
   ========================================================================== */

.auth-body {
    background-color: #0f172a;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo {
    font-size: 2.8rem;
    margin-bottom: 8px;
}

.auth-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-main);
}

.auth-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-light);
}

/* ==========================================================================
   Profile Grid & Utilities
   ========================================================================== */

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.delete-warning-icon {
    font-size: 3.5rem;
    text-align: center;
    margin-bottom: 12px;
}

.border-danger-light {
    border-color: #fecaca;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.text-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-primary { color: var(--color-primary); }
.block { display: block; }
.whitespace-nowrap { white-space: nowrap; }

/* Toast Notification */
.toast-notice {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: #0f172a;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 9999;
    animation: toastIn 0.25s ease-out;
}

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

/* Responsive Breakpoints */
@media (max-width: 900px) {
    .preview-layout,
    .profile-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.5);
    }

    .app-sidebar.open {
        transform: translateX(0);
    }

    .topbar-brand-mobile {
        display: block;
    }

    .btn-mobile-menu,
    .btn-sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .topbar,
    .app-topbar {
        padding: 0 16px;
    }

    .content-container,
    .app-content {
        padding: 20px 14px;
    }

    .welcome-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .form-row-2,
    .form-row-3 {
        grid-template-columns: 1fr;
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* ==========================================================================
   Auth Screens (Login) - Clean & Minimal Mobile-Friendly
   ========================================================================== */

.auth-body {
    background-color: #0f172a;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-wrap {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.auth-card {
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    padding: 34px 26px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.auth-brand {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo-badge {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-logo-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.auth-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.auth-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

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

.input-icon {
    position: absolute;
    left: 12px;
    font-size: 1rem;
    color: #94a3b8;
    pointer-events: none;
    z-index: 2;
}

.input-with-icon {
    padding-left: 38px !important;
}

.label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.btn-toggle-pwd {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.btn-toggle-pwd:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.auth-footer-hint {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #f1f5f9;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.hint-title {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    color: #475569;
}

.hint-credentials code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #0f172a;
    border: 1px solid #e2e8f0;
}

/* ==========================================================================
   Dashboard Hero & Extended Stats & Album Cards
   ========================================================================== */

.dashboard-hero {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
}

.hero-greeting {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.hero-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stat-icon-badge {
    font-size: 1.6rem;
    margin-bottom: 8px;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.album-card-body {
    display: flex;
    align-items: center;
    gap: 14px;
}

.album-details {
    flex: 1;
    min-width: 0;
}

.album-meta-line {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
    display: block;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.image-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-bottom: 4px;
}

.image-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.image-card-actions {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background-color: #fafbfc;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.image-card-actions .btn {
    flex: 1;
    text-align: center;
    justify-content: center;
}

/* ==========================================================================
   Upload Results & Embed Codes Styling
   ========================================================================== */

.upload-results-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.result-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    gap: 16px;
    background-color: #ffffff;
    transition: background-color 0.15s ease;
}

.result-success {
    border-left: 4px solid var(--color-success);
}

.result-failed {
    border-left: 4px solid var(--color-danger);
    background-color: #fef2f2;
}

.result-thumb-box {
    width: 84px;
    height: 84px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background-color: #f1f5f9;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.result-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-details {
    flex: 1;
    min-width: 0;
}

.result-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.result-filename {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    word-break: break-all;
}

.url-copy-box {
    margin-top: 8px;
}

.url-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.url-input-wrap {
    display: flex;
    gap: 6px;
}

.url-input-field {
    flex: 1;
    font-size: 0.8rem;
    padding: 6px 10px;
    background-color: #f8fafc;
}

.embed-details summary {
    font-size: 0.78rem;
    color: var(--color-primary);
    cursor: pointer;
    font-weight: 600;
    user-select: none;
}

.embed-details summary:hover {
    text-decoration: underline;
}

.select-album-row {
    display: flex;
    gap: 10px;
}

.select-album-row select {
    flex: 1;
}

/* File Queue UI */
.file-queue-card {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.queue-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.btn-clear-queue {
    background: none;
    border: none;
    color: var(--color-danger);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-clear-queue:hover {
    text-decoration: underline;
}

.queue-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    padding: 6px 10px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

/* Mobile Sidebar Backdrop */
.sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.6);
        z-index: 35;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    .dashboard-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px 16px;
    }

    .hero-actions {
        width: 100%;
        margin-top: 6px;
    }

    .hero-actions .btn {
        flex: 1;
        text-align: center;
    }

    .select-album-row {
        flex-direction: column;
    }

    .result-item {
        flex-direction: column;
    }

    .result-thumb-box {
        width: 100%;
        height: 120px;
    }

    .image-grid,
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .image-thumb-wrap {
        height: 130px;
    }
}

/* ==========================================================================
   Storage Quota Display Element (Real-Time JSON Metadata based)
   ========================================================================== */
.storage-quota-display-element {
    padding: 20px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.storage-quota-flex {
    display: flex;
    align-items: center;
    gap: 18px;
}

.storage-icon-circle {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

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

.storage-quota-headline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.storage-headline-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.storage-quota-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Sidebar Storage Widget */
.sidebar-storage-widget {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.sidebar-storage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.76rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 6px;
}

.sidebar-storage-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 6px;
}

.sidebar-storage-bar-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.sidebar-storage-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ==========================================================================
   Gallery Batch Toolbar & Checkboxes
   ========================================================================== */
.gallery-batch-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 18px;
    gap: 12px;
    flex-wrap: wrap;
}

.batch-select-all {
    display: flex;
    align-items: center;
    gap: 12px;
}

.batch-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    user-select: none;
}

.batch-checkbox-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.batch-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.image-card {
    position: relative;
}

.image-card.is-selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
    background-color: #f8faff;
}

.image-card-checkbox-label {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.image-card-checkbox-label:hover {
    transform: scale(1.08);
    background: #ffffff;
}

.image-card-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-primary);
    margin: 0;
}

/* ==========================================================================
   Client-Side Image Preview (FileReader API)
   ========================================================================== */
.client-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.client-preview-card {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.client-preview-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.client-preview-thumb-box {
    position: relative;
    width: 100%;
    height: 130px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.client-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.client-preview-meta {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #ffffff;
}

.client-preview-filename {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-preview-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.btn-remove-preview {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.75);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
    z-index: 10;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.btn-remove-preview:hover {
    background: #ef4444;
    transform: scale(1.1);
}



