/**
 * Braves Chat iA Dashboard Styles
 * Diseño moderno para el panel de administración
 *
 * @package BravesChat
 * @version 1.2.0
 */

/* ============================================
   Variables and Base Styles
   ============================================ */

/* Aplicar estilos a todas las páginas de Braves Chat */
.braves-chat-admin-page {
    background-color: var(--braves-bg-page);
    --wp-components-color-accent: #3858e9;
    --wp-components-color-accent-darker-10: #2145e6;
    --wp-components-color-accent-darker-20: #183ad6;
    --braves-dashboard-width: 1200px;
}

/* ============================================
   Linked Cards
   ============================================ */
a.braves-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

a.braves-card-link:hover {
    text-decoration: none;
    color: inherit;
}

a.braves-card-link:focus {
    outline: none;
    box-shadow: none;
}

/* ============================================
   WordPress Admin Menu Styles
   ============================================ */

/* Mantener el menú resaltado y con el mismo estilo en todas las páginas de Braves Chat */


/* El ítem del menú debe verse activo en todas las páginas */
.braves-chat-admin-page ul#adminmenu li.toplevel_page_braveschat>a {
    background-color: #2271b1;
    color: #fff;
}

/* WordPress admin bar offset fix - mantener la flecha blanca */
.braves-chat-admin-page ul#adminmenu>li.toplevel_page_braveschat>a:after {
    border-right-color: var(--braves-bg-page);
    right: 0;
    border: 8px solid transparent;
    content: " ";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
    border-right-color: var(--braves-bg-page);
    top: 50%;
    margin-top: -8px;
}

.braves-chat-admin-page #wpcontent {
    padding-left: 0 !important;
}

.braves-chat-admin-page #wpfooter,
.braves-chat-admin-page .notice:not(.braves-notice) {
    display: none;
}

.braves-chat-admin-page #wpbody-content {
    padding-bottom: 0;
}

/* Dark mode: extender fondo a todo el área WP */
html[data-braves-theme="dark"] .braves-chat-admin-page,
html[data-braves-theme="dark"] #wpcontent,
html[data-braves-theme="dark"] #wpbody,
html[data-braves-theme="dark"] #wpbody-content {
    background-color: var(--braves-bg-page);
}

/* ============================================
   Dashboard Container
   ============================================ */

#braves-dashboard {
    background-color: var(--braves-surface);
    color: var(--braves-text-primary);
    min-height: 100vh;
}

#braves-dashboard h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--braves-text-primary);
}

#braves-dashboard h2,
#braves-dashboard h3 {
    color: var(--braves-text-primary);
    font-weight: 600;
}

/* ============================================
   Header
   ============================================ */

.braves-dashboard__header {
    position: sticky;
    left: 0;
    top: 32px;
    z-index: 2;
    padding: 20px 26px;
    height: 60px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--braves-surface);
    border-bottom: 1px solid var(--braves-border-color);
}

.braves-dashboard__logo svg {
    display: block;
    height: 32px;
    width: auto;
}

/* ============================================
   Dashboard Layout
   ============================================ */

.braves-dashboard__content {
    display: flex;
    min-height: calc(100vh - 92px);
}

.braves-dashboard__tabs {
    display: grid;
    grid-template-columns: 220px auto;
    width: 100%;
}

/* ============================================
   Sidebar Navigation
   ============================================ */

.braves-dashboard__nav {
    padding: 20px 12px;
    border-right: 1px solid var(--braves-border-color);
    background: var(--braves-surface);
    position: sticky;
    top: 92px;
    align-self: flex-start;
    min-height: calc(100vh - 92px);
    box-sizing: border-box;
}

.braves-dashboard__nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 2px;
    font-weight: 400;
    height: auto;
    font-size: 13px;
    color: var(--braves-text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.braves-dashboard__nav-item svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.braves-dashboard__nav-item:hover {
    background: var(--braves-surface-alt);
}

.braves-dashboard__nav-item--active,
.braves-dashboard__nav-item--active:hover {
    background: var(--braves-surface-alt);
    font-weight: 500;
    color: var(--wp-components-color-accent);
}

[data-braves-theme="dark"] .braves-dashboard__nav-item--active,
[data-braves-theme="dark"] .braves-dashboard__nav-item--active:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--braves-primary-light);
    box-shadow: inset 3px 0 0 var(--braves-primary);
}

[data-braves-theme="dark"] .braves-dashboard__nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--braves-primary-light);
}

[data-braves-theme="dark"] .braves-dashboard__header {
    background: var(--braves-surface);
    border-bottom-color: rgba(255, 255, 255, 0.07);
}

[data-braves-theme="dark"] .braves-dashboard__nav {
    background: var(--braves-surface-elevated);
    border-right-color: rgba(255, 255, 255, 0.06);
}

