/**
 * Staff Dashboard Styles
 * Layout principal para /panel
 */

/* =========================================================
   FULL-WIDTH OVERRIDE — forzar ancho completo dentro del
   tema de WordPress (cualquier tema que use contenedores
   con max-width / padding / margin: auto)
   ========================================================= */
body.zfx-panel-page {
    overflow-x: hidden;
    background-color: var(--zfx-bg-main) !important;
}

/* Ocultar header del tema y admin bar */
body.zfx-panel-page .wpbf-page-header,
body.zfx-panel-page header.wpbf-page-header,
body.zfx-panel-page .site-header,
body.zfx-panel-page #site-header,
body.zfx-panel-page #masthead {
    display: none !important;
}

body.zfx-panel-page #wpadminbar {
    display: none !important;
}

body.zfx-panel-page,
body.zfx-panel-page.admin-bar {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Ocultar título de página del tema ("Control Panel") */
body.zfx-panel-page .entry-title,
body.zfx-panel-page h1.entry-title,
body.zfx-panel-page .page-title,
body.zfx-panel-page .wpbf-page-title-bar {
    display: none !important;
}

/* Neutralizar contenedor principal del tema (Page Builder Framework) */
body.zfx-panel-page .wpbf-container,
body.zfx-panel-page .wpbf-container-center {
    max-width: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.zfx-panel-page .wpbf-main,
body.zfx-panel-page .wpbf-page-content,
body.zfx-panel-page .wpbf-single-content,
body.zfx-panel-page [class*="wpbf-medium"],
body.zfx-panel-page [class*="wpbf-large"] {
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    float: none !important;
}

/* Neutralizar los contenedores comunes de los temas WP */
body.zfx-panel-page .site-content,
body.zfx-panel-page #content,
body.zfx-panel-page .content-area,
body.zfx-panel-page .wp-site-blocks,
body.zfx-panel-page main.site-main,
body.zfx-panel-page main#main,
body.zfx-panel-page main.wpbf-main {
    padding: 0 !important;
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
}

/* Restaurar el margin-left del main panel (sidebar es fixed 250px) */
body.zfx-panel-page main.zfx-main-content {
    margin-left: var(--zfx-sidebar-width) !important;
}

body.zfx-panel-page article,
body.zfx-panel-page .entry-content,
body.zfx-panel-page .wp-block-post-content,
body.zfx-panel-page .page-content,
body.zfx-panel-page .post-content {
    padding: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    width: 100% !important;
}

/* === LAYOUT PRINCIPAL === */
.zfx-staff-dashboard {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    background-color: var(--zfx-bg-main);
}

.zfx-dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* === SIDEBAR === */
.zfx-sidebar {
    width: var(--zfx-sidebar-width);
    background-color: var(--zfx-bg-sidebar);
    color: var(--zfx-text-light);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width var(--zfx-transition), transform var(--zfx-transition);
    z-index: 1000;
    box-shadow: var(--zfx-shadow-lg);
    display: flex;
    flex-direction: column;
}

.zfx-sidebar-logo {
    padding: var(--zfx-spacing-lg);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zfx-sidebar-logo img {
    max-width: 150px;
    margin: 0 auto;
    transition: var(--zfx-transition);
}

.zfx-sidebar-nav {
    padding: var(--zfx-spacing-lg) 0;
    flex: 1;
}

.zfx-sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.zfx-sidebar-nav-item {
    margin-bottom: var(--zfx-spacing-xs);
}

.zfx-sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: var(--zfx-spacing-md);
    padding: var(--zfx-spacing-md) var(--zfx-spacing-lg);
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--zfx-transition-fast);
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
}

.zfx-sidebar-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.07);
    color: var(--zfx-text-light);
    border-left-color: var(--zfx-turquoise-light);
    text-decoration: none;
}

.zfx-sidebar-nav-link.active {
    background-color: rgba(125, 211, 192, 0.15);
    color: var(--zfx-turquoise-light);
    border-left-color: var(--zfx-turquoise-light);
    font-weight: var(--zfx-font-weight-medium);
}

.zfx-sidebar-nav-icon {
    font-size: 1.25rem;
    width: 24px;
    min-width: 24px;
    text-align: center;
}

/* Sidebar collapsed (desktop/tablet) */
.zfx-sidebar.collapsed {
    width: var(--zfx-sidebar-width-collapsed);
}

.zfx-sidebar.collapsed .zfx-sidebar-logo {
    padding: var(--zfx-spacing-md);
}

.zfx-sidebar.collapsed .zfx-sidebar-logo img {
    max-width: 36px;
}

.zfx-sidebar.collapsed .zfx-sidebar-nav-link span:not(.zfx-sidebar-nav-icon):not(.dashicons) {
    display: none;
}

.zfx-sidebar.collapsed .zfx-sidebar-nav-link {
    justify-content: center;
    padding: var(--zfx-spacing-md);
    gap: 0;
}

