:root {
    --bg: #06112b;
    --bg-soft: #0d1c46;
    --panel: #102354;
    --accent: #00b7ff;
    --accent-2: #4cc9ff;
    --text: #e9f4ff;
    --muted: #a5bdd8;
    --ok: #1ed2a4;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Exo 2', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 15%, #1f3f9a66, transparent 36%),
        radial-gradient(circle at 80% 20%, #00b7ff44, transparent 32%),
        linear-gradient(145deg, var(--bg) 0%, #040917 100%);
    min-height: 100vh;
}

.container { width: min(1120px, 92%); margin: 0 auto; }

.topbar { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(8px); background: #050e2390; border-bottom: 1px solid #31539a55; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; }
.brand { color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: 0.4px; font-size: 1.15rem; }
.nav { display: flex; gap: 20px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.nav a:hover { color: var(--accent-2); }

.hero { padding: 74px 0 34px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 24px; align-items: stretch; }
.eyebrow { color: var(--accent-2); text-transform: uppercase; letter-spacing: 1.2px; font-size: 0.82rem; font-weight: 700; }
h1 { margin: 10px 0 14px; font-size: clamp(2rem, 5vw, 3.35rem); line-height: 1.08; }
.hero-text { margin: 0 0 24px; color: var(--muted); font-size: 1.05rem; max-width: 650px; }
.hero-panel { background: linear-gradient(175deg, #142f6ecc 0%, #0a1738cc 100%); border: 1px solid #4f81e666; border-radius: 18px; padding: 24px; box-shadow: 0 14px 34px #00000055; }
.hero-panel p { margin: 0; color: var(--accent-2); font-weight: 700; }
.hero-panel h3 { margin: 12px 0; }
.hero-panel ul { margin: 0; padding-left: 20px; color: var(--muted); }
.hero-panel li { margin: 8px 0; }

.btn { display: inline-block; background: linear-gradient(90deg, var(--accent), #46d5ff); color: #022344; text-decoration: none; font-weight: 800; padding: 12px 20px; border-radius: 12px; box-shadow: 0 12px 22px #00b7ff44; }
.btn:hover { filter: brightness(1.05); }

.section { padding: 26px 0 52px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head a { color: var(--accent-2); text-decoration: none; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.card { background: linear-gradient(180deg, #11255acc 0%, #0b1738cc 100%); border: 1px solid #4d79cc5a; border-radius: 16px; overflow: hidden; box-shadow: 0 9px 26px #00000050; }
.card img { width: 100%; height: 182px; object-fit: cover; }
.card-body { padding: 14px; }
.card h3 { margin: 0 0 6px; font-size: 1.08rem; }
.card p { margin: 0; color: var(--muted); }
.card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.card-meta span { font-weight: 800; color: #dff9ff; }
.card-meta a { color: var(--accent-2); text-decoration: none; font-weight: 600; }

.product-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.product-image { width: 100%; border-radius: 16px; border: 1px solid #4d79cc5a; }
.product-details { padding-left: 18px; color: var(--muted); }
.product-details li { margin: 8px 0; }

.muted { color: var(--muted); }
.footer { border-top: 1px solid #31539a55; padding: 22px 0 28px; color: var(--muted); }

@media (max-width: 920px) {
    .hero-grid, .product-layout { grid-template-columns: 1fr; }
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    .topbar-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
    .cards { grid-template-columns: 1fr; }
}

.cart-list { display: grid; gap: 14px; }
.cart-item { display: grid; grid-template-columns: 160px 1fr auto; gap: 14px; align-items: center; background: linear-gradient(180deg, #11255acc 0%, #0b1738cc 100%); border: 1px solid #4d79cc5a; border-radius: 14px; padding: 12px; }
.cart-item img { width: 160px; height: 95px; object-fit: cover; border-radius: 10px; }
.cart-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cart-actions button { background: #15377f; color: #e9f4ff; border: 1px solid #4d79cc5a; border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.cart-actions .danger { background: #5b1f3c; }
.checkout-box { margin-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.checkout-row { display: flex; gap: 10px; align-items: center; }
.ghost { background: transparent; color: var(--muted); border: 1px solid #4d79cc5a; border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.checkout-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
.checkout-form { display: grid; gap: 12px; max-width: 460px; }
.checkout-form label { display: grid; gap: 6px; color: var(--muted); }
.checkout-form input { background: #0d1c46; border: 1px solid #4d79cc5a; border-radius: 10px; color: #e9f4ff; padding: 10px; }
.order-box { background: linear-gradient(180deg, #11255acc 0%, #0b1738cc 100%); border: 1px solid #4d79cc5a; border-radius: 14px; padding: 14px; height: fit-content; }
.ok { color: var(--ok); }

@media (max-width: 920px) {
    .cart-item { grid-template-columns: 1fr; }
    .cart-item img { width: 100%; height: 180px; }
    .checkout-layout { grid-template-columns: 1fr; }
}

.user-chip {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #4d79cc5a;
    color: #d8ebff;
    font-size: 0.9rem;
}

.admin-box, .admin-item {
    background: linear-gradient(180deg, #11255acc 0%, #0b1738cc 100%);
    border: 1px solid #4d79cc5a;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 14px;
}

.admin-form {
    display: grid;
    gap: 10px;
}

.admin-form input,
.admin-form textarea {
    background: #0d1c46;
    border: 1px solid #4d79cc5a;
    border-radius: 10px;
    color: #e9f4ff;
    padding: 10px;
    width: 100%;
}

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

.admin-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.admin-list {
    margin-top: 16px;
}

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

.orders-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.orders-table th,
.orders-table td {
    border-bottom: 1px solid #2f4f8f66;
    padding: 10px;
    text-align: left;
    color: #dbeaff;
}

.orders-table th {
    color: #9fc4ff;
    font-weight: 700;
}

.orders-table select {
    background: #0d1c46;
    border: 1px solid #4d79cc5a;
    border-radius: 8px;
    color: #e9f4ff;
    padding: 6px 8px;
}

.admin-shell {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 18px;
    align-items: start;
}

.admin-sidebar {
    position: sticky;
    top: 90px;
    background: linear-gradient(180deg, #0b1738 0%, #09122e 100%);
    border: 1px solid #31539a66;
    border-radius: 14px;
    padding: 14px;
}

.admin-sidebar h2 {
    margin: 0 0 12px;
    font-size: 1.1rem;
    color: #cfe7ff;
}

.admin-link {
    display: block;
    color: #9fc4ff;
    text-decoration: none;
    background: #0f204b;
    border: 1px solid #31539a66;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.admin-link:hover {
    color: #dff3ff;
    border-color: #5a8cff99;
}

.admin-main {
    display: grid;
    gap: 16px;
}

.admin-panel {
    background: linear-gradient(180deg, #11255acc 0%, #0b1738cc 100%);
    border: 1px solid #4d79cc5a;
    border-radius: 14px;
    padding: 16px;
}

.admin-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.admin-topline h1 {
    margin: 0;
    font-size: 1.6rem;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.stat-card {
    background: #0f204b;
    border: 1px solid #31539a66;
    border-radius: 12px;
    padding: 12px;
    display: grid;
    gap: 4px;
}

.stat-card strong {
    font-size: 1.4rem;
}

.stat-card span {
    color: #9fc4ff;
    font-size: 0.9rem;
}

@media (max-width: 980px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
    }

    .admin-stats {
        grid-template-columns: 1fr;
    }
}

.admin-link.active {
    color: #ffffff;
    border-color: #6aa7ff;
    box-shadow: inset 0 0 0 1px #6aa7ff55;
}

.admin-collapsible {
    border: 1px solid #31539a66;
    border-radius: 12px;
    background: #0f204b;
    margin-top: 10px;
}

.admin-collapsible > summary {
    list-style: none;
}

.admin-collapsible > summary::-webkit-details-marker {
    display: none;
}

.admin-summary {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.admin-collapsible-body {
    padding: 14px;
    border-top: 1px solid #31539a66;
}

.admin-products-table .editor-row {
    padding: 0;
    border-bottom: 1px solid #2f4f8f66;
}

.admin-summary-link {
    display: block;
    cursor: pointer;
    color: #9fc4ff;
    padding: 10px 12px;
    text-decoration: none;
}

.admin-summary-link:hover {
    color: #dff3ff;
}

.row-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.row-actions .ghost,
.row-actions a.ghost {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

/* DLE-like Admin Theme */
body.admin-dle {
    background: #e9edf2;
    color: #2f3d4a;
}

body.admin-dle .topbar {
    background: #3f6f9f;
    border-bottom: 1px solid #355f88;
    backdrop-filter: none;
}

body.admin-dle .brand,
body.admin-dle .nav a,
body.admin-dle .user-chip {
    color: #f2f7fc;
}

body.admin-dle .user-chip {
    border-color: #7ea4c7;
    background: #4f7eac;
}

body.admin-dle .section {
    padding-top: 20px;
}

body.admin-dle .admin-shell {
    grid-template-columns: 230px 1fr;
    gap: 14px;
}

body.admin-dle .admin-sidebar {
    background: #f7f9fc;
    border: 1px solid #d5dde7;
    border-radius: 4px;
    top: 70px;
    padding: 0;
    overflow: hidden;
}

body.admin-dle .admin-sidebar h2 {
    margin: 0;
    padding: 12px 14px;
    background: linear-gradient(180deg, #3f6f9f 0%, #3a6691 100%);
    color: #ffffff;
    font-size: 1rem;
}

body.admin-dle .admin-link {
    margin: 0;
    border: 0;
    border-bottom: 1px solid #e3e8ef;
    border-radius: 0;
    background: #f7f9fc;
    color: #334e68;
    font-weight: 600;
}

body.admin-dle .admin-link:hover,
body.admin-dle .admin-link.active {
    background: #eaf1f8;
    color: #1f3c57;
    box-shadow: none;
    border-color: #d7e2ee;
}

body.admin-dle .admin-main {
    gap: 12px;
}

body.admin-dle .admin-panel,
body.admin-dle .admin-box,
body.admin-dle .admin-item,
body.admin-dle .order-box {
    background: #ffffff;
    border: 1px solid #d5dde7;
    border-radius: 4px;
    box-shadow: none;
}

body.admin-dle .admin-topline {
    border-bottom: 1px solid #e5ebf2;
    padding-bottom: 10px;
}

body.admin-dle .admin-topline h1,
body.admin-dle h3 {
    color: #2f4256;
}

body.admin-dle .muted,
body.admin-dle .stat-card span,
body.admin-dle .orders-table th {
    color: #6c7f92;
}

body.admin-dle .admin-stats {
    margin-top: 10px;
}

body.admin-dle .stat-card {
    background: #f6f9fc;
    border: 1px solid #dde5ef;
    border-radius: 4px;
}

body.admin-dle .stat-card strong {
    color: #2d4f72;
}

body.admin-dle .admin-form input,
body.admin-dle .admin-form textarea,
body.admin-dle .orders-table select,
body.admin-dle .checkout-form input {
    background: #ffffff;
    border: 1px solid #cfd9e5;
    color: #2f3d4a;
}

body.admin-dle .btn {
    background: linear-gradient(180deg, #4c7bac 0%, #3e6791 100%);
    color: #fff;
    box-shadow: none;
    border: 1px solid #365a80;
    border-radius: 4px;
}

body.admin-dle .ghost,
body.admin-dle .row-actions .ghost {
    background: #f1f5fa;
    border: 1px solid #cfd9e5;
    color: #35506c;
    border-radius: 4px;
}

body.admin-dle .orders-table th,
body.admin-dle .orders-table td {
    color: #33485d;
    border-bottom: 1px solid #e5ebf2;
}

body.admin-dle .admin-collapsible {
    border: 1px solid #d5dde7;
    border-radius: 4px;
    background: #ffffff;
}

body.admin-dle .admin-collapsible-body {
    border-top: 1px solid #e5ebf2;
}

body.admin-dle .admin-summary-link {
    color: #426a92;
}

body.admin-dle .admin-summary-link:hover {
    color: #2f557b;
}

body.admin-dle .footer {
    border-top-color: #d5dde7;
    color: #6c7f92;
}

.cards-catalog {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.card-catalog {
    max-width: 250px;
    margin: 0 auto;
}

.card-body-catalog {
    padding-bottom: 8px;
}

.card-body-catalog h3 {
    margin: 0;
    line-height: 1.25;
}

.card-clickable {
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card-clickable:hover,
.card-clickable:focus-visible {
    transform: translateY(-3px);
    border-color: #6cc8ff;
    box-shadow: 0 16px 30px #00000066, 0 0 0 1px #6cc8ff55;
}

.card-clickable:focus-visible {
    outline: none;
}

.icon-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    line-height: 1;
}

.edit-product-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 16px;
    align-items: start;
}

.edit-preview {
    background: #0f204b;
    border: 1px solid #31539a66;
    border-radius: 12px;
    padding: 12px;
}

.edit-preview img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 10px;
}

.edit-preview h3 {
    margin: 0 0 6px;
}

.edit-preview p {
    margin: 0 0 6px;
}

.edit-product-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
}

.edit-two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.edit-check {
    display: flex !important;
    align-items: center;
    gap: 8px;
    color: #d8ebff !important;
}

@media (max-width: 980px) {
    .edit-product-layout {
        grid-template-columns: 1fr;
    }

    .edit-two-cols {
        grid-template-columns: 1fr;
    }
}

.bbcode-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.bbcode-toolbar button {
    min-width: 34px;
    height: 34px;
    border: 1px solid #31539a66;
    background: #0f204b;
    color: #dff3ff;
    border-radius: 8px;
    cursor: pointer;
    padding: 0 8px;
}

.bbcode-toolbar button:hover {
    border-color: #6cc8ff;
    background: #12306a;
}

.bbcode-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}

.bbcode-toolbar button {
    min-width: 34px;
    height: 34px;
    border: 1px solid #31539a66;
    background: #0f204b;
    color: #dff3ff;
    border-radius: 8px;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
}

.bbcode-toolbar button:hover,
.bbcode-toolbar button:focus-visible {
    border-color: #6cc8ff;
    background: #12306a;
    outline: none;
}

.bb-color-wrap {
    position: relative;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #31539a66;
    border-radius: 8px;
    background: #0f204b;
    cursor: pointer;
    overflow: hidden;
}

.bb-color-wrap:hover {
    border-color: #6cc8ff;
    background: #12306a;
}

.bb-color-wrap input[type="color"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
}

.rich-editor {
    min-height: 180px;
    background: #0d1c46;
    border: 1px solid #4d79cc5a;
    border-radius: 10px;
    color: #e9f4ff;
    padding: 10px;
    line-height: 1.5;
}

.rich-editor:focus {
    outline: none;
    border-color: #6cc8ff;
    box-shadow: 0 0 0 1px #6cc8ff55;
}

.bbcode-toolbar button:focus {
    outline: none;
    box-shadow: none;
}

.bbcode-toolbar button:focus-visible {
    border-color: #6cc8ff;
    background: #12306a;
}

/* BBCode toolbar interaction fix */
.bbcode-toolbar .bbcode-btn,
.bbcode-toolbar .bbcode-btn:focus,
.bbcode-toolbar .bbcode-btn:focus-visible {
    outline: none;
    box-shadow: none;
}

.bbcode-toolbar .bbcode-btn:focus,
.bbcode-toolbar .bbcode-btn:focus-visible {
    border-color: #31539a66;
    background: #0f204b;
}

.bbcode-toolbar .bbcode-btn:hover {
    border-color: #6cc8ff;
    background: #12306a;
}

.bbcode-toolbar .bbcode-btn > * {
    pointer-events: none;
}
/* Final fixes: no sticky highlight + larger description area */
.bbcode-toolbar .bbcode-btn:focus,
.bbcode-toolbar .bbcode-btn:focus-visible,
.bbcode-toolbar .bbcode-btn:active {
    border-color: #31539a66 !important;
    background: #0f204b !important;
    box-shadow: none !important;
    outline: none !important;
}

.bbcode-toolbar .bbcode-btn:hover {
    border-color: #6cc8ff !important;
    background: #12306a !important;
}

.rich-editor {
    display: block;
    min-height: 220px !important;
    height: 220px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
/* Strict toolbar hover behavior */
.bbcode-toolbar .bbcode-btn {
    transition: border-color .12s ease, background-color .12s ease;
}

.bbcode-toolbar .bbcode-btn:not(:hover) {
    border-color: #31539a66 !important;
    background: #0f204b !important;
}

.bbcode-toolbar {
    position: relative;
    z-index: 2;
}

.rich-editor {
    position: relative;
    z-index: 1;
    margin-top: 6px;
}
/* Deterministic toolbar states (no browser pseudo auto-highlight) */
.bbcode-toolbar .bbcode-btn,
.bbcode-toolbar .bbcode-btn:hover,
.bbcode-toolbar .bbcode-btn:focus,
.bbcode-toolbar .bbcode-btn:focus-visible,
.bbcode-toolbar .bbcode-btn:active {
    border-color: #31539a66 !important;
    background: #0f204b !important;
    box-shadow: none !important;
    outline: none !important;
}

.bbcode-toolbar .bbcode-btn.is-hover {
    border-color: #6cc8ff !important;
    background: #12306a !important;
}