/* 
 * CRUD App - Dark Theme
 * A sophisticated dark theme with warm amber accents
 */

/* ========================================
   CSS Variables
   ======================================== */
:root {
    /* Background colors - dark slate palette */
    --bg-darkest: #0f1419;
    --bg-dark: #15202b;
    --bg-medium: #192734;
    --bg-light: #22303c;
    --bg-lighter: #2d3f50;
    
    /* Accent colors - warm amber/gold */
    --accent-primary: #f7b731;
    --accent-secondary: #f5a623;
    --accent-hover: #ffc940;
    --accent-muted: rgba(247, 183, 49, 0.15);
    
    /* Text colors */
    --text-primary: #e7e9ea;
    --text-secondary: #8899a6;
    --text-muted: #657786;
    --text-link: #f7b731;
    
    /* Status colors */
    --success: #17bf63;
    --success-bg: rgba(23, 191, 99, 0.15);
    --error: #e0245e;
    --error-bg: rgba(224, 36, 94, 0.15);
    --warning: #ffad1f;
    --warning-bg: rgba(255, 173, 31, 0.15);
    --info: #1da1f2;
    --info-bg: rgba(29, 161, 242, 0.15);
    
    /* Border & shadow */
    --border-color: #38444d;
    --border-light: #2f3d47;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    
    /* Spacing */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    /* Typography */
    --font-main: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ========================================
   Font Import
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

/* ========================================
   Base Reset
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-darkest);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

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

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

.logo {
    font-weight: 700;
    font-size: 22px;
    padding: 0 12px;
    margin-bottom: 32px;
    color: var(--accent-primary);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo::before {
    content: '◆';
    font-size: 18px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: var(--bg-light);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-item.active {
    background: var(--accent-muted);
    color: var(--accent-primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    width: 3px;
    height: 24px;
    background: var(--accent-primary);
    border-radius: 0 3px 3px 0;
}

/* User card at bottom */
.user-card {
    margin-top: auto;
    padding: 16px;
    background: var(--bg-medium);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.logout-btn {
    display: block;
    margin-top: 12px;
    padding: 8px 12px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: var(--bg-light);
    color: var(--error);
    border-color: var(--error);
    text-decoration: none;
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px 40px;
    background: var(--bg-darkest);
    min-height: 100vh;
}

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

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--bg-light);
    color: var(--text-primary);
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn:hover {
    background: var(--bg-lighter);
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--bg-darkest);
    border-color: var(--accent-primary);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--bg-darkest);
}

.btn-danger {
    color: var(--error);
    border-color: var(--error);
    background: transparent;
}

.btn-danger:hover {
    background: var(--error-bg);
}

.btn-success {
    color: var(--success);
    border-color: var(--success);
    background: transparent;
}

.btn-success:hover {
    background: var(--success-bg);
}

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

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* ========================================
   Cards
   ======================================== */
.card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

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

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ========================================
   Tables
   ======================================== */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    background: var(--bg-medium);
}

th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: var(--bg-medium);
}

td {
    color: var(--text-secondary);
}

.actions {
    display: flex;
    gap: 8px;
}

/* ========================================
   Forms
   ======================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg-medium);
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-family: var(--font-main);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

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

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238899a6' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

/* File input styling */
input[type="file"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-medium);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="file"]:hover {
    border-color: var(--accent-primary);
    background: var(--accent-muted);
}

/* ========================================
   Badges
   ======================================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-error {
    background: var(--error-bg);
    color: var(--error);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

/* ========================================
   Alerts
   ======================================== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

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

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(23, 191, 99, 0.3);
}

.alert-error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(224, 36, 94, 0.3);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid rgba(29, 161, 242, 0.3);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(255, 173, 31, 0.3);
}

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

.pagination a,
.pagination span {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    background: var(--bg-medium);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.pagination a:hover {
    background: var(--bg-light);
    color: var(--text-primary);
    text-decoration: none;
}

.pagination .active {
    background: var(--accent-primary);
    color: var(--bg-darkest);
    border-color: var(--accent-primary);
}

.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ========================================
   Stats Grid
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   Filters & Search
   ======================================== */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 220px;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 14px;
}

/* ========================================
   Login Page
   ======================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darkest);
    background-image: 
        radial-gradient(ellipse at 20% 20%, rgba(247, 183, 49, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(247, 183, 49, 0.05) 0%, transparent 50%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: -0.5px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 8px;
}

/* ========================================
   Table List (Index)
   ======================================== */
.table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.table-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.table-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
    text-decoration: none;
}

.table-card-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.table-card-info {
    font-size: 13px;
    color: var(--text-muted);
}

/* ========================================
   Images Grid
   ======================================== */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.image-card {
    background: var(--bg-medium);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s ease;
}

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

.image-preview {
    width: 100%;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    overflow: hidden;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-info {
    padding: 12px;
}

.image-info-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.image-info-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* ========================================
   Scrollbar
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-lighter);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
    .main-content {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px 16px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .table-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Utility Classes
   ======================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-primary); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

