/* ===== Art Assistant – Main Stylesheet ===== */

:root {
    --bg: #0f1117;
    --sidebar-bg: #141620;
    --surface: #1a1d27;
    --surface-hover: #232736;
    --border: #2a2e3d;
    --primary: #6366f1;
    --primary-hover: #5457e5;
    --primary-light: rgba(99,102,241,.12);
    --accent: #818cf8;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --success: #22c55e;
    --success-bg: rgba(34,197,94,.1);
    --danger: #ef4444;
    --danger-bg: rgba(239,68,68,.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245,158,11,.1);
    --info: #3b82f6;
    --info-bg: rgba(59,130,246,.1);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 240px;
    --header-height: 60px;
}

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    grid-row: 1 / -1;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.sidebar-logo {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
}
.sidebar-logo .logo-icon {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
}
.sidebar-logo .logo-text {
    font-weight: 800; font-size: .95rem;
}
.sidebar-nav { padding: 12px 10px; flex: 1; }
.sidebar-nav .nav-section {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-dim);
    padding: 16px 10px 6px;
}
.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}
.sidebar-nav .nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
    text-decoration: none;
}
.sidebar-nav .nav-item.active {
    background: var(--primary-light);
    color: var(--accent);
}
.sidebar-nav .nav-item svg {
    width: 18px; height: 18px; flex-shrink: 0;
    stroke: currentColor; fill: none;
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    font-size: .8rem;
    color: var(--text-dim);
}

/* ===== Header ===== */
.header {
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: var(--header-height);
}
.header-title {
    font-size: 1.05rem;
    font-weight: 700;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== Main Content ===== */
.main-content {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(100vh - var(--header-height));
}

/* ===== Cards ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.card-title {
    font-size: .9rem;
    font-weight: 700;
}
.card-body {
    padding: 20px;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
}
.stat-label {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-dim);
    margin-bottom: 6px;
}
.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.2;
}
.stat-sub {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
    font-family: inherit;
    line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #1a1d27; }
.btn-outline { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--text-muted); color: var(--text); }
.btn-ghost { background: transparent; color: var(--accent); padding: 4px 8px; }
.btn-ghost:hover { background: var(--primary-light); }
.btn-sm { padding: 5px 10px; font-size: .78rem; }
.btn-lg { padding: 12px 24px; font-size: .95rem; }
.btn-icon { padding: 8px; }
.w-full { width: 100%; justify-content: center; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .9rem;
    font-family: inherit;
    transition: border .2s;
}
.form-control:focus { outline: none; border-color: var(--primary); }
.form-control::placeholder { color: var(--text-dim); }
textarea.form-control { min-height: 80px; resize: vertical; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-hint { font-size: .75rem; color: var(--text-dim); margin-top: 4px; }

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.alert-info { background: var(--info-bg); color: #60a5fa; border: 1px solid rgba(59,130,246,.2); }
.alert-success { background: var(--success-bg); color: #4ade80; border: 1px solid rgba(34,197,94,.2); }
.alert-danger { background: var(--danger-bg); color: #f87171; border: 1px solid rgba(239,68,68,.2); }
.alert-warning { background: var(--warning-bg); color: #fbbf24; border: 1px solid rgba(245,158,11,.2); }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tr:hover td { background: var(--surface-hover); }
tr:last-child td { border-bottom: none; }

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-available { background: var(--success-bg); color: var(--success); }
.badge-sold { background: var(--danger-bg); color: var(--danger); }
.badge-exhibition { background: var(--info-bg); color: var(--info); }
.badge-reserved { background: var(--warning-bg); color: var(--warning); }

/* ===== Artwork Grid ===== */
.artwork-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.artwork-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
}
.artwork-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.artwork-card-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg);
}
.artwork-card-body {
    padding: 14px;
}
.artwork-card-title {
    font-size: .9rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.artwork-card-meta {
    font-size: .78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===== Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 1000;
    backdrop-filter: blur(4px);
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.modal-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    transition: all .15s;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== Upload Area ===== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
}
.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.upload-area svg { margin-bottom: 12px; color: var(--text-muted); }
.upload-area p { color: var(--text-muted); font-size: .9rem; }
.upload-area .upload-hint { font-size: .78rem; color: var(--text-dim); margin-top: 6px; }

/* ===== Image Preview Grid ===== */
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 16px;
}
.image-preview-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1;
}
.image-preview-item img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.image-preview-item .remove-btn {
    position: absolute;
    top: 4px; right: 4px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: rgba(0,0,0,.7);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: .75rem;
    display: flex; align-items: center; justify-content: center;
}

/* ===== Tags ===== */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--surface-hover);
    border-radius: 20px;
    font-size: .78rem;
    color: var(--text-muted);
}
.tag-remove {
    cursor: pointer;
    color: var(--text-dim);
    font-size: .85rem;
    line-height: 1;
}
.tag-remove:hover { color: var(--danger); }

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}
.tab {
    padding: 10px 18px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all .15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Loading Spinner ===== */
.spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15,17,23,.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    z-index: 10;
}

/* ===== Chip Select ===== */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: .82rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}
.chip:hover { border-color: var(--primary); color: var(--text); }
.chip.selected { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== Utility ===== */
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-sm { font-size: .82rem; }
.text-xs { font-size: .75rem; }
.fw-700 { font-weight: 700; }
.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; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .app-layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .form-row { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .artwork-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
