/* =============================================
   ADMIN PANEL — Estilos
   ============================================= */

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

:root {
    --bg:        #0a0a0a;
    --surface:   #141414;
    --surface2:  #1e1e1e;
    --surface3:  #282828;
    --border:    #2a2a2a;
    --gold:      #d4af37;
    --gold-l:    #f0d060;
    --orange:    #ff6b35;
    --red:       #ef4444;
    --green:     #22c55e;
    --blue:      #3b82f6;
    --text:      #f0f0f0;
    --text-2:    #a0a0a0;
    --text-3:    #555;
    --radius:    10px;
    --radius-sm: 6px;
    --font:      'Inter', system-ui, sans-serif;
    --sidebar-w: 240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; font-size: 14px; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a   { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; }
ul { list-style: none; }

/* =============================================
   LAYOUT
   ============================================= */
.admin-layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 50;
    transition: transform .25s ease;
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0 !important; }
}

.sidebar__logo {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 900;
    font-size: 1.1rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--gold), var(--gold-l));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar__badge {
    display: block;
    font-size: .65rem;
    letter-spacing: .06em;
    font-weight: 500;
    color: var(--text-3) !important;
    -webkit-text-fill-color: var(--text-3) !important;
    text-transform: uppercase;
    margin-top: .1rem;
}

.sidebar__nav { flex: 1; padding: 1rem 0; overflow-y: auto; }

.sidebar__section {
    padding: .25rem 1rem .1rem;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-top: .75rem;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.5rem;
    color: var(--text-2);
    font-size: .875rem;
    font-weight: 500;
    transition: color .2s, background .2s;
    border-radius: 0;
}

.sidebar__link:hover { color: var(--text); background: var(--surface2); }

.sidebar__link.active {
    color: var(--gold);
    background: rgba(212,175,55,.08);
    border-right: 2px solid var(--gold);
}

.sidebar__link i { width: 16px; text-align: center; opacity: .7; }
.sidebar__link.active i { opacity: 1; }

.sidebar__footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    font-size: .8rem;
    color: var(--text-3);
}

/* MAIN */
.admin-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* TOP BAR */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: .875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar__left { display: flex; align-items: center; gap: 1rem; }

.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.2rem;
    padding: .25rem;
}

@media (max-width: 768px) { .hamburger { display: flex; } }

.topbar__title { font-size: 1rem; font-weight: 600; }

.topbar__right { display: flex; align-items: center; gap: .75rem; }

.admin-user {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .82rem;
    color: var(--text-2);
}

.admin-user__avatar {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, var(--gold), var(--orange));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .75rem;
    color: #000;
    flex-shrink: 0;
}

/* CONTENT */
.admin-content { flex: 1; padding: 1.5rem; }

/* =============================================
   CARDS / STAT CARDS
   ============================================= */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: .875rem;
    border-bottom: 1px solid var(--border);
}

.card-title { font-size: .95rem; font-weight: 600; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 900px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    transition: border-color .2s;
}

.stat-card:hover { border-color: var(--gold); }

.stat-card__label {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-3);
}

.stat-card__value {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gold), var(--gold-l));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.stat-card__icon {
    font-size: 1.4rem;
    opacity: .3;
    margin-top: .25rem;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: .82rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .18s ease;
    white-space: nowrap;
    font-family: var(--font);
}

.btn-primary {
    background: var(--gold);
    color: #000;
}
.btn-primary:hover { background: var(--gold-l); transform: translateY(-1px); }

.btn-secondary {
    background: var(--surface2);
    border-color: var(--border);
    color: var(--text-2);
}
.btn-secondary:hover { border-color: var(--text-3); color: var(--text); }

.btn-danger {
    background: rgba(239,68,68,.12);
    border-color: rgba(239,68,68,.3);
    color: var(--red);
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-success {
    background: rgba(34,197,94,.12);
    border-color: rgba(34,197,94,.3);
    color: var(--green);
}

.btn-sm { padding: .35rem .75rem; font-size: .75rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: .9rem; }

/* =============================================
   FORMS
   ============================================= */
.form-grid { display: grid; gap: 1.25rem; }
@media (min-width: 640px) { .form-grid--2 { grid-template-columns: 1fr 1fr; } }

.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group--full { grid-column: 1 / -1; }

.form-label {
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-2);
}

.form-label span { color: var(--red); margin-left: .2rem; }

.form-input,
.form-select,
.form-textarea {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .65rem .9rem;
    color: var(--text);
    font-size: .875rem;
    font-family: var(--font);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
    width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212,175,55,.12);
}

.form-textarea { resize: vertical; min-height: 90px; }
.form-select { appearance: none; cursor: pointer; }

