@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;600;700&display=swap');

:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #0f172a;
    --primary: #0ea5e9;
    --danger: #dc2626;
    --radius: 12px;
    --shadow: 0 8px 24px rgba(2, 6, 23, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: 'Barlow', sans-serif;
    color: var(--text);
    background: var(--bg);
}

h1,
h2 {
    margin-top: 0;
}

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

.toolbar {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.product-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.product-card img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    background: #e2e8f0;
}

.no-image {
    width: 100%;
    height: 170px;
    background: #e2e8f0;
    display: grid;
    place-items: center;
    color: #334155;
    font-weight: 600;
}

.card-body {
    padding: 0.8rem;
}

.price {
    color: #0369a1;
    font-weight: 700;
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    display: inline-block;
}

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

.btn-home {
    background: #0f766e;
}

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table th,
.table td {
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    padding: 0.6rem;
}

.actions {
    display: flex;
    gap: 0.4rem;
}

.form-grid {
    display: grid;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.input {
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}

.input.invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}

.disabled-field {
    background: #e2e8f0;
    color: #475569;
    cursor: not-allowed;
}

.inline-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.details-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.main-image {
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.main-image.clickable {
    cursor: zoom-in;
}

.thumb-row {
    margin-top: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.thumb-btn {
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    background: transparent;
}

.thumb-btn img {
    width: 76px;
    height: 76px;
    object-fit: cover;
    border-radius: 6px;
}

.thumb-btn.selected {
    border-color: var(--primary);
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: grid;
    place-items: center;
    z-index: 1000;
}

.lightbox-image {
    max-width: min(92vw, 1400px);
    max-height: 88vh;
    border-radius: 10px;
    cursor: zoom-out;
}

.lightbox-close,
.lightbox-arrow {
    position: fixed;
    border: none;
    color: #fff;
    background: rgba(15, 23, 42, 0.6);
    cursor: pointer;
}

.lightbox-close {
    top: 1rem;
    right: 1rem;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    font-size: 1.1rem;
}

.lightbox-arrow {
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 64px;
    border-radius: 10px;
    font-size: 2rem;
    line-height: 1;
}

.lightbox-arrow.left {
    left: 1rem;
}

.lightbox-arrow.right {
    right: 1rem;
}

.error {
    color: var(--danger);
}

.history-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.history-summary-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.9rem;
}

.history-summary-title {
    margin: 0;
    color: #475569;
    font-size: 0.9rem;
}

.history-summary-value {
    margin: 0.35rem 0 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #0c4a6e;
}

.history-table-wrap {
    overflow-x: auto;
}

.history-table td,
.history-table th {
    white-space: nowrap;
}

.selected-product-preview {
    background: var(--surface);
    border: 1px solid #dbeafe;
    border-radius: 10px;
    padding: 0.75rem;
    margin-top: 0.4rem;
    box-shadow: 0 4px 14px rgba(2, 6, 23, 0.06);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.selected-product-meta {
    flex: 1 1 auto;
}

.selected-product-meta p {
    margin: 0 0 0.5rem;
}

.selected-product-description {
    white-space: pre-wrap;
    word-break: break-word;
}

.selected-product-image-wrap { flex: 0 0 auto; }

.preview-image {
    width: auto;
    max-width: min(320px, 100%);
    max-height: 300px;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
}

.selected-product-image-wrap {
    display: flex;
    justify-content: flex-end;
}

.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-ok {
    background: #dcfce7;
    color: #166534;
}

.status-reserved {
    background: #fef9c3;
    color: #854d0e;
}

.status-sold {
    background: #fee2e2;
    color: #991b1b;
}

.status-unknown {
    background: #e2e8f0;
    color: #334155;
}

@media (max-width: 900px) {
    .details-layout {
        grid-template-columns: 1fr;
    }
}
