﻿:root {
    --surface: #ffffff;
    --surface-alt: #f2f4f9;
    --surface-card: #ffffff;
    --border: #e1e6f0;
    --border-strong: #ccd4e3;
    --text: #1f2a3d;
    --muted: #5f6c7b;
    --primary: #1b6dc1;
    --primary-dark: #0f447d;
    --accent: #3ac291;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --shadow-soft: 0 26px 52px rgba(15, 23, 42, 0.12);
}

body.theme-dark {
    --surface: #0f172a;
    --surface-alt: #0b1322;
    --surface-card: #121c30;
    --border: #1f2a3d;
    --border-strong: #2c3b53;
    --text: #e7ecf6;
    --muted: #96a2b5;
    --primary: #6ea8ff;
    --primary-dark: #99c5ff;
    --accent: #4fd4a3;
}

* {
    box-sizing: border-box;
}

body.admin-shell {
    margin: 0;
    min-height: 100vh;
    font-family: "Outfit", Arial, sans-serif;
    background: var(--surface-alt);
    color: var(--text);
    transition: background 0.4s ease, color 0.4s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.btn {
    border: none;
    border-radius: 999px;
    padding: 0.65rem 1.35rem;
    min-height: 44px;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn:focus-visible {
    outline: 3px solid rgba(27, 109, 193, 0.35);
    outline-offset: 3px;
}

.btn--primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 18px 42px rgba(27, 109, 193, 0.35);
}

.btn--ghost {
    background: var(--surface);
    color: var(--text);
    border: 1px solid rgba(95, 108, 123, 0.25);
}

body.theme-dark .btn--ghost {
    background: rgba(15, 23, 42, 0.65);
    border-color: rgba(150, 162, 181, 0.26);
    color: var(--text);
}

.btn--outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 0.55rem 1rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
}

.btn--active {
    border-color: var(--primary);
    box-shadow: 0 16px 32px rgba(27, 109, 193, 0.24);
    background: rgba(27, 109, 193, 0.12);
    color: var(--primary);
}

body.theme-dark .btn--active {
    background: rgba(110, 168, 255, 0.16);
    box-shadow: 0 16px 32px rgba(110, 168, 255, 0.24);
    border-color: rgba(110, 168, 255, 0.45);
}

.btn-icon {
    display: inline-flex;
    width: 1.2rem;
    height: 1.2rem;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    width: 100%;
    height: 100%;
}

.btn-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.admin-appbar {
    background: linear-gradient(135deg, #2f76d0, #0f2d63);
    color: #fff;
    padding: 1.75rem 2.25rem 2.75rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
}

.admin-appbar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 55%);
    pointer-events: none;
}

.appbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.brand-logo {
    width: 3rem;
    height: 3rem;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.25);
    font-weight: 700;
    font-size: 1.4rem;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.brand-title {
    font-weight: 700;
    font-size: 1.45rem;
}

.brand-subtitle {
    opacity: 0.75;
    font-size: 0.95rem;
}

.appbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
}

.admin-appbar .btn--ghost {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.45);
    color: #fff;
}

.admin-appbar .btn--ghost:hover {
    background: rgba(255, 255, 255, 0.24);
}

.admin-main {
    max-width: 1240px;
    margin: 0 auto 4rem;
    padding: 2.5rem 1.75rem 0;
    display: grid;
    gap: 2rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.summary-card {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 1.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    transition: background 0.35s ease, color 0.35s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 34px 60px rgba(15, 23, 42, 0.15);
}

.summary-label {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.summary-value {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 700;
}

.summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(27, 109, 193, 0.12);
    color: var(--primary);
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    font-weight: 600;
    font-size: 0.85rem;
}

.summary-pill--muted {
    background: rgba(95, 108, 123, 0.12);
    color: var(--muted);
}

.workspace {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 320px;
    gap: 1.5rem;
    align-items: start;
}

.panel {
    background: var(--surface-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transition: background 0.35s ease, color 0.35s ease, border-color 0.35s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

.panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 32px 58px rgba(15, 23, 42, 0.18);
}

.panel-header {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.panel-kicker {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    color: var(--muted);
}

.panel-description {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.chip-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip-cloud + .new-category {
    margin-top: 0.5rem;
}

.chip {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    background: var(--surface-alt);
    color: var(--text);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border 0.2s ease;
}

.chip:hover {
    border-color: var(--primary);
}

.chip--active {
    background: rgba(27, 109, 193, 0.16);
    color: var(--primary);
    border-color: var(--primary);
}

.new-category {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-alt);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    width: 100%;
    max-width: 320px;
    margin: 0.75rem auto 0;
}

.new-category > * {
    width: 100%;
}

.new-category input {
    flex: 1;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    padding: 0.55rem 0.75rem;
    font: inherit;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.theme-dark .new-category input {
    background: rgba(15, 23, 42, 0.55);
    color: var(--text);
}

body.theme-dark .new-category {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(150, 162, 181, 0.18);
}

.new-category .btn {
    justify-content: center;
}

.new-category input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 109, 193, 0.2);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.95rem;
}

.form-field--full {
    grid-column: 1 / -1;
}

.form-field input,
.form-field textarea {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    font: inherit;
    background: var(--surface-alt);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

body.theme-dark .form-field input,
body.theme-dark .form-field textarea {
    background: rgba(15, 23, 42, 0.55);
    color: var(--text);
}

.form-field input:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 109, 193, 0.2);
}

.status-badge {
    align-self: flex-start;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: rgba(58, 194, 145, 0.16);
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
}

.status-badge--edit {
    background: rgba(255, 184, 77, 0.18);
    color: #d98217;
}

.form-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    margin-top: 0.75rem;
}