.form-hint { font-size: .75rem; color: var(--text-3); }
.form-error { font-size: .75rem; color: var(--red); }

.toggle-wrap { display: flex; align-items: center; gap: .75rem; }

.toggle {
    position: relative;
    width: 44px; height: 24px;
    flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle__slider {
    position: absolute;
    inset: 0;
    background: var(--surface3);
    border-radius: 12px;
    cursor: pointer;
    transition: background .2s;
}

.toggle__slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
}

.toggle input:checked + .toggle__slider { background: var(--green); }
.toggle input:checked + .toggle__slider::before { transform: translateX(20px); }

/* =============================================
   TABLE
   ============================================= */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

thead { background: var(--surface2); }

th {
    text-align: left;
    padding: .75rem 1rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-3);
    white-space: nowrap;
}

td {
    padding: .875rem 1rem;
    border-top: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:hover { background: var(--surface2); }

.td-img {
    width: 52px; height: 52px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--surface2);
}

.td-name { font-weight: 600; }
.td-actions { display: flex; align-items: center; gap: .4rem; white-space: nowrap; }

/* =============================================
   BADGES / STATUS
   ============================================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .6rem;
    border-radius: 50px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
}

.badge--active  { background: rgba(34,197,94,.12); color: var(--green); border: 1px solid rgba(34,197,94,.25); }
.badge--inactive{ background: rgba(239,68,68,.1); color: var(--red); border: 1px solid rgba(239,68,68,.2); }
.badge--gold    { background: rgba(212,175,55,.12); color: var(--gold); border: 1px solid rgba(212,175,55,.25); }

/* =============================================
   IMAGE UPLOAD ZONE
   ============================================= */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: var(--surface2);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--gold);
    background: rgba(212,175,55,.04);
}

.upload-zone__icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .3; }
.upload-zone__text { font-size: .9rem; color: var(--text-2); }
.upload-zone__hint { font-size: .78rem; color: var(--text-3); margin-top: .3rem; }
.upload-zone input[type=file] { display: none; }

.images-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: .75rem;
    margin-top: 1rem;
}

.img-preview-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface2);
    cursor: grab;
}

.img-preview-item.cover-img { border-color: var(--gold); }

.img-preview-item img {
    width: 100%; 
    aspect-ratio: 1/1;
    object-fit: cover;
    pointer-events: none;
}

.img-preview-item__actions {
    position: absolute;
    top: 0; right: 0;
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .3rem;
}

.img-preview-item__btn {
    width: 22px; height: 22px;
    border-radius: 4px;
    background: rgba(10,10,10,.85);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    color: var(--text);
    transition: background .2s;
}

.img-preview-item__btn:hover { background: var(--red); }
.img-preview-item__btn.cover-btn:hover { background: var(--gold); }
.img-preview-item__btn.cover-btn.active { background: var(--gold); color: #000; }

/* =============================================
   ALERTS / TOASTS
   ============================================= */
.alert {
    padding: .875rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 500;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.alert--success { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.25); color: var(--green); }
.alert--error   { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.25); color: var(--red); }
.alert--info    { background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.25); color: var(--blue); }

/* Toast */
.toast-container {
    position: fixed;
    top: 1rem; right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.toast {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .75rem 1rem;
    font-size: .85rem;
    font-weight: 500;
    min-width: 240px;
    box-shadow: 0 8px 24px rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    gap: .5rem;
    animation: slideInRight .25s ease;
}

.toast--success { border-left: 3px solid var(--green); }
.toast--error   { border-left: 3px solid var(--red); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(212,175,55,.06), transparent 70%);
    top: -100px; left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 32px 80px rgba(0,0,0,.6);
    position: relative;
}

.login-card__logo {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--gold), var(--gold-l));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: .25rem;
}

.login-card__subtitle {
    text-align: center;
    font-size: .8rem;
    color: var(--text-3);
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* MISC */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.25rem 0;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: .75rem;
}

.page-title { font-size: 1.15rem; font-weight: 700; }

/* Categories drag handle */
.drag-handle {
    color: var(--text-3);
    cursor: grab;
    padding: .25rem .5rem;
    font-size: .9rem;
}
.drag-handle:active { cursor: grabbing; }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.page-link {
    padding: .4rem .75rem;
    border-radius: var(--radius-sm);
    font-size: .82rem;
    font-weight: 500;
    color: var(--text-2);
    background: var(--surface2);
    border: 1px solid var(--border);
    transition: all .15s;
}

.page-link:hover,
.page-link.active {
    background: var(--gold);
    border-color: var(--gold);
    color: #000;
}
