/* =========================================================
   Intranet Core - style.css
   Capa ligera sobre W3.CSS
   ========================================================= */

/* ---------- Variables base ---------- */
:root{
    --bg: #f1f3f6;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #d9e1ea;
    --primary: #1e88e5;
    --primary-dark: #1565c0;
    --success-bg: #e8f5e9;
    --success-border: #b7dfba;
    --danger-bg: #fdecea;
    --danger-border: #f3b7b1;
    --warning-bg: #fff8e1;
    --warning-border: #f0d58a;
    --shadow: 0 10px 30px rgba(0,0,0,.08);
    --radius: 10px;
    --radius-sm: 6px;
    --max-content: 1180px;
}

/* ---------- Base ---------- */
html, body{
    background: var(--bg);
    color: var(--text);
}

body{
    font-family: Verdana, Arial, sans-serif;
}

a{
    color: var(--primary);
    text-decoration: none;
}

a:hover{
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ---------- Utilidades layout ---------- */
.app-container{
    max-width: var(--max-content);
    margin: 0 auto;
}

.page-wrap{
    padding: 24px 16px;
}

.card-soft{
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-soft-header{
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

.card-soft-body{
    padding: 20px;
}

/* ---------- Tipografía ---------- */
.page-title{
    margin: 0 0 8px 0;
    font-size: 28px;
    line-height: 1.2;
    font-weight: 600;
    color: var(--text);
}

.page-subtitle{
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.section-title{
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}

.text-muted{
    color: var(--muted) !important;
}

.small-note{
    font-size: 12px;
    color: var(--muted);
}

/* ---------- Formularios ---------- */
label{
    display: inline-block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text);
}

.w3-input,
.w3-select,
textarea{
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.w3-input:focus,
.w3-select:focus,
textarea:focus{
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(30,136,229,.12);
}

input[disabled],
select[disabled],
textarea[disabled]{
    background: #f3f4f6;
    color: #777;
}

/* ---------- Botones ---------- */
.w3-button{
    border-radius: var(--radius-sm);
    transition: transform .05s ease, opacity .15s ease, box-shadow .15s ease;
}

.w3-button:active{
    transform: translateY(1px);
}

.btn-primary{
    background: var(--primary) !important;
    color: #fff !important;
}

.btn-primary:hover{
    background: var(--primary-dark) !important;
    color: #fff !important;
}

.btn-secondary{
    background: #eef2f7 !important;
    color: var(--text) !important;
    border: 1px solid var(--border);
}

.btn-secondary:hover{
    background: #e3eaf3 !important;
    color: var(--text) !important;
}

/* Evita el hover gris agresivo de W3 en botones clave */
.w3-button.btn-primary:hover,
.w3-button.btn-secondary:hover{
    box-shadow: 0 6px 18px rgba(0,0,0,.08);
    text-decoration: none;
}

/* ---------- Alertas ---------- */
.alert{
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.alert-success{
    background: var(--success-bg);
    border-color: var(--success-border);
}

.alert-danger{
    background: var(--danger-bg);
    border-color: var(--danger-border);
}

.alert-warning{
    background: var(--warning-bg);
    border-color: var(--warning-border);
}

/* ---------- Login / pantallas públicas ---------- */
.auth-wrap{
    max-width: 520px;
    margin: 60px auto;
    padding: 0 12px;
}

.auth-card{
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.auth-header{
    padding: 24px 24px 8px 24px;
    text-align: center;
}

.auth-title{
    margin: 0;
    font-size: 28px;
    font-weight: 700;
}

.auth-subtitle{
    margin: 8px 0 0 0;
    color: var(--muted);
    font-size: 14px;
}

.auth-body{
    padding: 8px 24px 24px 24px;
}

.auth-footer{
    padding: 0 24px 24px 24px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

.auth-footer p{
    margin: 8px 0;
}

/* ---------- Tablas ---------- */
.table-wrap{
    overflow-x: auto;
}

.w3-table-all,
.w3-table{
    background: #fff;
}

.w3-table-all th{
    background: #f8fafc;
    font-weight: 700;
}

.w3-table-all th,
.w3-table-all td,
.w3-table th,
.w3-table td{
    border-color: var(--border) !important;
}

/* ---------- Sidebar / navegación ---------- */
.sidebar-brand{
    padding: 18px 16px;
    font-weight: 700;
    font-size: 18px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}

.sidebar-user{
    padding: 12px 16px;
    font-size: 13px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    background: #fafbfd;
}

.w3-sidebar{
    border-right: 1px solid var(--border);
}

.w3-sidebar .w3-bar-item{
    border-bottom: 1px solid rgba(0,0,0,.03);
}

.w3-sidebar .w3-bar-item.active{
    background: #e8f1fb;
    color: var(--primary-dark);
    font-weight: 700;
}

.w3-sidebar .w3-bar-item:hover{
    background: #f3f7fb !important;
    color: var(--text) !important;
    text-decoration: none;
}

.sidebar-icon{
    width: 18px;
    margin-right: 8px;
    text-align: center;
    opacity: .7;
}

/* ---------- Cabecera interna ---------- */
.topbar{
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
}

.topbar-title{
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

/* ---------- Badges ---------- */
.badge{
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    line-height: 1.6;
    border-radius: 999px;
    background: #eef2f7;
    color: var(--text);
    border: 1px solid var(--border);
}

.badge-success{
    background: var(--success-bg);
    border-color: var(--success-border);
    color: #2e7d32;
}

.badge-danger{
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: #b71c1c;
}

.badge-warning{
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: #795400;
}

.badge-inactive{
    background: #f3f4f6;
    border-color: #d1d5db;
    color: var(--muted);
}

.badge-info{
    background: #e3f2fd;
    border-color: #90caf9;
    color: #0d47a1;
}

/* ---------- Espaciados útiles ---------- */
.mt-0{margin-top:0!important;}
.mt-8{margin-top:8px!important;}
.mt-16{margin-top:16px!important;}
.mt-24{margin-top:24px!important;}
.mb-0{margin-bottom:0!important;}
.mb-8{margin-bottom:8px!important;}
.mb-16{margin-bottom:16px!important;}
.mb-24{margin-bottom:24px!important;}
.ml-8{margin-left:8px!important;}

/* ---------- Acciones en tablas ---------- */
.user-actions{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    align-items:center;
}

.inline-form{
    display:inline;
    margin:0;
}

.link-button{
    background:none;
    border:none;
    padding:0;
    margin:0;
    color:var(--primary);
    cursor:pointer;
    text-decoration:none;
    font:inherit;
}

.link-button:hover{
    color:var(--primary-dark);
    text-decoration:underline;
}

.link-button:disabled{
    color:var(--muted);
    cursor:not-allowed;
    text-decoration:none;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px){
    .auth-wrap{
        margin-top: 24px;
    }

    .auth-header{
        padding: 20px 18px 8px 18px;
    }

    .auth-body,
    .auth-footer{
        padding-left: 18px;
        padding-right: 18px;
    }

    .page-wrap{
        padding: 16px 10px;
    }

    .page-title{
        font-size: 24px;
    }
}

/* ==========================================================
   ESTILOS DE MÓDULO — NO añadir aquí estilos específicos
   de ningún módulo. Cada módulo gestiona sus propios estilos.
   ========================================================== */

/* ---------- Z-index móvil: sidebar siempre encima del overlay ---------- */
#appSidebar {
    z-index: 4;
}

#sidebarOverlay {
    z-index: 3;
}

/* ---------- Campana de notificaciones del topbar (v3.2) ---------- */
.notif-bell {
    position: relative;
    text-decoration: none;
    font-size: 1.1rem;
    display: inline-block;
    padding-right: 6px;
}

.notif-badge {
    position: absolute;
    top: -8px;
    right: -6px;
    background: #e53935;
    color: #fff;
    border-radius: 10px;
    font-size: 0.7rem;
    line-height: 1;
    padding: 3px 5px;
    min-width: 16px;
    text-align: center;
}
