﻿/* =========================================
   VETERINARIAAPP THEME (WhatsApp-inspired)
   - Variables
   - Dark / Light via data-theme
   - Responsive helpers
   - Smooth animations
   ========================================= */

/* ---------- Base tokens (shared) ---------- */
:root {
    /* spacing */
    --r-xs: 10px;
    --r-sm: 12px;
    --r-pill: 999px;
    --s-1: 6px;
    --s-2: 10px;
    --s-3: 14px;
    --s-4: 18px;
    --s-5: 24px;
    /* typography */
    --font: 'Roboto', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    --fs-1: 0.85rem;
    --fs-2: 0.95rem;
    --fs-3: 1.15rem;
    --fs-4: 1.6rem;
    /* motion */
    --t-fast: 120ms;
    --t-med: 180ms;
    --e-out: cubic-bezier(.2,.8,.2,1);
    /* elevation */
    --shadow-1: 0 1px 3px rgba(0,0,0,0.35);
    --shadow-2: 0 6px 18px rgba(0,0,0,0.35);
    /* layout */
    --sidebar-w: 260px;
    /* DEFAULT THEME (dark on first load) */
    --bg: #0b141a;
    --panel: #111b21;
    --panel-2: #1f2c33;
    --text: #e9edef;
    --muted: #8696a0;
    --border: #222;
    --input: #2a3942;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-dark: #1e40af;
    --danger: #d32f2f;
    --success: #16a34a;
    --warning: #f59e0b;
}

    /* ---------- Dark theme ---------- */
    :root[data-theme="dark"] {
        --bg: #0b141a;
        --panel: #111b21;
        --panel-2: #1f2c33;
        --text: #e9edef;
        --muted: #8696a0;
        --border: #222;
        --input: #2a3942;
        --accent: #3b82f6;
        --accent-hover: #2563eb;
        --accent-dark: #1d4ed8;
        --danger: #d32f2f;
        --success: #16a34a;
        --warning: #f59e0b;
    }

    /* ---------- Light theme ---------- */
    :root[data-theme="light"] {
        --bg: #f5f7f8;
        --panel: #ffffff;
        --panel-2: #f0f2f3;
        --text: #111;
        --muted: #5b6b73;
        --border: #d6dade;
        --input: #ffffff;
        --accent: #3b82f6;
        --accent-hover: #2563eb;
        --accent-dark: #1d4ed8;
        --danger: #d32f2f;
        --success: #16a34a;
        --warning: #f59e0b;
    }

/* ---------- Global ---------- */
html, body {
    margin: 0;
    color: var(--text);
    font-family: var(--font);
    position: relative;
}

/* Patrón de puntos con body::before */
body::before {
    content: '' !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 2px, transparent 2px) !important;
    background-size: 30px 30px !important;
    background-attachment: fixed !important;
    pointer-events: none !important;
    z-index: 0 !important;
}

* {
    box-sizing: border-box;
}

/* Solo aplicar z-index a elementos que realmente lo necesitan */
.main-container,
.layout,
.content,
.sidebar,
.page,
.card {
    position: relative;
    z-index: 1;
}

a {
    color: inherit;
}

    /* Only normal links (not buttons) */
    a:not(.btn-primary):not(.btn-sec):not(.btn-danger) {
        color: var(--accent);
        text-decoration: none;
    }

        a:not(.btn-primary):not(.btn-sec):not(.btn-danger):hover {
            text-decoration: underline;
        }

/* ---------- Containers / cards ---------- */
.main-container {
    padding: var(--s-5);
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: var(--s-4);
    box-shadow: var(--shadow-1);
}

    /* Hover lift */
    .card.card-hover {
        transition: transform var(--t-med) var(--e-out), box-shadow var(--t-med) var(--e-out);
    }

        .card.card-hover:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-2);
        }

/* ---------- Buttons ---------- */
.btn-primary, a.btn-primary,
.btn-sec, a.btn-sec,
.btn-danger, a.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: var(--r-pill);
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: var(--fs-2);
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    transition: transform var(--t-fast) var(--e-out), background var(--t-fast) var(--e-out);
}

.btn-primary, a.btn-primary {
    background: var(--accent);
    color: #000;
    border: none;
}

    .btn-primary:hover, a.btn-primary:hover {
        background: var(--accent-hover);
    }

    .btn-primary:active, a.btn-primary:active {
        transform: translateY(1px) scale(0.99);
    }

.btn-sec, a.btn-sec {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
}

    .btn-sec:active, a.btn-sec:active {
        transform: translateY(1px) scale(0.99);
    }

.btn-danger, a.btn-danger {
    background: var(--danger);
    color: #fff;
    border: none;
}

    .btn-danger:active, a.btn-danger:active {
        transform: translateY(1px) scale(0.99);
    }

/* ---------- Inputs ---------- */
.input {
    width: 100%;
    background: var(--input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    padding: 0.55rem 0.6rem;
    font-size: var(--fs-2);
}

    .input:focus {
        outline: 2px solid var(--accent);
        outline-offset: 1px;
    }

/* ---------- Table ---------- */
.table-dark {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--s-4);
    font-size: var(--fs-2);
}

    .table-dark th {
        background: var(--panel-2);
        padding: 0.65rem;
        border-bottom: 1px solid var(--border);
        text-align: left;
    }

    .table-dark td {
        padding: 0.6rem;
        border-bottom: 1px solid var(--border);
    }

    .table-dark tr:hover {
        background: rgba(0,0,0,0.04);
    }

/* ---------- Text ---------- */
.subtle-text {
    color: var(--muted);
}

h1 {
    font-size: var(--fs-4);
    margin: 0 0 var(--s-2) 0;
}

h2 {
    font-size: var(--fs-3);
    margin: 0 0 var(--s-2) 0;
}

h3 {
    font-size: 1.05rem;
    margin: 0 0 var(--s-2) 0;
}

/* ---------- Icons ---------- */
.icon {
    width: 18px;
    height: 18px;
    display: inline-block;
}

    .icon svg {
        width: 100%;
        height: 100%;
    }

        .icon svg * {
            stroke: currentColor;
        }

/* ---------- Page animation ---------- */
.page {
    animation: fadeIn var(--t-med) var(--e-out) both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Layout helpers ---------- */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--panel-2);
    border-right: 1px solid var(--border);
    padding: var(--s-4);
}

.content {
    flex: 1;
    padding: var(--s-5);
}

/* ---------- Mobile ---------- */
.topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 2000;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: var(--s-3) var(--s-4);
}

.drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 2500;
}

.drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: min(85vw, 320px);
    background: var(--panel-2);
    border-right: 1px solid var(--border);
    padding: var(--s-4);
    transform: translateX(-105%);
    transition: transform var(--t-med) var(--e-out);
    z-index: 2600;
}

    .drawer.open {
        transform: translateX(0);
    }

.drawer-backdrop.open {
    display: block;
}

/* ---------- NavMenu chip alignment FIX ---------- */
nav .navlink .chip,
nav a.navlink .chip {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 22px !important;
    line-height: 1 !important;
    transform: translateY(-2px) !important;
}

/* ---------- Typography tuning ---------- */
strong,
.brand-title,
.navlink .txt {
    font-weight: 500;
}

.section-title {
    font-weight: 700;
    letter-spacing: 0.6px;
}

.chip {
    font-weight: 500;
}

.footer,
.footer * {
    font-weight: 400;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .layout {
        display: block;
    }

    .sidebar {
        display: none;
    }

    .content {
        padding: var(--s-4);
    }

    .topbar {
        display: flex;
    }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}