/* ============================================================
   CORREO SMART
   Archivo: public/css/app.css
   CSS global
   Solo ASCII
   ============================================================ */

:root {
    --cs-primary: #2563eb;
    --cs-primary-dark: #1d4ed8;
    --cs-primary-soft: #dbeafe;
    --cs-slate-950: #020617;
    --cs-slate-900: #0f172a;
    --cs-slate-800: #1e293b;
    --cs-slate-700: #334155;
    --cs-slate-600: #475569;
    --cs-slate-500: #64748b;
    --cs-slate-400: #94a3b8;
    --cs-slate-300: #cbd5e1;
    --cs-slate-200: #e2e8f0;
    --cs-slate-100: #f1f5f9;
    --cs-slate-50: #f8fafc;
    --cs-white: #ffffff;
    --cs-danger: #dc2626;
    --cs-danger-soft: #fef2f2;
    --cs-success: #059669;
    --cs-success-soft: #ecfdf5;
    --cs-warning: #ea580c;
    --cs-warning-soft: #fff7ed;
    --cs-radius-lg: 18px;
    --cs-radius-xl: 24px;
    --cs-shadow-card: 0 25px 80px rgba(15, 23, 42, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: var(--cs-slate-900);
    background: var(--cs-slate-100);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

/* ============================================================
   AUTH
   ============================================================ */

.cs-auth-page {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 10%, rgba(37, 99, 235, 0.10), transparent 32%),
        linear-gradient(135deg, #f8fbff 0%, #eef5ff 45%, #e8f0ff 100%);
}

.cs-auth-page::before {
    content: "";
    position: absolute;
    width: 780px;
    height: 780px;
    left: -330px;
    bottom: -280px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.08);
}

.cs-auth-page::after {
    content: "";
    position: absolute;
    width: 620px;
    height: 620px;
    right: -260px;
    bottom: -220px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.08);
}

.cs-dots {
    position: absolute;
    width: 180px;
    height: 150px;
    opacity: 0.38;
    background-image: radial-gradient(rgba(37, 99, 235, 0.38) 2px, transparent 2px);
    background-size: 22px 22px;
    pointer-events: none;
}

.cs-dots-top {
    top: 44px;
    right: 78px;
}

.cs-dots-bottom {
    left: 58px;
    bottom: 78px;
}

.cs-auth-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 520px;
    border: 1px solid rgba(203, 213, 225, 0.8);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--cs-shadow-card);
    backdrop-filter: blur(16px);
}

.cs-logo-box {
    width: 82px;
    height: 82px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--cs-primary), #1d4ed8);
    color: var(--cs-white);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 16px 32px rgba(37, 99, 235, 0.30);
}

.cs-input-group {
    position: relative;
}

.cs-input-icon {
    position: absolute;
    left: 1px;
    top: 1px;
    width: 56px;
    height: calc(100% - 2px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cs-primary-dark);
    border-right: 1px solid var(--cs-slate-200);
    background: rgba(248, 250, 252, 0.8);
    border-radius: 14px 0 0 14px;
}

.cs-input {
    width: 100%;
    border: 1px solid var(--cs-slate-300);
    border-radius: 14px;
    padding: 16px 54px 16px 72px;
    font-size: 15px;
    outline: none;
    background: var(--cs-white);
    color: var(--cs-slate-900);
    transition: all 0.2s ease;
}

.cs-input:focus {
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.cs-input::placeholder {
    color: #94a3b8;
}

.cs-password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    border: none;
    background: transparent;
    cursor: pointer;
}

.cs-btn-primary {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 16px 22px;
    color: var(--cs-white);
    background: linear-gradient(135deg, var(--cs-primary), #1d4ed8);
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 18px 34px rgba(37, 99, 235, 0.26);
    transition: all 0.2s ease;
}

.cs-btn-primary:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.cs-alert-danger {
    border: 1px solid #fecaca;
    background: var(--cs-danger-soft);
    color: var(--cs-danger);
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
}

.cs-alert-success {
    border: 1px solid #bbf7d0;
    background: var(--cs-success-soft);
    color: var(--cs-success);
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
}

.cs-security-box {
    border: 1px solid #bfdbfe;
    background: rgba(239, 246, 255, 0.78);
    color: #1d4ed8;
    border-radius: 16px;
}

.cs-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--cs-slate-500);
    font-size: 13px;
}

.cs-divider::before,
.cs-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--cs-slate-200);
}

/* ============================================================
   SIDEBAR BASE
   ============================================================ */

#appSidebar {
    box-shadow: 20px 0 60px rgba(2, 6, 23, 0.22);
}

.sidebar-brand,
.sidebar-user-card,
.sidebar-env-card,
.sidebar-link,
.sidebar-title,
.sidebar-form {
    min-width: 0;
}

.sidebar-link {
    min-height: 48px;
    position: relative;
}

.sidebar-link:hover {
    transform: translateX(2px);
}

