/* ============ RESET ============ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f3f4f6;           /* gris muy claro */
    color: #111827;                /* gris muy oscuro (texto) */
}

/* Paleta inspirada en Papagayo */
:root {
    --ps-primary: #14b8a6;         /* turquesa */
    --ps-primary-soft: #ccfbf1;
    --ps-primary-strong: #0f766e;
    --ps-accent: #f97373;          /* coral suave */
    --ps-border: #e5e7eb;
    --ps-muted: #6b7280;
    --ps-card-bg: #ffffff;
}

/* ============ LAYOUT ============ */

.app-shell {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ============ SIDEBAR ============ */

.sidebar {
    background: #ffffff;
    border-right: 1px solid var(--ps-border);
    width: 250px;
    padding: 1rem 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: 6px 0 18px rgba(15, 23, 42, 0.04);
    z-index: 30;
}

/* Cabecera dentro del sidebar */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-logo {
    background: var(--ps-primary);
    color: #ffffff;
    border-radius: 999px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 6px 14px rgba(20, 184, 166, 0.4);
}

/* Si quisieras usar el logo: */
/*
.brand-logo-img {
    height: 32px;
}
*/

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 0.95rem;
    font-weight: 600;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--ps-muted);
}

/* Botón de cerrar en móvil (oculto en escritorio) */
.sidebar-close {
    border: none;
    background: transparent;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--ps-muted);
    display: none;
}

/* Menú lateral */
.menu {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.5rem;
}

.menu-item {
    border-radius: 0.7rem;
    border: 1px solid transparent;
    background: transparent;
    padding: 0.55rem 0.7rem;
    text-align: left;
    font-size: 0.83rem;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        transform 0.08s ease,
        box-shadow 0.12s ease;
}

.menu-item::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: transparent;
}

.menu-item:hover {
    background: #f9fafb;
    border-color: var(--ps-border);
    transform: translateY(-1px);
}

.menu-item.active {
    background: var(--ps-primary-soft);
    border-color: var(--ps-primary);
    color: var(--ps-primary-strong);
    box-shadow: 0 10px 20px rgba(20, 184, 166, 0.25);
}

.menu-item.active::before {
    background: var(--ps-primary-strong);
}

/* Backdrop para móvil */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.18s ease;
}

/* ============ TOPBAR + MAIN ============ */

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 56px;
    padding: 0 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid var(--ps-border);
    background: rgba(243, 244, 246, 0.88);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-toggle {
    border: none;
    background: transparent;
    font-size: 1.2rem;
    cursor: pointer;
    display: none; /* solo móvil */
    color: #4b5563;
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Contenido */
.main {
    flex: 1;
    padding: 1.2rem 1.4rem 1.5rem;
}

.view-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 1100px;
    margin: 0 auto;
}

/* ============ CARDS ============ */

.card {
    background: var(--ps-card-bg);
    border-radius: 0.9rem;
    padding: 1rem;
    border: 1px solid var(--ps-border);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.card-subtitle {
    font-size: 0.78rem;
    color: var(--ps-muted);
}

/* Listas simples */
.list {
    margin-top: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.list-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.list-item span {
    color: var(--ps-muted);
}

/* ============ TABLAS ============ */

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.45rem 0.35rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.8rem;
}

th {
    color: #4b5563;
    font-weight: 600;
    background: #f9fafb;
}

/* ============ FORMULARIOS ============ */

label {
    font-size: 0.78rem;
    color: var(--ps-muted);
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.48rem 0.7rem;
    border-radius: 0.7rem;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    font-size: 0.8rem;
    outline: none;
    transition:
        border-color 0.13s ease,
        box-shadow 0.13s ease,
        background 0.13s ease;
}

input::placeholder,
textarea::placeholder {
    color: #9ca3af;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--ps-primary);
    box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.35);
    background: #ffffff;
}

/* Botones */
button {
    font-family: inherit;
}

button[type="submit"],
.btn-primary {
    padding: 0.48rem 1.1rem;
    border-radius: 999px;
    border: none;
    background: var(--ps-primary);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    transition:
        background 0.12s ease,
        box-shadow 0.12s ease,
        transform 0.07s ease;
    box-shadow: 0 8px 18px rgba(20, 184, 166, 0.4);
}

button[type="submit"]:hover,
.btn-primary:hover {
    background: var(--ps-primary-strong);
    transform: translateY(-1px);
}

button[type="submit"]:active,
.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 6px 12px rgba(20, 184, 166, 0.35);
}

/* Mensajes */
.text-success {
    color: #16a34a;
    font-size: 0.78rem;
}

.text-error {
    color: #ea580c;
    font-size: 0.78rem;
}

.text-muted {
    color: var(--ps-muted);
    font-size: 0.78rem;
}

/* ============ RESPONSIVE ============ */

/* MÓVIL: sidebar oculto, se abre desde la izquierda */
@media (max-width: 767px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100%;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 12px 0 30px rgba(15, 23, 42, 0.2);
    }

    .sidebar-close {
        display: inline-flex;
    }

    .topbar-toggle {
        display: inline-flex;
    }

    .main {
        padding: 1rem 0.9rem 1.3rem;
    }
}

/* Cuando el body tiene la clase .sidebar-open, mostramos menú y backdrop */
body.sidebar-open .sidebar {
    transform: translateX(0);
}

body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
}

/* ESCRITORIO: sidebar siempre visible, sin backdrop ni botón hamburguesa */
@media (min-width: 768px) {
    .sidebar-backdrop {
        display: none;
    }

    .topbar-toggle {
        display: none;
    }

    .sidebar {
        transform: translateX(0) !important;
    }
}

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    background: var(--ps-primary);
    color: white;
}
.btn-small:hover {
    background: var(--ps-primary-strong);
}
.modal.hidden {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal-content {
    background: white;
    padding: 1.3rem;
    border-radius: 0.9rem;
    width: 90%;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    background: var(--ps-primary);
    color: #ffffff;
}

/* Modal básico */
.modal.hidden {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal-content {
    background: #ffffff;
    padding: 1.3rem;
    border-radius: 0.9rem;
    width: 90%;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hidden {
    display: none !important;
}

.card.hidden {
    display: none !important;
}
