/* ============================================================
   GLADIATOR DESIGNS — ADMIN PANEL CSS
   Glassmorphic · Dark Premium · Dorado
   ============================================================ */

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

/* --- Variables de Color (alineadas con la web principal) --- */
:root {
    --bg-base:        #07090e;
    --bg-card:        rgba(255, 255, 255, 0.045);
    --bg-card-hover:  rgba(255, 255, 255, 0.08);
    --border-glass:   rgba(255, 255, 255, 0.1);
    --border-gold:    rgba(212, 175, 55, 0.4);
    --accent-gold:    #d4af37;
    --accent-gold-2:  #f5c842;
    --accent-red:     #e53e3e;
    --accent-green:   #38a169;
    --accent-blue:    #4299e1;
    --text-primary:   #f0ece4;
    --text-secondary: #9ca3af;
    --text-muted:     #6b7280;
    --shadow-gold:    0 0 30px rgba(212, 175, 55, 0.15);
    --shadow-card:    0 8px 32px rgba(0, 0, 0, 0.5);
    --radius-card:    16px;
    --radius-btn:     10px;
    --transition:     all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* --- Fondo animado de brillos --- */
.admin-bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    z-index: 0;
    animation: float-glow 8s ease-in-out infinite alternate;
}
.admin-bg-glow-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(212,175,55,0.12), transparent 70%);
    top: -150px; left: -150px;
}
.admin-bg-glow-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(99,102,241,0.1), transparent 70%);
    bottom: -100px; right: -100px;
    animation-delay: -4s;
}
@keyframes float-glow {
    0%   { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.2) translate(20px, 20px); }
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
#login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: var(--bg-base);
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-card), var(--shadow-gold);
    position: relative;
    z-index: 1;
    animation: card-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo img {
    height: 60px;
    mix-blend-mode: multiply;
    filter: brightness(1.2);
}
.login-logo h1 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin-top: 12px;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.login-logo p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: 4px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 1px;
    text-transform: uppercase;
}
.form-group input, .form-group select, .form-group textarea {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
    width: 100%;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.06);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}
.form-group input::placeholder, .form-group textarea::placeholder {
    color: var(--text-muted);
}
.form-group select option {
    background: #1a1d2e;
    color: var(--text-primary);
}
.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.login-error {
    color: #fc8181;
    font-size: 0.82rem;
    text-align: center;
    min-height: 20px;
    font-weight: 500;
    display: none;
}
.login-error.visible { display: block; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-btn);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-gold {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-2));
    color: #0a0a0a;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.35);
}
.btn-gold:hover {
    box-shadow: 0 6px 28px rgba(212, 175, 55, 0.5);
    transform: translateY(-1px);
}
.btn-gold-outline {
    background: transparent;
    color: var(--accent-gold);
    border: 1px solid var(--border-gold);
}
.btn-gold-outline:hover {
    background: rgba(212, 175, 55, 0.1);
}
.btn-danger {
    background: rgba(229, 62, 62, 0.15);
    color: #fc8181;
    border: 1px solid rgba(229, 62, 62, 0.3);
    padding: 7px 14px;
    font-size: 0.8rem;
    border-radius: 8px;
}
.btn-danger:hover {
    background: rgba(229, 62, 62, 0.3);
    box-shadow: 0 0 12px rgba(229, 62, 62, 0.3);
}
.btn-edit {
    background: rgba(212, 175, 55, 0.15);
    color: var(--gold, #d4af37);
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 7px 14px;
    font-size: 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
}
.btn-edit:hover {
    background: rgba(212, 175, 55, 0.3);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.3);
}
.btn-sm {
    padding: 8px 16px;
    font-size: 0.82rem;
}
.btn-full { width: 100%; }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
#dashboard {
    display: none;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* --- Topbar --- */
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(7, 9, 14, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar-brand img {
    height: 38px;
    mix-blend-mode: multiply;
    filter: brightness(1.2);
}
.topbar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}
.topbar-brand-text span:first-child {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 1px;
}
.topbar-brand-text span:last-child {
    font-size: 0.65rem;
    color: var(--accent-gold);
    letter-spacing: 3px;
    margin-top: 3px;
}
.topbar-badge {
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid var(--border-gold);
    color: var(--accent-gold);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-btn-text-short { display: none; }
.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}
.topbar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: #0a0a0a;
}

/* --- Main Content --- */
.admin-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 32px 60px;
}

.admin-welcome {
    margin-bottom: 36px;
}
.admin-welcome h2 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
}
.admin-welcome h2 span {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.admin-welcome p {
    color: var(--text-secondary);
    margin-top: 6px;
    font-size: 0.9rem;
}

/* --- Stats Strip --- */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 36px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-card);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}
.stat-card:hover { border-color: var(--border-gold); background: var(--bg-card-hover); }
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.stat-icon.gold  { background: rgba(212,175,55,0.12); }
.stat-icon.blue  { background: rgba(66,153,225,0.12); }
.stat-icon.green { background: rgba(56,161,105,0.12); }
.stat-info { flex: 1; }
.stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}
.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Tabs --- */
.admin-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 28px;
    width: fit-content;
}
.tab-btn {
    padding: 10px 24px;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 7px;
    letter-spacing: 0.5px;
}
.tab-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.tab-btn.active {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-2));
    color: #0a0a0a;
    font-weight: 700;
    box-shadow: 0 2px 12px rgba(212,175,55,0.35);
}

