/* =====================================================
   DOMICI ADMIN — Estilos
   ===================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --terra:    #C96A3A;
    --terra-lt: #E8895C;
    --terra-dk: #A85428;
    --terra-bg: #F9EDE4;
    --beige:    #F5EAD7;
    --beige-dk: #EDD9B8;
    --moss:     #6B7A5C;
    --moss-bg:  #EAF0E6;
    --brown:    #3D2B1F;
    --brown-md: #6B4C37;
    --brown-lt: #9B7560;
    --white:    #FEFCF8;
    --off:      #FAF6F0;
    --sidebar-w: 220px;
    --ff: 'Nunito', system-ui, sans-serif;
    --ffd: 'Playfair Display', Georgia, serif;
    --sh: 0 2px 8px rgba(61,43,31,.1);
    --sh-md: 0 4px 16px rgba(61,43,31,.14);
    --r: 10px;
    --t: .25s ease;
}

body { font-family: var(--ff); background: var(--off); color: var(--brown); line-height: 1.6; }

/* ── Login ───────────────────────────────────────── */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--beige), var(--terra-bg));
}

.login-card {
    background: var(--white);
    border-radius: 20px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--sh-md);
    text-align: center;
}

.login-logo {
    height: 64px;
    width: auto;
    object-fit: contain;
    margin-bottom: 1.25rem;
}

.login-card h1 {
    font-family: var(--ffd);
    font-size: 1.4rem;
    color: var(--brown);
    margin-bottom: 2rem;
}

.login-error { color: #c0392b; font-size: .85rem; min-height: 1.2rem; margin-top: .5rem; }

/* ── Admin layout ────────────────────────────────── */
.admin-panel {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--brown);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 10;
}

.sidebar__logo {
    padding: 1.5rem 1rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
    text-align: center;
}

.sidebar__logo-img {
    height: 44px;
    width: auto;
    object-fit: contain;
    background: var(--white);
    padding: .25rem .5rem;
    border-radius: 8px;
}

.sidebar__nav {
    flex: 1;
    padding: 1rem .75rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.sidebar__btn {
    display: block;
    width: 100%;
    padding: .65rem 1rem;
    background: transparent;
    color: rgba(245,234,215,.65);
    font-family: var(--ff);
    font-size: .9rem;
    font-weight: 600;
    text-align: left;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--t);
}
.sidebar__btn:hover { background: rgba(255,255,255,.08); color: var(--beige); }
.sidebar__btn.active { background: var(--terra); color: #fff; }

.sidebar__footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,.1);
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.sidebar__link {
    color: rgba(245,234,215,.5);
    font-size: .82rem;
    text-decoration: none;
    transition: color var(--t);
}
.sidebar__link:hover { color: var(--beige); }

.sidebar__logout {
    background: transparent;
    color: rgba(245,234,215,.45);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 6px;
    padding: .4rem;
    font-family: var(--ff);
    font-size: .8rem;
    cursor: pointer;
    transition: all var(--t);
}
.sidebar__logout:hover { background: rgba(255,255,255,.08); color: var(--beige); }

/* Main content */
.admin-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 2rem;
    max-width: calc(100vw - var(--sidebar-w));
}

/* Panel */
.tab-panel { }

.panel-header {
    margin-bottom: 2rem;
}
.panel-header h2 {
    font-family: var(--ffd);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--brown);
}
.panel-subtitle { font-size: .88rem; color: var(--brown-lt); }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--r);
    padding: 1.5rem;
    border: 1px solid var(--beige-dk);
    box-shadow: var(--sh);
}
.stat-card__icon { font-size: 1.75rem; margin-bottom: .5rem; }
.stat-card__value {
    font-family: var(--ffd);
    font-size: 2rem;
    font-weight: 700;
    color: var(--terra);
    line-height: 1;
    margin-bottom: .25rem;
}
.stat-card__label { font-size: .8rem; color: var(--brown-lt); font-weight: 600; }

/* Dashboard row */
.dash-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
.dash-card {
    background: var(--white);
    border-radius: var(--r);
    padding: 1.5rem;
    border: 1px solid var(--beige-dk);
    box-shadow: var(--sh);
}
.dash-card--full { grid-column: 1 / -1; }
.dash-card__title {
    font-family: var(--ffd);
    font-size: 1rem;
    font-weight: 600;
    color: var(--brown);
    margin-bottom: 1rem;
}

