/* =========================================================
   SKYNET - ESTILOS GENERALES
   ========================================================= */

:root {
    --color-primary: #16a6a1;
    --color-primary-dark: #118781;

    --color-sidebar: #172333;
    --color-sidebar-hover: #26384c;
    --color-sidebar-text: #c5cfda;

    --color-background: #f3f5f8;
    --color-surface: #ffffff;

    --color-text: #202a36;
    --color-text-secondary: #718096;

    --color-border: #e2e7ed;

    --color-success: #24b47e;

    --sidebar-width: 250px;
    --header-height: 76px;
    --footer-height: 38px;

    --radius: 10px;
}

/* =========================================================
   RESET Y CONFIGURACIÓN GENERAL
   ========================================================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--color-background);
    color: var(--color-text);
    font-size: 14px;
}

button,
textarea,
input {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

/* =========================================================
   ESTRUCTURA PRINCIPAL
   ========================================================= */

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =========================================================
   CABECERA
   ========================================================= */

.topbar {
    height: var(--header-height);
    min-height: var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--color-primary);
    color: white;

    font-size: 25px;
    font-weight: bold;
}

.brand h1 {
    margin: 0;
    font-size: 19px;
    letter-spacing: 2px;
    font-weight: 700;
}

.brand span {
    display: block;
    margin-top: 4px;
    color: var(--color-text-secondary);
    font-size: 11px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-secondary);
    font-size: 12px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
}

/* =========================================================
   DISTRIBUCIÓN CENTRAL
   ========================================================= */

.main-layout {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* =========================================================
   MENÚ LATERAL
   ========================================================= */

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);

    background: var(--color-sidebar);
    color: var(--color-sidebar-text);

    padding: 25px 14px;
}

.sidebar-heading {
    padding: 0 12px;
    margin-bottom: 16px;

    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1.5px;
    color: #8292a5;
}

.main-navigation {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link {
    min-height: 42px;
    padding: 0 12px;

    display: flex;
    align-items: center;
    gap: 12px;

    border-radius: 7px;

    color: var(--color-sidebar-text);
    font-size: 13px;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.nav-link:hover {
    background: var(--color-sidebar-hover);
    color: white;
}

.nav-link.active {
    background: var(--color-primary);
    color: white;
    font-weight: bold;
}

.nav-icon {
    width: 19px;
    text-align: center;
    font-size: 17px;
}

.nav-separator {
    height: 1px;
    background: #344253;
    margin: 12px 8px;
}

/* =========================================================
   ÁREA DE CONTENIDO
   ========================================================= */

.content-area {
    flex: 1;
    min-width: 0;
    padding: 30px;
}

.page-header {
    margin-bottom: 25px;
}

.page-header h2 {
    margin: 0;
    font-size: 23px;
    font-weight: 600;
}

.page-header p {
    margin: 7px 0 0;
    color: var(--color-text-secondary);
    font-size: 13px;
}

/* =========================================================
   CONVERSACIÓN
   ========================================================= */

.conversation-container {
    min-height: 500px;
    height: calc(100vh - 205px);

    display: flex;
    flex-direction: column;

    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);

    overflow: hidden;
}

.conversation-messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
}

.message {
    max-width: 800px;
    margin-bottom: 22px;
}

.message-author {
    margin-bottom: 9px;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--color-primary-dark);
}

.message-content {
    padding: 15px 18px;
    border-radius: 9px;

    background: #f3f6f9;
    color: var(--color-text);

    line-height: 1.6;
    font-size: 14px;
}

.conversation-input {
    display: flex;
    align-items: flex-end;
    gap: 12px;

    padding: 18px 22px;
    border-top: 1px solid var(--color-border);
}

.conversation-input textarea {
    flex: 1;
    resize: vertical;
    min-height: 48px;
    max-height: 180px;

    padding: 13px 14px;

    border: 1px solid var(--color-border);
    border-radius: 8px;

    outline: none;
    background: #fafbfc;
    color: var(--color-text);
}

.conversation-input textarea:focus {
    border-color: var(--color-primary);
}

.conversation-input button {
    min-width: 90px;
    height: 46px;

    border: none;
    border-radius: 8px;

    background: var(--color-primary);
    color: white;
    font-weight: bold;
}

.conversation-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.conversation-note {
    padding: 0 22px 14px;
    text-align: center;

    color: var(--color-text-secondary);
    font-size: 11px;
}

/* =========================================================
   BARRA INFERIOR
   ========================================================= */

.statusbar {
    height: var(--footer-height);
    min-height: var(--footer-height);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 22px;

    background: var(--color-surface);
    border-top: 1px solid var(--color-border);

    color: var(--color-text-secondary);
    font-size: 11px;
}

/* =========================================================
   ADAPTACIÓN A TABLETAS
   ========================================================= */

@media (max-width: 900px) {

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

    .content-area {
        padding: 22px;
    }

    .sidebar {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* =========================================================
   ADAPTACIÓN A MÓVILES
   ========================================================= */

@media (max-width: 650px) {

    .topbar {
        padding: 0 15px;
    }

    .brand h1 {
        font-size: 17px;
    }

    .brand span {
        font-size: 10px;
    }

    .system-status {
        font-size: 0;
    }

    .main-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        padding: 10px;
    }

    .sidebar-heading {
        display: none;
    }

    .main-navigation {
        flex-direction: row;
        overflow-x: auto;
        gap: 5px;
    }

    .nav-link {
        flex: 0 0 auto;
        min-height: 38px;
        padding: 0 11px;
        font-size: 12px;
    }

    .nav-icon {
        display: none;
    }

    .nav-separator {
        display: none;
    }

    .content-area {
        padding: 18px 12px;
    }

    .conversation-container {
        height: calc(100vh - 245px);
        min-height: 350px;
    }

    .conversation-messages {
        padding: 18px;
    }

    .conversation-input {
        padding: 12px;
        gap: 8px;
    }

    .conversation-input button {
        min-width: 65px;
    }

    .statusbar {
        padding: 0 12px;
        font-size: 10px;
    }
}

/* =========================================================
   MODO OSCURO
   ========================================================= */

body.dark-mode {
    --color-primary: #20b8b1;
    --color-primary-dark: #38c8c0;

    --color-sidebar: #111b29;
    --color-sidebar-hover: #26384c;
    --color-sidebar-text: #c5cfda;

    --color-background: #151b24;
    --color-surface: #202936;

    --color-text: #e5eaf0;
    --color-text-secondary: #9aa8b8;

    --color-border: #354252;

    --color-success: #35c98b;
}

/* Superficies y elementos con colores propios */

body.dark-mode .message-content {
    background: #2a3645;
    color: var(--color-text);
}

body.dark-mode .conversation-input textarea {
    background: #18222e;
    color: var(--color-text);
    border-color: var(--color-border);
}

body.dark-mode .conversation-input textarea::placeholder {
    color: #8292a5;
}

body.dark-mode .nav-separator {
    background: #354252;
}

/* =========================================================
   SELECTOR DE TEMA
   ========================================================= */

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.theme-selector {
    min-width: 115px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.theme-selector:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}