/* --- Tab Panels --- */
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade-in 0.3s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* --- Section Cards (Add Form + List) --- */
.admin-section-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
    align-items: start;
}

.admin-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-card);
    padding: 28px;
    position: relative;
    overflow: hidden;
}
.admin-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-gold-2), transparent);
    opacity: 0.6;
}
.admin-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.admin-card-title .icon { font-size: 1.1rem; }
.add-form { display: flex; flex-direction: column; gap: 14px; }

/* --- Admin Search Bar --- */
.admin-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}
.admin-search-bar:focus-within {
    border-color: var(--accent-gold);
}
.admin-search-bar svg {
    color: var(--text-muted);
    flex-shrink: 0;
}
.admin-search-input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 100%;
}
.admin-search-input::placeholder {
    color: var(--text-muted);
}

/* --- Items List --- */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 4px;
}
.items-list::-webkit-scrollbar { width: 4px; }
.items-list::-webkit-scrollbar-track { background: transparent; }
.items-list::-webkit-scrollbar-thumb { background: var(--border-glass); border-radius: 2px; }

.item-row {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    animation: item-in 0.3s ease both;
}
@keyframes item-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
.item-row:hover { border-color: var(--border-gold); background: rgba(212,175,55,0.04); }

.item-thumb {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-glass);
}
.item-thumb-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: rgba(212,175,55,0.08);
    border: 1px solid var(--border-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.item-info { flex: 1; min-width: 0; }
.item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.item-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.item-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(212,175,55,0.1);
    color: var(--accent-gold);
    border: 1px solid rgba(212,175,55,0.2);
    flex-shrink: 0;
    white-space: nowrap;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 0.9rem; }

/* --- Toast Notification --- */
#admin-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    background: rgba(20, 24, 36, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: var(--shadow-card);
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    max-width: 320px;
}
#admin-toast.show { transform: translateY(0); opacity: 1; }
#admin-toast.success { border-color: rgba(56,161,105,0.5); }
#admin-toast.error   { border-color: rgba(229, 62, 62, 0.5); }
.toast-icon { font-size: 1.1rem; }

/* --- Responsive --- */
@media (max-width: 900px) {
    .admin-section-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .admin-topbar { padding: 0 16px; }
    .admin-main { padding: 24px 16px 48px; }
    .login-card { padding: 36px 24px; }
    .admin-tabs { width: 100%; }
    .tab-btn { flex: 1; justify-content: center; padding: 10px 12px; font-size: 0.8rem; }
    .stats-strip { grid-template-columns: 1fr 1fr; }
    .topbar-badge { display: none; }
    .topbar-user span { display: none; }
    .admin-welcome h2 { font-size: 1.3rem; }
    .admin-card { padding: 20px 16px; }
    .items-list { max-height: none; }
    .admin-search-bar { flex-wrap: wrap; }
    .item-row { flex-wrap: wrap; gap: 8px; }
    .item-info { min-width: calc(100% - 62px); }
    .item-row > div:last-child { width: 100%; justify-content: flex-end; }
    .stat-card { padding: 14px 16px; }
    .stat-number { font-size: 1.4rem; }
    .add-form .form-grid-2 { grid-template-columns: 1fr; gap: 10px; }
    .add-form .form-group { margin-bottom: 0; }
}

@media (max-width: 520px) {
    .admin-topbar { gap: 6px; }
    .topbar-actions { gap: 6px; }
    .topbar-user { gap: 4px; }
    .topbar-btn-sitio { padding: 8px 10px; font-size: 0.75rem; }
    .topbar-btn-logout { padding: 8px 10px; font-size: 0.75rem; }
    .topbar-brand-text span:first-child { font-size: 0.78rem; letter-spacing: 0.5px; }
    .topbar-brand-text span:last-child { font-size: 0.6rem; letter-spacing: 1px; }
    .topbar-brand { gap: 8px; }
    .topbar-brand img { height: 28px; }
    .topbar-btn-text-full { display: none; }
    .topbar-btn-text-short { display: inline; }
}

@media (max-width: 400px) {
    .admin-topbar { padding: 0 10px; height: 56px; }
    .topbar-brand-text span:first-child { font-size: 0.8rem; }
    .topbar-brand img { height: 30px; }
    .topbar-btn-sitio { padding: 6px 8px; font-size: 0.7rem; }
    .topbar-btn-logout { padding: 6px 8px; font-size: 0.7rem; }
    .tab-btn { font-size: 0.7rem; padding: 8px 8px; gap: 4px; }
    .stats-strip { grid-template-columns: 1fr; gap: 10px; }
    .login-card { padding: 28px 18px; }
    .admin-card-title { font-size: 0.9rem; }
    .btn { padding: 10px 16px; font-size: 0.82rem; }
}

/* --- Divider --- */
.divider {
    height: 1px;
    background: var(--border-glass);
    margin: 24px 0;
}

/* --- Image preview in form --- */
.img-preview-wrap {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 10px;
    border: 1px dashed var(--border-glass);
    overflow: hidden;
    background: rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.img-preview-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.img-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.img-preview-placeholder span { font-size: 2rem; }
