/* =========================================================
   AgendateLive - Sistema Visual Central
   Fase 23: interfaz unificada y responsive
   ========================================================= */

:root {
    --ag-yellow: #ffc107;
    --ag-yellow-hover: #e0a800;
    --ag-dark: #212529;
    --ag-dark-soft: #343a40;
    --ag-dark-border: #495057;
    --ag-bg: #f5f7fb;
    --ag-surface: #ffffff;
    --ag-surface-soft: #f8f9fa;
    --ag-text: #212529;
    --ag-muted: #6c757d;
    --ag-border: #e8ebef;
    --ag-danger: #dc3545;
    --ag-success: #198754;
    --ag-radius-sm: 9px;
    --ag-radius: 14px;
    --ag-radius-lg: 16px;
    --ag-shadow: 0 4px 18px rgba(0, 0, 0, .06);
    --ag-shadow-lg: 0 12px 34px rgba(0, 0, 0, .10);
    --ag-topbar-height: 76px;
    --ag-sidebar-width: 230px;
    --ag-font:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
}

/* =========================================================
   BASE
   ========================================================= */

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--ag-bg);
    color: var(--ag-text);
    font-family: var(--ag-font);
}

body {
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

a {
    text-underline-offset: 2px;
}

img {
    max-width: 100%;
}

/* =========================================================
   MARCA / LOGO
   ========================================================= */

.ag-brand,
.ag-brand:visited {
    display: inline-flex;
    align-items: center;
    gap: .38rem;
    color: var(--ag-yellow) !important;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -.025em;
    text-decoration: none;
    white-space: nowrap;
}

.ag-brand:hover,
.ag-brand:focus {
    color: var(--ag-yellow) !important;
}

.ag-brand__context {
    color: #fff;
    font-size: .82rem;
    font-weight: 500;
    letter-spacing: 0;
    opacity: .95;
}

/* =========================================================
   TOPBAR UNIFICADO
   ========================================================= */

.ag-topbar {
    min-height: var(--ag-topbar-height);
    background: var(--ag-dark);
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.ag-topbar__inner {
    min-height: var(--ag-topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ag-topbar__actions {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.ag-login-btn,
.ag-register-btn {
    border-radius: 10px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    padding: .52rem .9rem;
}

/* =========================================================
   USUARIO AUTENTICADO / DROPDOWN
   ========================================================= */

.ag-user-trigger {
    min-width: 220px;
    border: 1px solid rgba(255, 255, 255, .24);
    background: rgba(255, 255, 255, .06);
    color: #fff;
    border-radius: 12px;
    padding: .38rem .55rem;
    display: flex;
    align-items: center;
    gap: .55rem;
    text-align: left;
    transition:
        background .15s ease,
        border-color .15s ease;
}

.ag-user-trigger:hover,
.ag-user-trigger:focus,
.ag-user-trigger.show {
    background: rgba(255, 255, 255, .10);
    border-color: rgba(255, 255, 255, .40);
    color: #fff;
}

.ag-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ag-yellow);
    color: var(--ag-dark);
    font-weight: 800;
    font-size: .9rem;
}

.ag-user-copy {
    min-width: 0;
    flex: 1;
}

.ag-user-name {
    display: block;
    max-width: 150px;
    color: #fff;
    font-size: .92rem;
    font-weight: 700;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ag-user-role {
    display: block;
    color: rgba(255, 255, 255, .68);
    font-size: .74rem;
    line-height: 1.2;
    margin-top: .12rem;
}

.ag-user-menu {
    min-width: 285px;
    border: 0;
    border-radius: var(--ag-radius);
    padding: .6rem;
    box-shadow: var(--ag-shadow-lg);
}

.ag-user-menu .dropdown-header {
    padding: .7rem .75rem .8rem;
}

.ag-user-menu .dropdown-item {
    border-radius: 9px;
    padding: .62rem .75rem;
    font-weight: 500;
}

.ag-user-menu .dropdown-item:hover,
.ag-user-menu .dropdown-item:focus {
    background: #f3f5f7;
}

.ag-user-menu .dropdown-item i {
    width: 22px;
    color: var(--ag-muted);
}

.ag-user-menu .ag-logout {
    color: #b02a37;
}

.ag-user-menu .ag-logout i {
    color: #b02a37;
}

/* =========================================================
   ESTRUCTURA DE PANELES
   ========================================================= */

.ag-panel-layout {
    display: flex;
    width: 100%;
    min-height: calc(100vh - var(--ag-topbar-height));
    align-items: stretch;
}

.ag-panel-sidebar {
    width: var(--ag-sidebar-width);
    flex: 0 0 var(--ag-sidebar-width);
    background: var(--ag-dark-soft);
    color: #fff;
    min-height: calc(100vh - var(--ag-topbar-height));
    border-right: 1px solid var(--ag-dark-border);
}

.ag-panel-sidebar__title {
    padding: 15px 20px 8px;
    color: rgba(255, 255, 255, .55);
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.ag-panel-sidebar a {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: .55rem;
    color: #d1d6da;
    text-decoration: none;
    padding: 12px 18px;
    border-bottom: 1px solid var(--ag-dark-border);
    border-left: 4px solid transparent;
    transition:
        background .15s ease,
        color .15s ease,
        border-color .15s ease;
}

.ag-panel-sidebar a:hover,
.ag-panel-sidebar a.active {
    background: var(--ag-dark-border);
    color: #fff;
    border-left-color: var(--ag-yellow);
}

.ag-panel-sidebar a i {
    width: 18px;
    text-align: center;
}

.ag-panel-sidebar hr {
    margin: 12px 0;
    border-color: #6c757d;
    opacity: .45;
}

.ag-panel-main {
    flex: 1 1 auto;
    min-width: 0;
    background: var(--ag-bg);
    padding: 24px;
}

/* =========================================================
   CABECERA DE PÁGINA
   ========================================================= */

.ag-page-hero {
    background: var(--ag-surface);
    border: 0;
    border-left: 5px solid var(--ag-yellow);
    border-radius: var(--ag-radius-lg);
    box-shadow: var(--ag-shadow);
    padding: 20px;
}

.ag-page-eyebrow {
    color: var(--ag-muted);
    font-size: .78rem;
    margin-bottom: .2rem;
}

.ag-page-title {
    margin: 0;
    font-size: clamp(1.45rem, 2vw, 2rem);
    font-weight: 800;
    letter-spacing: -.025em;
}

.ag-page-subtitle {
    margin: .35rem 0 0;
    color: var(--ag-muted);
    font-size: .92rem;
}

/* =========================================================
   TARJETAS / BLOQUES
   ========================================================= */

.ag-card {
    background: var(--ag-surface);
    border: 1px solid var(--ag-border);
    border-radius: var(--ag-radius);
    box-shadow: var(--ag-shadow);
}

.ag-card--flat {
    box-shadow: none;
}

.ag-card__body {
    padding: 20px;
}

.ag-stat-card {
    background: var(--ag-surface);
    border: 0;
    border-radius: var(--ag-radius);
    box-shadow: var(--ag-shadow);
    padding: 18px;
}

.ag-stat-label {
    color: var(--ag-muted);
    font-size: .78rem;
}

.ag-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
}

/* =========================================================
   BOTONES
   ========================================================= */

.btn {
    border-radius: var(--ag-radius-sm);
}

.btn-warning {
    background: var(--ag-yellow);
    border-color: var(--ag-yellow);
    color: #111;
    font-weight: 700;
}

.btn-warning:hover,
.btn-warning:focus {
    background: var(--ag-yellow-hover);
    border-color: var(--ag-yellow-hover);
    color: #111;
}

.ag-btn-primary {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    background: var(--ag-yellow);
    border: 1px solid var(--ag-yellow);
    color: #111;
    border-radius: var(--ag-radius-sm);
    padding: .55rem .9rem;
    font-weight: 700;
    text-decoration: none;
}

.ag-btn-primary:hover {
    background: var(--ag-yellow-hover);
    border-color: var(--ag-yellow-hover);
    color: #111;
}

/* =========================================================
   FORMULARIOS
   ========================================================= */

.form-control,
.form-select {
    min-height: 42px;
    border-radius: 9px;
    border-color: #d8dde3;
}

textarea.form-control {
    min-height: 100px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ag-yellow);
    box-shadow: 0 0 0 .2rem rgba(255, 193, 7, .18);
}

.form-label {
    font-weight: 600;
    margin-bottom: .4rem;
}

/* =========================================================
   TABS
   ========================================================= */

.ag-tabs {
    border-bottom: 1px solid #dfe3e7;
    display: flex;
    flex-wrap: wrap;
    gap: .1rem;
}

.ag-tabs a,
.ag-tabs button {
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: #343a40;
    padding: .78rem .85rem;
    text-decoration: none;
    font-weight: 500;
}

.ag-tabs a.active,
.ag-tabs button.active {
    border-bottom-color: var(--ag-yellow);
    color: #111;
    font-weight: 700;
}

/* =========================================================
   ALERTAS
   ========================================================= */

.alert {
    border-radius: 10px;
}

/* =========================================================
   EMPTY STATES
   ========================================================= */

.ag-empty {
    padding: 48px 18px;
    text-align: center;
    color: var(--ag-muted);
}

.ag-empty__icon {
    font-size: 2rem;
    margin-bottom: .85rem;
}

.ag-empty__title {
    color: #495057;
    font-weight: 700;
    margin-bottom: .35rem;
}

/* =========================================================
   TABLAS
   ========================================================= */

.ag-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0;
}

.table th {
    white-space: nowrap;
}

/* =========================================================
   FOOTER
   ========================================================= */

.ag-footer {
    background: #121212;
    color: #a0a0a0;
    font-size: 14px;
}

.ag-footer a {
    color: #a0a0a0;
    text-decoration: none;
}

.ag-footer a:hover {
    color: #fff;
}

/* =========================================================
   UTILIDADES
   ========================================================= */

.ag-content-width {
    width: min(100%, 1180px);
    margin-inline: auto;
}

.ag-section-gap {
    margin-bottom: 24px;
}

.ag-text-muted {
    color: var(--ag-muted);
}

/* =========================================================
   RESPONSIVE - TABLET
   ========================================================= */

@media (max-width: 991.98px) {

    :root {
        --ag-sidebar-width: 210px;
    }

    .ag-panel-main {
        padding: 20px;
    }

    .ag-page-hero {
        padding: 18px;
    }

    .ag-brand__context {
        display: none;
    }
}

/* =========================================================
   RESPONSIVE - MÓVIL
   ========================================================= */

@media (max-width: 767.98px) {

    :root {
        --ag-topbar-height: 64px;
    }

    .ag-topbar {
        min-height: var(--ag-topbar-height);
    }

    .ag-topbar__inner {
        min-height: var(--ag-topbar-height);
        padding-inline: 12px;
    }

    .ag-brand {
        font-size: 1.08rem;
    }

    .ag-user-trigger {
        min-width: 0;
        width: auto;
        padding: .32rem .42rem;
    }

    .ag-user-copy {
        display: none;
    }

    .ag-user-menu {
        min-width: min(280px, calc(100vw - 24px));
    }

    .ag-login-btn {
        padding-inline: .72rem;
    }

    .ag-register-btn {
        display: none !important;
    }

    .ag-panel-layout {
        display: block;
        min-height: auto;
    }

    .ag-panel-sidebar {
        width: 100%;
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--ag-dark-border);
        display: flex;
        align-items: stretch;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .ag-panel-sidebar__title {
        display: none;
    }

    .ag-panel-sidebar a {
        flex: 0 0 auto;
        min-width: max-content;
        min-height: 50px;
        border-left: 0;
        border-bottom: 4px solid transparent;
        padding: 12px 15px;
        justify-content: center;
    }

    .ag-panel-sidebar a:hover,
    .ag-panel-sidebar a.active {
        border-left-color: transparent;
        border-bottom-color: var(--ag-yellow);
    }

    .ag-panel-sidebar hr {
        display: none;
    }

    .ag-panel-main {
        width: 100%;
        padding: 14px;
    }

    .ag-page-hero {
        padding: 16px;
        border-left-width: 4px;
        border-radius: 12px;
    }

    .ag-page-title {
        font-size: 1.42rem;
    }

    .ag-page-subtitle {
        font-size: .86rem;
    }

    .ag-card__body {
        padding: 16px;
    }

    .ag-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .ag-tabs a,
    .ag-tabs button {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .ag-mobile-full {
        width: 100% !important;
    }

    .ag-empty {
        padding: 36px 14px;
    }
}

/* =========================================================
   RESPONSIVE - TELÉFONOS PEQUEÑOS
   ========================================================= */

@media (max-width: 575.98px) {

    .ag-topbar__inner {
        gap: .5rem;
    }

    .ag-avatar {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        font-size: .8rem;
    }

    .ag-user-trigger::after {
        margin-left: .2rem;
    }

    .ag-panel-main {
        padding: 12px;
    }

    .ag-page-hero {
        padding: 14px;
    }

    .ag-card__body {
        padding: 14px;
    }

    .btn,
    .ag-btn-primary {
        min-height: 42px;
    }

    .form-control,
    .form-select {
        min-height: 44px;
    }
}
