/* =====================================================
   PANEL ADMINISTRATORA — equadorsklep
   ===================================================== */

/* ─── OVERLAY ─────────────────────────────────────── */
#admin-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(5, 6, 7, 0.97);
    display: flex;
    flex-direction: column;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: #e0e0e0;
    overflow: hidden;
}

/* ─── TOPBAR ──────────────────────────────────────── */
#admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 60px;
    background: #111418;
    border-bottom: 1px solid #1e2328;
    flex-shrink: 0;
}

#admin-topbar .admin-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
}

#admin-topbar .admin-title .badge {
    background: #ff6a00;
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 50px;
    letter-spacing: 0.08em;
}

#admin-close {
    background: none;
    border: 1px solid #2a2e35;
    color: #aaa;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
#admin-close:hover {
    border-color: #ff6a00;
    color: #ff6a00;
}

/* ─── TABS ────────────────────────────────────────── */
#admin-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 24px 0;
    background: #111418;
    border-bottom: 1px solid #1e2328;
    flex-shrink: 0;
}

.admin-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    color: #888;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-family: inherit;
}
.admin-tab:hover { color: #ccc; }
.admin-tab.active {
    color: #ff6a00;
    border-bottom-color: #ff6a00;
}

/* ─── BODY ────────────────────────────────────────── */
#admin-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ─── TAB PANELS ──────────────────────────────────── */
.admin-panel { display: none; }
.admin-panel.active { display: block; }

/* ─── PANEL HEADER ────────────────────────────────── */
.admin-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.admin-panel-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

/* ─── BUTTONS ─────────────────────────────────────── */
.admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s;
}

