/* ============================================================
   DESIGN SYSTEM — Variables globales y componentes reutilizables
   Importar este archivo en todos los templates.
   ============================================================ */

/* ── Fuentes ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Tokens de diseño ── */
:root {
    /* Marca: logo raster (decoración y barras laterales) */
    --brand-logo-url: url("../img/Logo.png");

    /* Paleta principal */
    --color-primary:        #4F46E5;
    --color-primary-hover:  #4338CA;
    --color-primary-light:  #EEF2FF;
    --color-primary-dark:   #3730A3;

    /* Neutros */
    --color-bg:             #F8FAFC;
    --color-surface:        #FFFFFF;
    --color-surface-raised: #FFFFFF;
    --color-border:         #E2E8F0;
    --color-border-focus:   #4F46E5;

    /* Texto */
    --color-text-primary:   #0F172A;
    --color-text-secondary: #475569;
    --color-text-muted:     #94A3B8;
    --color-text-inverse:   #FFFFFF;

    /* Estado */
    --color-success:        #10B981;
    --color-success-light:  #D1FAE5;
    --color-error:          #EF4444;
    --color-error-light:    #FEE2E2;
    --color-warning:        #F59E0B;
    --color-warning-light:  #FEF3C7;

    /* Tipografía */
    --font-family:          'Inter', system-ui, -apple-system, sans-serif;
    --font-size-xs:         0.75rem;
    --font-size-sm:         0.875rem;
    --font-size-base:       1rem;
    --font-size-lg:         1.125rem;
    --font-size-xl:         1.25rem;
    --font-size-2xl:        1.5rem;
    --font-size-3xl:        1.875rem;

    /* Espaciado */
    --space-1:  0.25rem;
    --space-2:  0.5rem;
    --space-3:  0.75rem;
    --space-4:  1rem;
    --space-5:  1.25rem;
    --space-6:  1.5rem;
    --space-8:  2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Bordes */
    --radius-sm:  0.375rem;
    --radius-md:  0.5rem;
    --radius-lg:  0.75rem;
    --radius-xl:  1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Sombras */
    --shadow-sm:  0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md:  0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg:  0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --shadow-xl:  0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.04);

    /* Transiciones */
    --transition-fast:   150ms ease;
    --transition-base:   200ms ease;
    --transition-slow:   300ms ease;
}

/* ── Logo de marca (PNG) ── */
.brand-logo-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-logo-img--mini {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Capa decorativa: misma imagen, posición/tamaño/ángulo por clase en cada layout */
.brand-logo-deco {
    position: absolute;
    background-image: var(--brand-logo-url);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    pointer-events: none;
}

/* ── Reset base ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--color-text-primary);
    background-color: var(--color-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Componente: Input ── */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.input-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-primary);
}

.input-field {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-field::placeholder {
    color: var(--color-text-muted);
}

.input-field:focus {
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px rgb(79 70 229 / 0.12);
}

.input-field.error {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px rgb(239 68 68 / 0.1);
}

.input-wrapper {
    position: relative;
}

.input-wrapper .input-icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
    width: 18px;
    height: 18px;
}

.input-wrapper .input-field {
    padding-left: 2.5rem;
}

.input-wrapper .input-action {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0;
    display: flex;
    align-items: center;
    transition: color var(--transition-fast);
}

.input-wrapper .input-action:hover { color: var(--color-text-secondary); }

.input-error-msg {
    font-size: var(--font-size-xs);
    color: var(--color-error);
    display: none;
}

.input-error-msg.visible { display: block; }

/* ── Componente: Button ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1.5px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
    white-space: nowrap;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}
.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
    box-shadow: 0 4px 12px rgb(79 70 229 / 0.35);
}

.btn-block { width: 100%; }

/* ── Componente: Alert ── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    display: none;
}

.alert.visible { display: flex; }

.alert-error {
    background: var(--color-error-light);
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-success {
    background: var(--color-success-light);
    color: #065F46;
    border: 1px solid #A7F3D0;
}

/* ── Spinner de carga ── */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgb(255 255 255 / 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}

.spinner.visible { display: inline-block; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Decoración lateral: Logo.png en barras (main + owner) ── */
.sidebar-bg-deco {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.main-sidebar > :not(.sidebar-bg-deco),
.owner-sidebar > :not(.sidebar-bg-deco) {
    position: relative;
    z-index: 1;
}

.sidebar-bg-deco .sidebar-deco-1 {
    width: 240px;
    height: 240px;
    top: -70px;
    right: -55px;
    transform: rotate(21deg);
    opacity: 0.05;
}

.sidebar-bg-deco .sidebar-deco-2 {
    width: 190px;
    height: 190px;
    bottom: 22%;
    left: -75px;
    transform: rotate(-17deg);
    opacity: 0.036;
}

.sidebar-bg-deco .sidebar-deco-3 {
    width: 130px;
    height: 130px;
    top: 38%;
    right: -35px;
    transform: rotate(33deg);
    opacity: 0.045;
}

.sidebar-bg-deco .sidebar-deco-4 {
    width: 200px;
    height: 200px;
    bottom: -60px;
    right: -40px;
    transform: rotate(-9deg);
    opacity: 0.04;
}

.sidebar-bg-deco .sidebar-deco-5 {
    width: 100px;
    height: 100px;
    top: 12%;
    left: 10px;
    transform: rotate(-28deg);
    opacity: 0.032;
}

.sidebar-bg-deco .sidebar-deco-6 {
    width: 160px;
    height: 160px;
    top: 52%;
    left: -50px;
    transform: rotate(14deg);
    opacity: 0.028;
}

/* Banner dashboard: marcas muy suaves */
.welcome-banner .welcome-deco-1 {
    width: 240px;
    height: 240px;
    top: -56px;
    right: -44px;
    transform: rotate(16deg);
    opacity: 0.042;
}

.welcome-banner .welcome-deco-2 {
    width: 300px;
    height: 300px;
    bottom: -78px;
    left: 18%;
    transform: rotate(-13deg);
    opacity: 0.03;
}

.welcome-banner .welcome-deco-3 {
    width: 140px;
    height: 140px;
    top: 20%;
    left: 8%;
    transform: rotate(39deg);
    opacity: 0.048;
}

.welcome-banner .welcome-deco-4 {
    width: 180px;
    height: 180px;
    bottom: 10%;
    right: 12%;
    transform: rotate(-24deg);
    opacity: 0.034;
}

.welcome-banner .welcome-deco-5 {
    width: 110px;
    height: 110px;
    top: 8%;
    right: 28%;
    transform: rotate(7deg);
    opacity: 0.055;
}