[data-braves-theme="dark"] .braves-tab-header {
    background-color: #0c0c0c;
    border-bottom-color: rgba(255, 255, 255, 0.07);
}

[data-braves-theme="dark"] .braves-about__grid .column {
    background: var(--braves-surface-alt);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ============================================
   Tab Content Area
   ============================================ */

.braves-dashboard__tab-content {
    padding: 0 32px;
    flex: 1;
}

.braves-tab-header {
    padding: 26px 32px 20px;
    position: sticky;
    background-color: var(--braves-surface);
    top: 32px;
    z-index: 1;
    margin-inline: -32px;
    border-bottom: 1px solid var(--braves-border-color);
    height: 95px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.braves-tab-header.no-border {
    border-bottom: 0;
    height: 80px;
}

/* ============================================
   Sections
   ============================================ */

.braves-section {
    margin: 32px auto;
    max-width: var(--braves-dashboard-width);
}

.braves-section h2 {
    font-size: 1.125rem;
    margin: 16px 0;
}

.braves-section p {
    margin-top: 0;
    line-height: 1.6;
    color: var(--braves-text-secondary);
}

/* ============================================
   Grid Layout
   ============================================ */

.braves-about__grid {
    margin: 24px auto;
    display: grid;
    grid-gap: 24px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.braves-about__grid.columns-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.braves-about__grid .column {
    padding: 28px 24px;
    background-color: var(--braves-surface-alt);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.braves-about__grid .column>svg {
    width: 30px;
    height: 30px;
    margin-left: -3px;
}

.braves-about__grid .column h2 {
    font-size: 1.125rem;
    margin: 8px 0;
}

.braves-about__grid .column p {
    margin: 0;
    flex: 1;
}

.braves-about__grid .column>.components-button:last-child {
    margin-top: auto;
}

/* ============================================
   Buttons
   ============================================ */

.braves-buttons {
    margin-top: 4px;
    margin-bottom: 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.components-button.is-link {
    color: var(--wp-components-color-accent);
    text-decoration: none;
}

.components-button.is-link:hover {
    color: var(--wp-components-color-accent-darker-10);
    text-decoration: underline;
}

.components-button.is-link:focus {
    box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent);
    border-radius: 2px;
}

.components-button.is-primary {
    background-color: var(--wp-components-color-accent);
    border-color: var(--wp-components-color-accent);
}

.components-button.is-primary:hover {
    background-color: var(--wp-components-color-accent-darker-10);
    border-color: var(--wp-components-color-accent-darker-10);
}

.components-button.is-primary:active:disabled {
    color: hsla(0, 0%, 100%, 0.4);
}

.components-button.is-secondary {
    border: 1px solid var(--braves-border-color);
}

.components-button.is-secondary:hover {
    border-color: var(--braves-text-primary);
}

/* ============================================
   Responsive Design
   ============================================ */

@media screen and (max-width: 782px) {
    .braves-dashboard__header {
        top: 0;
        padding-left: 24px;
        width: 100%;
        border-right: 0;
    }

    .braves-dashboard__tabs {
        grid-template-columns: 1fr;
    }

    .braves-dashboard__nav {
        position: relative;
        top: 0;
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--braves-border-color);
    }

    .braves-about__grid,
    .braves-about__grid.columns-3 {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 600px) {
    .braves-about__grid {
        grid-template-columns: 1fr;
    }

    .braves-dashboard__tab-content {
        padding: 0 16px;
    }

    .braves-tab-header {
        padding: 20px 16px;
        margin-inline: -16px;
    }
}

/* ============================================
   WordPress Components Integration
   ============================================ */

.braves-chat-admin-page .components-external-link,
.braves-chat-admin-page .components-menu-item__button:focus {
    color: var(--wp-components-color-accent);
}

.braves-chat-admin-page .components-external-link:focus {
    box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent);
    border-radius: 2px;
}

/* ============================================
   Notices
   ============================================ */

.braves-dashboard .components-notice {
    margin: 20px 0;
    padding-block: 11px;
}

/* ============================================
   Utilities
   ============================================ */

.braves-dashboard .text-center {
    text-align: center;
}

.braves-dashboard .mt-0 {
    margin-top: 0;
}

.braves-dashboard .mb-0 {
    margin-bottom: 0;
}

/* ============================================
   Loading States
   ============================================ */

.braves-dashboard__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.braves-dashboard__loading .components-spinner {
    margin: 0;
}

/* ============================================
   Empty States
   ============================================ */

.braves-dashboard__empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--braves-text-muted);
}

.braves-dashboard__empty svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.braves-dashboard__empty h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--braves-text-primary);
}

.braves-dashboard__empty p {
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}