:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #334155;
    --bg-input: #0f172a;
    --accent: #38bdf8;
    --accent-hover: #0284c7;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #475569;
    --danger-color: #ef4444;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Neutral Login Screen */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
}

.login-card {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    width: 56px;
    height: 56px;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Form Controls */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

input[type="text"],
input[type="password"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--accent);
    color: #0f172a;
    font-weight: 600;
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success-color);
    color: #fff;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.alert.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger-color);
    color: #fca5a5;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2rem;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: #0f172a;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--accent);
    background: rgba(56, 189, 248, 0.1);
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: var(--accent);
    color: #0f172a;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 2rem;
    min-height: 100vh;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    flex: 1;
    max-width: 480px;
}

.search-bar input {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--text-main);
    box-shadow: none !important;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.filters-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.filter-group input, .filter-group select {
    width: auto;
    padding: 0.4rem 0.8rem;
}

/* Tabs */
.tab-content {
    display: none;
}

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

/* Photo Grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.photo-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.photo-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.photo-thumb-wrapper {
    position: relative;
    width: 100%;
    padding-top: 66.66%; /* 3:2 Aspect Ratio */
    background: #000;
    overflow: hidden;
}

.photo-thumb-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-badge-deleted {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--danger-color);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.photo-card-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.photo-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.3;
}

.photo-card-category {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 500;
}

.photo-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.tag-badge {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.photo-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

/* Categories Grid */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

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

.category-card-cover {
    width: 100%;
    height: 160px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.category-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.category-card:hover .category-card-cover img {
    transform: scale(1.05);
}

.category-card-cover.no-cover {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    background: radial-gradient(circle, rgba(255,255,255,0.03) 0%, rgba(0,0,0,0.2) 100%);
}

.category-card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.category-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.category-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    flex: 1;
}

.category-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--accent);
}

/* Tables */
.table-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    overflow-x: auto;
    margin-bottom: 2rem;
}

.table-card h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

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

.data-table th, .data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    color: var(--text-muted);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.2);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success-color);
}

.status-badge.blocked {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-lg {
    max-width: 900px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;

}

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

.modal-close:hover {
    color: var(--text-main);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(0, 0, 0, 0.1);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.05);
}

.drop-zone p span {
    color: var(--accent);
    text-decoration: underline;
}

.file-preview-name {
    margin-top: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
}

/* Photo Detail Layout */
.photo-detail-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .photo-detail-body {
        grid-template-columns: 1fr;
    }
}

.photo-detail-image-box {
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 450px;
}

/* Multi-file Upload Preview List */
.upload-preview-container {
    max-height: 440px;
    overflow-y: auto;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-right: 4px;
}

.upload-item-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.9rem;
    display: grid;
    grid-template-columns: 100px 1fr auto;
    gap: 1rem;
    align-items: start;
    position: relative;
    transition: border-color var(--transition-fast);
}

.upload-item-card.uploading {
    border-color: var(--accent);
}

.upload-item-card.success {
    border-color: #10b981;
}

.upload-item-card.error {
    border-color: var(--danger-color);
}

.upload-item-thumb {
    width: 100px;
    height: 100px;
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.upload-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-item-details {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.upload-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}

.upload-item-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.upload-item-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.upload-item-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

@media (max-width: 650px) {
    .upload-item-card {
        grid-template-columns: 1fr;
    }
    .upload-item-grid {
        grid-template-columns: 1fr;
    }
}

.upload-item-grid .form-group {
    margin-bottom: 0;
}

.upload-item-grid label {
    font-size: 0.72rem;
    margin-bottom: 2px;
}

.upload-item-grid input,
.upload-item-grid select,
.upload-item-grid textarea {
    font-size: 0.8rem;
    padding: 4px 8px;
}

.upload-progress-wrapper {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.upload-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent) 0%, #38bdf8 100%);
    transition: width 0.15s ease;
}

.upload-item-card.success .upload-progress-fill {
    background: #10b981;
}

.upload-item-card.error .upload-progress-fill {
    background: var(--danger-color);
}

.upload-progress-status {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
}

.btn-remove-upload-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}

.btn-remove-upload-item:hover {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.photo-detail-image-box img {
    max-width: 100%;
    max-height: 450px;
    object-fit: contain;
}

.meta-list {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.api-key-box {
    background: var(--bg-input);
    border: 1px dashed var(--accent);
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--accent);
    word-break: break-all;
    user-select: all;
    margin-top: 10px;
    text-align: center;
}

/* Pagination Bar */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 2rem;
    padding: 1rem 0;
}

.pagination-bar .page-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}