.footer-left,
.footer-right {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
}

.footer-left .btn,
.footer-right .btn {
    min-width: 200px;
    justify-content: center;
}

.form-feedback {
    margin: 0;
    color: var(--primary);
    font-size: 0.9rem;
}

.preview-snapshot {
    background: var(--surface-alt);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: grid;
    gap: 0.85rem;
}

.preview-image {
    border-radius: var(--radius-md);
    background: rgba(27, 109, 193, 0.08);
    min-height: 190px;
    display: grid;
    place-items: center;
    overflow: hidden;
}

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

.preview-placeholder {
    color: var(--muted);
    font-weight: 500;
}

.preview-category {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.preview-tags {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.preview-tags li {
    background: rgba(27, 109, 193, 0.16);
    color: var(--primary);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
}

.preview-price {
    margin: 0;
    font-weight: 600;
    color: var(--primary-dark);
}

.panel--table {
    gap: 1rem;
}

.table-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.table-search input {
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: 0.55rem 1.1rem;
    min-width: 240px;
    font: inherit;
    background: var(--surface);
}

body.theme-dark .table-search input {
    background: rgba(15, 23, 42, 0.55);
    color: var(--text);
}

.table-buttons {
    display: flex;
    gap: 0.5rem;
}

.table-meta {
    font-size: 0.9rem;
    color: var(--muted);
}

.table-container {
    max-height: 420px;
    overflow: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.product-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}

.product-table thead th {
    position: sticky;
    top: 0;
    background: var(--surface-alt);
    z-index: 1;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

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

.table-empty {
    text-align: center;
    color: var(--muted);
    padding: 2rem 0;
}

.row-product {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.row-product img {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: rgba(27, 109, 193, 0.1);
}

.row-product-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.row-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.col-actions {
    width: 120px;
}

.row-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    border: none;
    background: var(--surface-alt);
    padding: 0.45rem 0.55rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: rgba(27, 109, 193, 0.16);
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 16px 28px rgba(27, 109, 193, 0.18);
}

.action-btn svg {
    width: 1.05rem;
    height: 1.05rem;
}

.action-btn--danger {
    color: #d92c2c;
}

.action-btn--edit {
    color: var(--primary);
}

body.theme-dark .action-btn--edit {
    color: var(--primary-dark);
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--primary);
    color: #fff;
    padding: 0.85rem 1.35rem;
    border-radius: var(--radius-md);
    box-shadow: 0 22px 48px rgba(27, 109, 193, 0.35);
    transform: translateY(16px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast--visible {
    transform: translateY(0);
    opacity: 1;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.theme-dark .admin-appbar {
    background: linear-gradient(135deg, #1e3a8a, #0f172a);
}

body.theme-dark .panel,
body.theme-dark .summary-card {
    box-shadow: 0 26px 48px rgba(3, 7, 18, 0.55);
}

body.theme-dark .btn--primary {
    background: var(--primary);
    box-shadow: 0 20px 44px rgba(110, 168, 255, 0.35);
}

body.theme-dark .summary-pill--muted {
    background: rgba(150, 162, 181, 0.16);
    color: rgba(231, 236, 246, 0.85);
}

@media (max-width: 1080px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .panel--form {
        order: 0;
    }

    .panel--categories,
    .panel--preview {
        order: 1;
    }
}

@media (max-width: 720px) {
    .admin-appbar {
        padding-bottom: 3rem;
    }

    .appbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .table-search input {
        min-width: 200px;
    }

    .product-table {
        min-width: 520px;
    }
}