/* === SIDEBAR FOOTER CREDIT === */
.zfx-sidebar-credit {
    margin-top: auto;
    padding: var(--zfx-spacing-lg) var(--zfx-spacing-md);
    font-size: 0.7rem;
    color: rgba(255,255,255,0.35);
    text-align: center;
    line-height: 1.4;
    border-top: 1px solid rgba(255,255,255,0.07);
}
.zfx-sidebar-credit strong {
    color: rgba(255,255,255,0.55);
    font-weight: 600;
}
.zfx-sidebar.collapsed .zfx-sidebar-credit {
    display: none;
}

/* === OVERLAY (mobile) === */
.zfx-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    transition: opacity var(--zfx-transition);
    opacity: 0;
}

.zfx-sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* === MAIN CONTENT === */
.zfx-main-content {
    flex: 1;
    margin-left: var(--zfx-sidebar-width);
    min-width: 0;
    transition: margin-left var(--zfx-transition);
    display: flex;
    flex-direction: column;
}

.zfx-sidebar.collapsed ~ .zfx-main-content {
    margin-left: var(--zfx-sidebar-width-collapsed);
}

/* === HEADER === */
.zfx-header {
    height: 70px;
    background-color: var(--zfx-bg-header);
    border-bottom: 1px solid var(--zfx-border-color);
    padding: 0 var(--zfx-spacing-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--zfx-shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.zfx-header-left {
    display: flex;
    align-items: center;
    gap: var(--zfx-spacing-md);
}

.zfx-header-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--zfx-text-primary);
    cursor: pointer;
    padding: var(--zfx-spacing-sm);
    border-radius: var(--zfx-border-radius);
    transition: var(--zfx-transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.zfx-header-toggle:hover {
    background-color: var(--zfx-bg-hover);
}

.zfx-header-brand {
    display: flex;
    align-items: center;
    padding: 0 var(--zfx-spacing-sm);
    flex-shrink: 0;
}

.zfx-header-logo {
    max-height: 40px;
    max-width: 140px;
    width: auto;
    object-fit: contain;
}

.zfx-header-title {
    font-size: 1.25rem;
    font-weight: var(--zfx-font-weight-semibold);
    color: var(--zfx-text-primary);
    margin: 0;
    white-space: nowrap;
}

.zfx-header-right {
    display: flex;
    align-items: center;
    gap: var(--zfx-spacing-sm);
}

.zfx-header-user {
    display: flex;
    align-items: center;
    gap: var(--zfx-spacing-sm);
    padding: var(--zfx-spacing-sm) var(--zfx-spacing-md);
    border-radius: var(--zfx-border-radius);
    cursor: pointer;
    transition: var(--zfx-transition-fast);
}

.zfx-header-user:hover {
    background-color: var(--zfx-bg-hover);
}

.zfx-header-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--zfx-turquoise-light), var(--zfx-turquoise-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--zfx-text-light);
    font-weight: var(--zfx-font-weight-semibold);
    font-size: var(--zfx-font-size-sm);
    flex-shrink: 0;
}

.zfx-header-user-info {
    display: flex;
    flex-direction: column;
}

.zfx-header-user-name {
    font-weight: var(--zfx-font-weight-medium);
    font-size: var(--zfx-font-size-sm);
    color: var(--zfx-text-primary);
    line-height: 1.2;
}

.zfx-header-user-role {
    font-size: var(--zfx-font-size-xs);
    color: var(--zfx-text-secondary);
    line-height: 1.2;
}

/* === CONTENT AREA === */
.zfx-content {
    padding: var(--zfx-spacing-xl) var(--zfx-spacing-xl);
    flex: 1;
}

.zfx-page-header {
    margin-bottom: var(--zfx-spacing-xl);
}

.zfx-page-title {
    font-size: 1.875rem;
    font-weight: var(--zfx-font-weight-bold);
    color: var(--zfx-text-primary);
    margin-bottom: var(--zfx-spacing-xs);
}

.zfx-page-subtitle {
    font-size: var(--zfx-font-size-base);
    color: var(--zfx-text-secondary);
    margin: 0;
}

/* === WIDGETS GRID === */
.zfx-widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--zfx-spacing-xl);
    margin-bottom: var(--zfx-spacing-2xl);
    width: min(100%, 1400px);
    margin-left: auto;
    margin-right: auto;
}

/* === DASHBOARD MAIN GRID (Appointments + Quick Actions) === */
.zfx-dashboard-main-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: var(--zfx-spacing-lg);
    align-items: start;
}

.zfx-dashboard-appointments {
    min-width: 0;
}

/* === APPOINTMENTS LIST === */
.zfx-appointments-list {
    display: flex;
    flex-direction: column;
    gap: var(--zfx-spacing-md);
}

/* === EMPTY STATE === */
.zfx-empty-state {
    text-align: center;
    padding: var(--zfx-spacing-2xl);
    background-color: var(--zfx-bg-white);
    border-radius: var(--zfx-border-radius-lg);
    box-shadow: var(--zfx-shadow-sm);
}

.zfx-empty-state-icon {
    font-size: 3rem;
    color: var(--zfx-text-muted);
    margin-bottom: var(--zfx-spacing-md);
}

