/* ============================================================
   SAD - Sistema de Administración de Documentos
   Estilo Minimalista Académico - LIMPIO
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f1f5f9;
    color: #334155;
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR - FIJO A LA IZQUIERDA
   ============================================ */
.main-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: #1e3a5f;
    color: #e2e8f0;
    z-index: 1000;
    overflow-y: auto;
}

/* Quitar estilos de AdminLTE que sobrescriben */
.main-sidebar .sidebar {
    padding: 0;
}

.brand-link {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    gap: 0.75rem;
}

.brand-link i {
    font-size: 1.25rem;
}

/* Navegación del sidebar */
.nav-sidebar {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
}

.nav-sidebar .nav-item {
    margin-bottom: 2px;
    list-style: none;
}

.nav-sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-sidebar .nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.nav-sidebar .nav-link.active {
    background: #0288d1;
    color: white;
}

.nav-sidebar .nav-icon {
    width: 1.25rem;
    text-align: center;
}

/* ============================================
   CONTENT WRAPPER - CON MARGEN PARA EL SIDEBAR
   ============================================ */
.content-wrapper {
    margin-left: 260px;
    margin-top: 60px;
    width: calc(100% - 260px); /* 👈 CLAVE */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin-right: 10px;
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
    position: fixed; /* 👈 clave */
    top: 0;
    left: 260px; /* 👈 ancho del sidebar */
    width: calc(100% - 260px);
    height: 50px;
    
    background: white;
    border-bottom: 1px solid #e2e8f0;

    display: flex;
    align-items: center;
    justify-content: flex-end;

    padding: 0 20px;
    z-index: 1100;
}

.navbar-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1200; /* extra seguridad */
}

.nav-link {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
}

.nav-link:hover {
    color: #1e3a5f;
}

.position-relative {
    position: relative;
}

.badge-notify {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #c62828;
    color: white;
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    font-weight: 600;
}

/* Dropdown */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    min-width: 300px;
    z-index: 1000;
    margin-top: 0.5rem;
    display: none;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 0.625rem 1rem;
    color: #334155;
    text-decoration: none;
    font-size: 0.8125rem;
    border-bottom: 1px solid #f1f5f9;
}

.dropdown-item:hover {
    background: #f8fafc;
}

/* ============================================
   CONTENT
   ============================================ */
.content-header {
    padding: 1rem 1.5rem 0;
}

.content-header h5 {
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
}

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

/* ============================================
   CARDS
   ============================================ */
.card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.card-header {
    padding: 0.875rem 1.25rem;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-body {
    padding: 1.25rem;
}

/* ============================================
   TABLAS
   ============================================ */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}

.table tr:hover {
    background: #f8fafc;
}

/* ============================================
   BOTONES
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
}

.btn-primary {
    background: #1e3a5f;
    border-color: #1e3a5f;
    color: white;
}

.btn-primary:hover {
    background: #0f2b45;
}

.btn-success {
    background: #2e7d32;
    border-color: #2e7d32;
    color: white;
}

.btn-danger {
    background: #c62828;
    border-color: #c62828;
    color: white;
}

.btn-warning {
    background: #ed6c02;
    border-color: #ed6c02;
    color: white;
}

.btn-outline-primary {
    background: transparent;
    border-color: #cbd5e1;
    color: #475569;
}

.btn-outline-primary:hover {
    background: #f1f5f9;
}

.btn-outline-danger {
    background: transparent;
    border-color: #cbd5e1;
    color: #c62828;
}

.btn-outline-danger:hover {
    background: #c62828;
    color: white;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 20px;
}

.bg-success { background: #2e7d32; color: white; }
.bg-danger { background: #c62828; color: white; }
.bg-warning { background: #ed6c02; color: white; }
.bg-info { background: #0288d1; color: white; }
.bg-secondary { background: #94a3b8; color: white; }
.bg-primary { background: #1e3a5f; color: white; }

/* ============================================
   PROGRESS
   ============================================ */
.progress {
    background: #e2e8f0;
    border-radius: 20px;
    overflow: hidden;
    height: 6px;
}

.progress-bar-sad {
    background: #0288d1;
    height: 100%;
    transition: width 0.3s;
}

/* ============================================
   ALERTAS
   ============================================ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    position: relative;
}

.alert-success {
    background: #e8f5e9;
    border-left: 3px solid #2e7d32;
    color: #1b5e20;
}

.alert-danger {
    background: #ffebee;
    border-left: 3px solid #c62828;
    color: #b71c1c;
}

.alert-warning {
    background: #fff3e0;
    border-left: 3px solid #ed6c02;
    color: #e65100;
}

.alert-info {
    background: #e1f5fe;
    border-left: 3px solid #0288d1;
    color: #01579b;
}

.btn-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.5;
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form-control,
.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: #0288d1;
    box-shadow: 0 0 0 2px rgba(2,136,209,0.1);
}

.form-label {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    display: block;
    color: #475569;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

/* ============================================
   MODALES - CENTRADOS
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1050;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-dialog {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.modal-content {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h5 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ============================================
   LOGIN
   ============================================ */
.login-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.login-logo {
    font-size: 2rem;
    font-weight: 700;
    color: #1e3a5f;
    text-align: center;
}

.login-logo span {
    color: #0288d1;
}

