/* --- Variables (Deep Black Premium) --- */
:root {
    --bg-main: #09090b;
    /* Zinc 950 */
    --bg-card: #121214;
    /* Slightly lighter than main */
    --bg-sidebar: #09090b;
    --bg-input: #18181b;

    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    --primary: #3b82f6;
    /* Blue 500 */
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.5);

    --border-subtle: #27272a;
    /* Zinc 800 */
    --border-highlight: #3f3f46;

    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --radius-main: 16px;
    --radius-sm: 8px;

    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
}

/* --- Global Reset & Typography --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.5;
    /* The premium gradient from Login Page */
    background-image: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* --- Layout --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: 280px;
    background-color: rgba(9, 9, 11, 0.8);
    /* Semi-transparent */
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.logo-area {
    margin-bottom: 40px;
    padding-left: 12px;
}

.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.nav-link.active {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.nav-link i {
    font-size: 1.2rem;
}

.user-profile-mini {
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 8px 12px;
    transition: 0.2s;
}

.logout-btn:hover {
    color: var(--error);
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* For scrolling inside */
}

.header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    /* Optional: glass effect header */
    /* border-bottom: 1px solid var(--border-subtle); */
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px 40px 60px 40px;
}

.container-lg {
    max-width: 1400px;
    /* Full width optimization */
    margin: 0 auto;
}

/* --- Cards (Login Style) --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-main);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

/* Optional top border glow for cards */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

/* --- Stats Grid --- */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-main);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 160px;
    position: relative;
    transition: transform 0.2s;
    box-shadow: var(--shadow-card);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-highlight);
}

.stat-icon {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 1.5rem;
    color: var(--border-highlight);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 8px 0;
    background: linear-gradient(180deg, #fff, #a1a1aa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.stat-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: auto;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--success);
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: auto;
}

/* --- Tables (Premium) --- */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.data-table th.col-right {
    text-align: right;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

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

.col-right {
    text-align: right;
    white-space: nowrap;
    /* Prevent date wrapping */
}

/* --- Badges & Buttons --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-neutral {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    /* Taller buttons */
    border-radius: 12px;
    /* Smooth corners */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    font-size: 0.95rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* --- Forms (Login & Inner) --- */
.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    /* Adjusted for larger padding */
    color: var(--text-muted);
    font-size: 1.2rem;
    z-index: 2;
}

.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: white;
    padding: 14px 16px 14px 48px;
    /* Chunkier inputs */
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    transition: 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
    /* Softer glow */
}

/* Search bar spec */
.form-input.search {
    background: rgba(0, 0, 0, 0.3);
    border-color: transparent;
}

.form-input.search:focus {
    background: var(--bg-input);
    border-color: var(--primary);
}

/* Avatar */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3f3f46, #27272a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 1rem;
    border: 2px solid var(--bg-card);
}

.avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
}

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

.mb-4 {
    margin-bottom: 20px;
    /* More breathing room */
}

.mb-6 {
    margin-bottom: 24px;
}

.text-white {
    color: white;
}

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

.font-mono {
    font-family: monospace;
}

/* --- Action Strip (Segmented Control) --- */
.action-strip {
    display: flex;
    background: var(--bg-input);
    padding: 6px;
    /* More padding */
    border-radius: 14px;
    border: 1px solid var(--border-subtle);
    gap: 6px;
}

.action-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px;
    /* Taller tabs */
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.action-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.action-tab.active {
    background-color: rgba(59, 130, 246, 0.15);
    /* Glassy Blue */
    color: var(--primary);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.w-full {
    width: 100%;
}

.text-sm {
    font-size: 0.85rem;
}

/* --- Tabs --- */
.tabs-header {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 24px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    padding: 12px 4px;
    cursor: pointer;
    position: relative;
    transition: 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    box-shadow: 0 -2px 10px rgba(59, 130, 246, 0.5);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

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

/* --- Gallery Grid --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.gallery-item {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    position: relative;
    aspect-ratio: 1;
}

.gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.gallery-item:hover .gallery-img {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
    pointer-events: none;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-prompt {
    color: white;
    font-size: 0.8rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.page-link {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: 0.2s;
}

.page-link:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

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

/* --- Lightbox/Modal --- */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
    backdrop-filter: blur(5px);
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: row;
    background: var(--bg-card);
    border-radius: var(--radius-main);
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-subtle);
}

.lightbox-img-wrapper {
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 400px;
}

.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.lightbox-details {
    width: 350px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-subtle);
    background: var(--bg-card);
}

.lb-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    z-index: 1001;
}

.lb-prompt {
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-input);
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: inherit;
}

.lb-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}