/* Bar chart */
.bar-item {
    display: grid;
    grid-template-columns: 120px 1fr 40px;
    align-items: center;
    gap: .75rem;
    margin-bottom: .6rem;
    font-size: .85rem;
}
.bar-item__label { color: var(--brown-md); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--beige-dk); border-radius: 999px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--terra); transition: width .6s ease; }
.bar-fill--pet { background: var(--moss); }
.bar-item__count { color: var(--brown-lt); font-size: .8rem; text-align: right; }

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
.data-table th {
    background: var(--off);
    color: var(--brown-md);
    font-weight: 700;
    text-align: left;
    padding: .65rem 1rem;
    border-bottom: 2px solid var(--beige-dk);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.data-table td {
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--beige-dk);
    color: var(--brown);
    vertical-align: middle;
}
.data-table tr:hover td { background: var(--off); }
.data-table .td-name { max-width: 300px; }
.data-table .td-name a { color: var(--terra); text-decoration: none; font-size: .78rem; }
.data-table .td-name a:hover { text-decoration: underline; }

.badge-pill {
    display: inline-block;
    padding: .15rem .6rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
}
.badge-pill--terra { background: var(--terra-bg); color: var(--terra); }
.badge-pill--moss  { background: var(--moss-bg); color: var(--moss); }

.rank { font-family: var(--ffd); font-weight: 700; color: var(--terra); }
.click-count { font-weight: 700; color: var(--brown); }

/* Filter row */
.filter-row {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

/* Forms */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: .82rem; font-weight: 700; color: var(--brown-md); }

.input, .select {
    padding: .6rem .9rem;
    border: 2px solid var(--beige-dk);
    border-radius: 8px;
    font-family: var(--ff);
    font-size: .9rem;
    color: var(--brown);
    background: var(--white);
    outline: none;
    transition: border-color var(--t);
    width: 100%;
}
.input:focus, .select:focus { border-color: var(--terra); }
.input::placeholder { color: var(--brown-lt); }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    background: var(--white);
    border-radius: var(--r);
    padding: 2rem;
    border: 1px solid var(--beige-dk);
    box-shadow: var(--sh);
    margin-bottom: 1.25rem;
}
.add-form .form-error { color: #c0392b; font-size: .85rem; min-height: 1rem; }
.form-actions { display: flex; gap: .75rem; margin-top: .5rem; }

.btn-primary {
    padding: .65rem 1.75rem;
    background: var(--terra);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-family: var(--ff);
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--t);
}
.btn-primary:hover { background: var(--terra-dk); transform: translateY(-1px); }

.btn-secondary {
    padding: .65rem 1.75rem;
    background: transparent;
    color: var(--brown-md);
    border: 2px solid var(--beige-dk);
    border-radius: 999px;
    font-family: var(--ff);
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--t);
}
.btn-secondary:hover { border-color: var(--terra); color: var(--terra); }

.btn-delete {
    padding: .3rem .75rem;
    background: transparent;
    color: #c0392b;
    border: 1.5px solid #e0a8a0;
    border-radius: 999px;
    font-family: var(--ff);
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--t);
}
.btn-delete:hover { background: #c0392b; color: #fff; border-color: #c0392b; }

.link-btn {
    background: none;
    border: none;
    color: var(--terra);
    font-family: var(--ff);
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
}

.success-msg {
    background: var(--moss-bg);
    border: 1.5px solid var(--moss);
    color: var(--moss);
    padding: 1rem 1.5rem;
    border-radius: var(--r);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .75rem;
}

/* Toast */
.toast-admin {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--brown);
    color: var(--beige);
    padding: .75rem 1.5rem;
    border-radius: 999px;
    font-size: .88rem;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
    z-index: 999;
}
.toast-admin.show { opacity: 1; }

/* Responsive */
@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2,1fr); }
    .dash-row { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    :root { --sidebar-w: 0px; }
    .sidebar { display: none; }
    .admin-main { margin-left: 0; max-width: 100%; padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