/* ============================================
   DOCUMENT CARDS
   ============================================ */
.doc-card {
    border-left: 3px solid #0288d1;
    transition: background 0.2s;
}

.doc-card:hover {
    background: #f8fafc;
}

.version-badge {
    display: inline-block;
    background: #e2e8f0;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-family: monospace;
    color: #475569;
}

/* ============================================
   FOOTER - DENTRO DEL CONTENT-WRAPPER
   ============================================ */
.main-footer {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 0.75rem 1.5rem;
    text-align: center;
    font-size: 0.6875rem;
    color: #94a3b8;
    margin-top: auto;
}

/* ============================================
   UTILITIES
   ============================================ */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.75rem;
}

[class*="col-"] {
    padding: 0 0.75rem;
}

.col-12 { width: 100%; }
.col-md-4 { width: 33.333%; }
.col-md-5 { width: 41.666%; }
.col-md-6 { width: 50%; }
.col-md-7 { width: 58.333%; }
.col-md-8 { width: 66.666%; }
.col-lg-4 { width: 33.333%; }
.col-lg-5 { width: 41.666%; }
.col-lg-7 { width: 58.333%; }
.col-lg-8 { width: 66.666%; }

.text-center { text-align: center; }
.text-muted { color: #94a3b8; }
.text-success { color: #2e7d32; }
.text-danger { color: #c62828; }
.text-warning { color: #ed6c02; }
.text-primary { color: #1e3a5f; }

.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-auto { margin-top: auto; }

.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 1rem; padding-bottom: 1rem; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }

.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 1rem; padding-right: 1rem; }

.d-flex { display: flex; }
.d-block { display: block; }

.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

.w-100 { width: 100%; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .main-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .content-wrapper {
        margin-left: 0;
    }
    
    .main-sidebar.mobile-open {
        transform: translateX(0);
    }
}

/* CONTENEDOR DERECHO */
.navbar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* INFO DEL USUARIO */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8fafc;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.user-info i {
    font-size: 1rem;
    color: #0288d1;
}

/* BOTÓN LOGOUT */
.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 20px;
    background: #c62828;
    color: white;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: #b71c1c;
    transform: translateY(-1px);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-name {
    display: flex;
    align-items: center;
    gap: 0.4rem;

    font-size: 0.75rem;
    font-weight: 500;
    color: #475569;

    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;

    transition: all 0.2s;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;

    font-size: 0.75rem;
    font-weight: 500;

    color: #64748b;
    text-decoration: none;

    padding: 0.35rem 0.6rem;
    border-radius: 999px;

    transition: all 0.2s;
}

.logout-btn:hover {
    background: #fef2f2;
    color: #c62828;
}

.logout-btn::before {
    content: "⎋";
    font-size: 0.75rem;
}
.user-name:hover {
    background: #f1f5f9;
}

/* =============================
   USER DROPDOWN MINIMAL
============================= */

/* CONTENEDOR */
.user-dropdown .nav-link {
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    transition: background 0.2s;
}

.user-dropdown .nav-link:hover {
    background: #f1f5f9;
}

/* AVATAR */
.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    
    display: flex;
    align-items: center;
    justify-content: center;

    background: #0288d1;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
}

/* NOMBRE */
.user-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: #334155;
}

/* DROPDOWN */
.user-menu {
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    padding: 0.4rem 0;
    min-width: 180px;
}

/* ROL */
.user-role {
    font-size: 0.7rem;
    color: #64748b;
    padding: 0.5rem 1rem;
}

/* ITEM */
.user-menu .dropdown-item {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    transition: background 0.2s;
}

/* LOGOUT */
.logout-item {
    color: #64748b;
}

.logout-item:hover {
    background: #fef2f2;
    color: #c62828;
}

/* Quitar bullets del dropdown */
.user-menu {
    list-style: none;
    margin: 0;
    padding: 0.4rem 0;
}

.user-menu li {
    list-style: none;
}

/* Quitar bullets en dropdowns (usuario + notificaciones) */
.dropdown-menu,
.dropdown-menu li {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.dropdown-menu {
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

/* Quitar bullets en navbar (campana y user) */
.navbar-nav,
.navbar-nav li {
    list-style: none !important;
    margin: 0;
    padding: 0;
}

.logout-form {
    margin: 0;
}

.logout-form button {
    all: unset; /* 🔥 elimina estilo de botón */
    display: block;
    width: 100%;
    cursor: pointer;
}

/* BADGE DE NOTIFICACIONES */
.badge-notify {
    position: absolute;
    
    top: 2px;     /* 👈 ajusta vertical */
    right: 2px;   /* 👈 ajusta horizontal */

    transform: translate(50%, -50%); /* 👈 lo manda a la esquina real */

    min-width: 16px;
    height: 16px;

    padding: 0 4px;

    font-size: 0.6rem;
    font-weight: 600;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;
    background: #c62828;
    color: white;

    border: 2px solid white; /* 👈 efecto limpio */
}

.nav-link i {
    font-size: 1.1rem;
}

.modal {
    display: none; /* Bootstrap lo maneja */
}

.modal.show {
    display: block;
}

/* centrado sin romper bootstrap */
.modal-dialog {
    margin: auto;
    margin: 120px auto; 
}