.zfx-empty-state-title {
    font-size: var(--zfx-font-size-xl);
    color: var(--zfx-text-primary);
    margin-bottom: var(--zfx-spacing-sm);
}

.zfx-empty-state-text {
    color: var(--zfx-text-secondary);
    margin-bottom: var(--zfx-spacing-lg);
}

/* ==========================================================
   RESPONSIVE BREAKPOINTS
   ========================================================== */

/* --- Desktop grande (>= 1600px) --- */
@media (min-width: 1600px) {
    .zfx-content {
        padding: 40px;
        max-width: 1800px;
        margin: 0 auto;
    }

    .zfx-widgets-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 36px;
    }

    .zfx-dashboard-main-grid {
        grid-template-columns: minmax(0, 1.1fr) minmax(320px, 420px);
        gap: 36px;
    }
}

/* --- Laptop (1024px – 1599px) --- */
@media (min-width: 1024px) and (max-width: 1599px) {
    .zfx-widgets-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--zfx-spacing-md);
    }

    .zfx-dashboard-main-grid {
        grid-template-columns: 1fr 320px;
        gap: var(--zfx-spacing-md);
    }
}

/* --- Tablet (768px – 1023px) --- */
@media (min-width: 768px) and (max-width: 1023px) {
    .zfx-content {
        padding: var(--zfx-spacing-lg);
    }

    .zfx-widgets-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--zfx-spacing-md);
    }

    .zfx-dashboard-main-grid {
        grid-template-columns: 1fr;
        gap: var(--zfx-spacing-md);
    }

    .zfx-dashboard-sidebar {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: var(--zfx-spacing-md);
    }

    /* En tablet el sidebar se colapsa, botón toggle lo expande */
    .zfx-sidebar {
        width: var(--zfx-sidebar-width-collapsed);
    }

    .zfx-sidebar .zfx-sidebar-logo img {
        max-width: 36px;
    }

    .zfx-sidebar .zfx-sidebar-nav-link span:not(.zfx-sidebar-nav-icon):not(.dashicons) {
        display: none;
    }

    .zfx-sidebar .zfx-sidebar-nav-link {
        justify-content: center;
        padding: var(--zfx-spacing-md);
        gap: 0;
    }

    .zfx-main-content {
        margin-left: var(--zfx-sidebar-width-collapsed);
    }

    /* Cuando el sidebar se expande en tablet */
    .zfx-sidebar.tablet-open {
        width: var(--zfx-sidebar-width);
    }

    .zfx-sidebar.tablet-open .zfx-sidebar-logo img {
        max-width: 150px;
    }

    .zfx-sidebar.tablet-open .zfx-sidebar-nav-link span:not(.zfx-sidebar-nav-icon):not(.dashicons) {
        display: inline;
    }

    .zfx-sidebar.tablet-open .zfx-sidebar-nav-link {
        justify-content: flex-start;
        padding: var(--zfx-spacing-md) var(--zfx-spacing-lg);
        gap: var(--zfx-spacing-md);
    }

    .zfx-sidebar.tablet-open ~ .zfx-main-content {
        margin-left: var(--zfx-sidebar-width);
    }

    .zfx-appointments-list {
        gap: var(--zfx-spacing-md);
    }
}

/* --- Mobile (< 768px) --- */
@media (max-width: 767px) {
    .zfx-sidebar {
        transform: translateX(-100%);
        width: var(--zfx-sidebar-width);
    }

    .zfx-sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: var(--zfx-shadow-xl);
    }

    .zfx-main-content {
        margin-left: 0 !important;
    }

    .zfx-header {
        padding: 0 var(--zfx-spacing-md);
        height: 60px;
    }

    .zfx-header-title {
        font-size: var(--zfx-font-size-base);
    }

    .zfx-header-user-info {
        display: none;
    }

    .zfx-content {
        padding: var(--zfx-spacing-md);
    }

    .zfx-page-title {
        font-size: 1.5rem;
    }

    .zfx-page-header {
        margin-bottom: var(--zfx-spacing-lg);
    }

    .zfx-widgets-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--zfx-spacing-sm);
    }

    .zfx-dashboard-main-grid {
        grid-template-columns: 1fr;
        gap: var(--zfx-spacing-md);
    }

    .zfx-dashboard-sidebar {
        display: flex;
        flex-direction: column;
        gap: var(--zfx-spacing-md);
    }

    .zfx-appointments-list {
        gap: var(--zfx-spacing-sm);
    }

    .zfx-appointment-card {
        padding: var(--zfx-spacing-md);
        min-height: 80px;
        flex-wrap: wrap;
        gap: var(--zfx-spacing-sm);
    }

    .zfx-appointment-card-time {
        font-size: var(--zfx-font-size-base);
        min-width: 80px;
    }

    .zfx-appointment-card-client {
        font-size: var(--zfx-font-size-base);
    }
}

/* --- Mobile muy pequeño (< 400px) --- */
@media (max-width: 399px) {
    .zfx-widgets-grid {
        grid-template-columns: 1fr;
    }
}
