/* ============================================================
   AcvenisMail - Estilos principales
   ACVENISPROH® Ecuador
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --primary-subtle: #e0e7ff;
    --sidebar-width: 260px;
    --sidebar-bg: #1e1b4b;
    --sidebar-text: #c7d2fe;
    --sidebar-active: #ffffff;
    --header-height: 60px;
    --body-bg: #f1f5f9;
    --card-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --transition: .2s ease;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ---- Base ---- */
*,
*::before,
*::after { box-sizing: border-box; }

body {
    font-family: var(--font-family);
    background: var(--body-bg);
    color: #1e293b;
    margin: 0;
}

/* ---- Utilities ---- */
.fw-600 { font-weight: 600 !important; }
.text-gray-600 { color: #64748b !important; }
.required-field::after {
    content: ' *';
    color: #dc3545;
    font-weight: 600;
}

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: .375rem;
}
@keyframes skeleton-pulse {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Button loading */
.btn-loading {
    pointer-events: none;
    opacity: .65;
    position: relative;
}
.btn-loading::after {
    content: '';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner .6s linear infinite;
    margin-left: .5rem;
    vertical-align: middle;
}
@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    padding: 1rem;
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: #ffffff;
    border-radius: 1rem;
    padding: 2.5rem 2rem 2rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo-wrap {
    margin-bottom: .75rem;
}

.login-brand-symbol {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.brand-institution {
    font-size: .75rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: .25rem;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1e1b4b;
    margin: 0;
}

.login-subtitle {
    color: #64748b;
    font-size: .9rem;
    margin: .25rem 0 0;
}

.login-card .form-floating .form-control {
    border-radius: .5rem;
}

.login-card .btn-primary {
    width: 100%;
    border-radius: .5rem;
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
    padding: .75rem;
}
.login-card .btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: .78rem;
    color: #94a3b8;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform var(--transition);
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    color: #fff;
}
.sidebar-brand:hover { color: #fff; }

.sidebar-brand-img {
    border-radius: .5rem;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.brand-badge {
    font-size: .65rem;
    font-weight: 600;
    color: #a5b4fc;
    text-transform: uppercase;
    letter-spacing: .06em;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: .75rem 0;
}

.nav-section {
    margin-bottom: .5rem;
}

.nav-section-title {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #818cf8;
    padding: .5rem 1.25rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 500;
    border-radius: 0;
    transition: background var(--transition), color var(--transition);
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: rgba(99,102,241,.25);
    color: #fff;
    font-weight: 600;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,.08);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: .85rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: .7rem;
    color: #a5b4fc;
}

.sidebar-footer .btn-outline-primary {
    color: #a5b4fc;
    border-color: rgba(165,180,252,.3);
    padding: .25rem .5rem;
}
.sidebar-footer .btn-outline-primary:hover {
    background: rgba(99,102,241,.2);
    color: #fff;
    border-color: #818cf8;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1035;
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-header {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.header-left {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.page-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
}

.page-content {
    flex: 1;
    padding: 1.5rem;
}

/* ---- Cards ---- */
.card {
    border: none;
    border-radius: .75rem;
    box-shadow: var(--card-shadow);
    background: #fff;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    padding: 1rem 1.25rem;
    border-radius: .75rem .75rem 0 0 !important;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* ---- Buttons (override Bootstrap primary) ---- */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* ---- Breadcrumb ---- */
.breadcrumb {
    font-size: .85rem;
}

/* ---- Toast container ---- */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1080;
}

/* ---- Table tweaks ---- */
.table th {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
}

/* ---- Batch progress ---- */
.batch-progress-container {
    position: relative;
}

.batch-progress-bar {
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    overflow: hidden;
}

.batch-progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width .3s ease;
    border-radius: 4px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 575.98px) {
    .login-card {
        padding: 2rem 1.25rem 1.5rem;
    }
    .page-content {
        padding: 1rem;
    }
}