.sidebar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sidebar-text {
    transition:
        opacity 0.2s ease,
        width 0.2s ease,
        margin 0.2s ease;
}

.sidebar-title {
    letter-spacing: 0.11em;
}

.cs-sidebar-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.cs-sidebar-scroll::-webkit-scrollbar {
    width: 6px;
}

.cs-sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.cs-sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 999px;
}

.cs-sidebar-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.55);
}

/* ============================================================
   SIDEBAR DESKTOP COLAPSABLE
   ============================================================ */

@media (min-width: 1024px) {

    body.sidebar-collapsed #appSidebar {
        width: 88px !important;
        min-width: 88px !important;
        max-width: 88px !important;
    }

    body.sidebar-collapsed .sidebar-text,
    body.sidebar-collapsed .sidebar-title {
        opacity: 0;
        width: 0 !important;
        max-width: 0 !important;
        overflow: hidden;
        pointer-events: none;
        margin: 0 !important;
    }

    body.sidebar-collapsed .sidebar-section {
        overflow: hidden;
    }

    body.sidebar-collapsed .sidebar-brand {
        justify-content: center;
    }

    body.sidebar-collapsed .sidebar-logo {
        margin-left: auto;
        margin-right: auto;
    }

    body.sidebar-collapsed .sidebar-user-card {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    body.sidebar-collapsed .sidebar-user-card > div {
        justify-content: center;
    }

    body.sidebar-collapsed #appSidebar nav {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    body.sidebar-collapsed #appSidebar nav a {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    body.sidebar-collapsed .sidebar-icon {
        width: auto !important;
        min-width: auto !important;
        margin: 0;
        font-size: 18px;
    }

    body.sidebar-collapsed .sidebar-env-card {
        display: none;
    }

    body.sidebar-collapsed .sidebar-form {
        min-width: auto !important;
    }

    body.sidebar-collapsed .sidebar-logout {
        padding-left: 0;
        padding-right: 0;
    }

    body.sidebar-collapsed #appSidebar .rounded-2xl {
        min-width: auto !important;
    }

    body.sidebar-collapsed #appSidebar p,
    body.sidebar-collapsed #appSidebar h1 {
        white-space: nowrap;
    }

}

/* ============================================================
   SIDEBAR MOBILE
   ============================================================ */

@media (max-width: 1023px) {

    #appSidebar {
        width: 288px !important;
        min-width: 288px !important;
        max-width: 288px !important;
    }

    body.sidebar-collapsed #appSidebar {
        width: 288px !important;
        min-width: 288px !important;
        max-width: 288px !important;
    }

    body.sidebar-collapsed .sidebar-text,
    body.sidebar-collapsed .sidebar-title {
        opacity: 1;
        width: auto !important;
        max-width: none !important;
        pointer-events: auto;
    }

    body.sidebar-collapsed .sidebar-env-card {
        display: block;
    }

}

/* ============================================================
   DASHBOARD HELPERS
   ============================================================ */

.cs-card {
    background: #ffffff;
    border: 1px solid var(--cs-slate-200);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.cs-card-soft {
    background: #ffffff;
    border: 1px solid var(--cs-slate-200);
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.cs-table {
    width: 100%;
    border-collapse: collapse;
}

.cs-table th {
    font-weight: 800;
    color: var(--cs-slate-500);
    background: #f8fafc;
}

.cs-table td,
.cs-table th {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

.cs-table tr:hover td {
    background: #f8fafc;
}

.cs-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 800;
}

.cs-badge-blue {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #dbeafe;
}

.cs-badge-green {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #bbf7d0;
}

.cs-badge-orange {
    background: #fff7ed;
    color: #ea580c;
    border: 1px solid #fed7aa;
}

.cs-badge-red {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.cs-badge-slate {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* ============================================================
   FORM HELPERS
   ============================================================ */

.cs-form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--cs-slate-700);
    font-size: 0.875rem;
    font-weight: 800;
}

.cs-form-input {
    width: 100%;
    border: 1px solid var(--cs-slate-300);
    border-radius: 1rem;
    background: #ffffff;
    padding: 0.85rem 1rem;
    outline: none;
    transition: all 0.2s ease;
}

.cs-form-input:focus {
    border-color: var(--cs-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* ============================================================
   RESPONSIVE FIXES
   ============================================================ */

@media (max-width: 767px) {

    .cs-auth-card {
        border-radius: 22px;
    }

    .cs-logo-box {
        width: 72px;
        height: 72px;
    }

    .cs-input {
        padding-left: 64px;
        padding-right: 48px;
    }

    .cs-table td,
    .cs-table th {
        padding: 12px 16px;
        white-space: nowrap;
    }

}

/* ============================================================
   PRINT
   ============================================================ */

@media print {

    #appSidebar,
    #appHeader,
    #appFooter,
    #sidebarBackdrop {
        display: none !important;
    }

    body {
        background: #ffffff !important;
    }

}