.admin-btn-primary {
    background: #ff6a00;
    color: #fff;
}
.admin-btn-primary:hover { background: #e55f00; }

.admin-btn-outline {
    background: none;
    border: 1px solid #2a2e35;
    color: #bbb;
}
.admin-btn-outline:hover { border-color: #ff6a00; color: #ff6a00; }

.admin-btn-danger {
    background: none;
    border: 1px solid #4a1010;
    color: #e05050;
}
.admin-btn-danger:hover { background: #e05050; color: #fff; }

.admin-btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

/* ─── PRODUCT LIST ────────────────────────────────── */
.admin-product-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-product-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: #111418;
    border: 1px solid #1e2328;
    border-radius: 10px;
    transition: border-color 0.2s;
}
.admin-product-item:hover { border-color: #2a2e35; }

.admin-product-thumb {
    width: 56px;
    height: 42px;
    object-fit: contain;
    border-radius: 6px;
    background: #0d1014;
    flex-shrink: 0;
}

.admin-product-info {
    flex: 1;
    min-width: 0;
}

.admin-product-info strong {
    display: block;
    color: #fff;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-product-info span {
    font-size: 0.8rem;
    color: #888;
}

.admin-product-price {
    font-weight: 700;
    color: #ff6a00;
    font-size: 0.9rem;
    white-space: nowrap;
    margin-right: 8px;
}

.admin-product-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ─── FORM ────────────────────────────────────────── */
#admin-product-form-wrap {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(5, 6, 7, 0.96);
    overflow-y: auto;
    padding: 24px;
}

#admin-product-form-wrap.open { display: block; }

.admin-form-container {
    max-width: 760px;
    margin: 0 auto;
    background: #111418;
    border: 1px solid #1e2328;
    border-radius: 14px;
    padding: 28px;
}

.admin-form-container h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid #1e2328;
}

.admin-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.admin-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

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

.admin-form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.admin-form-group input,
.admin-form-group select,
.admin-form-group textarea {
    background: #0d1014;
    border: 1px solid #1e2328;
    border-radius: 8px;
    color: #e0e0e0;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.admin-form-group input:focus,
.admin-form-group select:focus,
.admin-form-group textarea:focus {
    outline: none;
    border-color: #ff6a00;
}

.admin-form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

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

/* ─── SPECS / EQUIPMENT ───────────────────────────── */
.admin-kvlist,
.admin-strlist {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.admin-kv-row {
    display: grid;
    grid-template-columns: 1fr 1fr 32px;
    gap: 8px;
    align-items: center;
}

.admin-str-row {
    display: grid;
    grid-template-columns: 1fr 32px;
    gap: 8px;
    align-items: center;
}

.admin-kv-row input,
.admin-str-row input {
    background: #0d1014;
    border: 1px solid #1e2328;
    border-radius: 6px;
    color: #e0e0e0;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

.admin-kv-row input:focus,
.admin-str-row input:focus {
    outline: none;
    border-color: #ff6a00;
}

.admin-row-del {
    background: none;
    border: 1px solid #3a1515;
    color: #e05050;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
.admin-row-del:hover { background: #e05050; color: #fff; border-color: #e05050; }

/* ─── IMAGE UPLOAD ────────────────────────────────── */
.admin-images-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.admin-img-thumb {
    position: relative;
    width: 90px;
    height: 70px;
    border-radius: 8px;
    border: 2px solid #1e2328;
    overflow: hidden;
    background: #0d1014;
    cursor: pointer;
    transition: border-color 0.2s;
}

.admin-img-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.admin-img-thumb.main-img {
    border-color: #ff6a00;
}

.admin-img-thumb .main-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ff6a00;
    color: #fff;
    font-size: 0.6rem;
    text-align: center;
    padding: 2px;
    font-weight: 700;
    text-transform: uppercase;
}

.admin-img-thumb .del-img {
    position: absolute;
    top: 3px;
    right: 3px;
    background: rgba(0,0,0,0.7);
    border: none;
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
}
.admin-img-thumb:hover .del-img { opacity: 1; }

.admin-upload-box {
    width: 90px;
    height: 70px;
    border: 2px dashed #2a2e35;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #555;
    font-size: 0.7rem;
    transition: all 0.2s;
    position: relative;
}
.admin-upload-box:hover { border-color: #ff6a00; color: #ff6a00; }
.admin-upload-box input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.admin-upload-box .upload-icon { font-size: 1.4rem; margin-bottom: 2px; }

.admin-uploading {
    font-size: 0.75rem;
    color: #ff6a00;
    margin-top: 4px;
}

/* ─── FORM ACTIONS ────────────────────────────────── */
.admin-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #1e2328;
}

/* ─── SECTION LABEL ───────────────────────────────── */
.admin-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #ff6a00;
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #1e2328;
}

.admin-section-label:first-child { margin-top: 0; }

/* ─── CONTENT GRID ────────────────────────────────── */
.admin-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.admin-content-grid .admin-form-group.full {
    grid-column: 1 / -1;
}

/* ─── TOAST ───────────────────────────────────────── */
#admin-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-toast {
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    animation: toastIn 0.3s ease;
    max-width: 340px;
}

.admin-toast.success { background: #1a4a1a; border: 1px solid #2a7a2a; }
.admin-toast.error { background: #4a1010; border: 1px solid #7a2a2a; }
.admin-toast.info { background: #1a3060; border: 1px solid #2a50a0; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ─── LOADER ──────────────────────────────────────── */
.admin-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── EMPTY STATE ─────────────────────────────────── */
.admin-empty {
    text-align: center;
    padding: 48px 24px;
    color: #555;
}
.admin-empty .icon { font-size: 2.5rem; margin-bottom: 12px; }

/* ─── CATEGORY BADGE ──────────────────────────────── */
.admin-cat-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 50px;
    font-weight: 700;
    text-transform: uppercase;
}
.admin-cat-badge.quady { background: rgba(255,106,0,0.15); color: #ff6a00; }
.admin-cat-badge.akcesoria { background: rgba(100,180,255,0.12); color: #60b0ff; }
.admin-cat-badge.crossy { background: rgba(120,220,120,0.12); color: #50c878; }
.admin-cat-badge.straz { background: rgba(229,62,62,0.15); color: #e53e3e; }

/* ─── CONTENT SUB-TABS ────────────────────────────── */
.admin-content-subtabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #1e2328;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
}
.admin-content-subtabs::-webkit-scrollbar { display: none; }

.admin-ctab {
    padding: 8px 14px;
    border: none;
    background: none;
    color: #666;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
}
.admin-ctab:hover { color: #ccc; }
.admin-ctab.active { color: #ff6a00; border-bottom-color: #ff6a00; }

/* ─── CONTENT SUB-PANELS ──────────────────────────── */
.admin-cpanel { display: none; }
.admin-cpanel.active { display: block; }

/* ─── DYNAMIC ROW EDITORS ─────────────────────────── */
.admin-dynamic-row {
    background: #0d1014;
    border: 1px solid #1e2328;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
}

.admin-dynamic-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #1e2328;
}

.admin-dynamic-row-num {
    font-size: 0.82rem;
    font-weight: 600;
    color: #888;
}
.admin-dynamic-row-num strong { color: #e0e0e0; }

.admin-dynamic-row .admin-row-del {
    width: auto;
    height: auto;
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 6px;
}

/* ─── PRODUCT PICKER ──────────────────────────────── */
.admin-picker-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 320px;
    overflow-y: auto;
    background: #0d1014;
    border: 1px solid #1e2328;
    border-radius: 10px;
    padding: 8px;
}

.admin-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s;
    user-select: none;
}
.admin-picker-item:hover { background: #111418; }
.admin-picker-item:has(input:checked) {
    background: rgba(255, 106, 0, 0.08);
    border-color: rgba(255, 106, 0, 0.2);
}
.admin-picker-item input[type="checkbox"] {
    accent-color: #ff6a00;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}
.admin-picker-thumb {
    width: 50px;
    height: 38px;
    object-fit: contain;
    border-radius: 4px;
    background: #0a0c0e;
    flex-shrink: 0;
}
.admin-picker-name {
    flex: 1;
    font-size: 0.875rem;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.admin-picker-price {
    font-size: 0.8rem;
    color: #ff6a00;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ─── SEO PANEL ───────────────────────────────────── */
.admin-seo-cpanel { display: none; }
.admin-seo-cpanel.active { display: block; }

.seo-page-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.seo-page-file {
    display: inline-block;
    background: #101820;
    border: 1px solid #1a3050;
    color: #5090d0;
    font-size: 0.78rem;
    font-family: 'Courier New', monospace;
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 600;
}

.seo-badge-note {
    font-size: 0.75rem;
    color: #666;
    font-style: italic;
}

.seo-hint {
    font-weight: 400;
    color: #555;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.75rem;
}

.seo-section-hint {
    font-weight: 400;
    color: #555;
    font-size: 0.72rem;
    text-transform: none;
    letter-spacing: 0;
}

.seo-field-wrap {
    position: relative;
}

.seo-char-counter {
    text-align: right;
    font-size: 0.72rem;
    color: #444;
    margin-top: 4px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: color 0.2s;
    user-select: none;
}

.seo-char-counter .seo-count { font-weight: 700; }
.seo-char-counter.warn { color: #c08020; }
.seo-char-counter.over  { color: #c04040; }

.seo-info-box {
    background: rgba(255, 106, 0, 0.05);
    border: 1px solid rgba(255, 106, 0, 0.18);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.82rem;
    color: #888;
    margin: 8px 0 16px;
    line-height: 1.55;
}

.seo-info-box strong { color: #c07030; }
.seo-info-box code {
    font-family: 'Courier New', monospace;
    font-size: 0.8em;
    background: rgba(255,255,255,0.05);
    padding: 1px 5px;
    border-radius: 3px;
    color: #5090d0;
}

/* ─── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 600px) {
    #admin-body { padding: 16px; }
    .admin-form-row { grid-template-columns: 1fr; }
    .admin-content-grid { grid-template-columns: 1fr; }
    .admin-product-price { display: none; }
    .admin-form-container { padding: 18px; }
    #admin-product-form-wrap { padding: 12px; }
}
