/*
 * assets/css/app.css
 * Antes cada página (index.php, finalizadas.php, login.php) repetía un
 * bloque <style> casi idéntico. Ahora todo vive en un único archivo que
 * además el service worker puede cachear para que la app cargue rápido
 * y funcione sin conexión.
 */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --warning-color: #f59e0b;
    --bg-body: #f8fafc;
    --sidebar-width: 260px;
    --dark-bg: #1e293b;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

html, body { height: 100%; margin: 0; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: #1e293b;
    display: flex;
    overflow-x: hidden;
}

/* ---------- SIDEBAR ---------- */
#sidebar {
    width: var(--sidebar-width);
    background: var(--dark-bg);
    color: #fff;
    transition: all .3s cubic-bezier(.4,0,.2,1);
    position: fixed;
    height: 100%;
    z-index: 1050;
    display: flex;
    flex-direction: column;
}
#sidebar .sidebar-header { padding: 20px; background: #0f172a; text-align: center; }
#sidebar ul.components { padding: 20px 0; }
#sidebar ul li a { padding: 15px 25px; display: block; color: #cbd5e1; text-decoration: none; transition: .3s; }
#sidebar ul li a:hover, #sidebar ul li.active > a { color: #fff; background: var(--primary-color); }
#sidebar ul li a i { margin-right: 10px; width: 20px; text-align: center; }

/* ---------- CONTENIDO PRINCIPAL ---------- */
.content-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    transition: all .3s;
}
.main-content { flex: 1 0 auto; }

.navbar { background: #fff; border-bottom: 2px solid var(--primary-color); padding: .8rem 0; }

#sidebarCollapse {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1100;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
#sidebarOverlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,.5);
    z-index: 1040;
}

@media (max-width: 992px) {
    #sidebar { margin-left: calc(-1 * var(--sidebar-width)); }
    #sidebar.active { margin-left: 0; }
    #sidebarOverlay.active { display: block; }
    .content-wrapper { width: 100%; margin-left: 0; }
    #sidebarCollapse { display: flex; align-items: center; justify-content: center; }
    .navbar-brand img { width: 110px !important; }
}

/* ---------- BLOQUES COMUNES ---------- */
.main-header {
    padding: 1.5rem 0;
    background: linear-gradient(to right, #fff, #f1f5f9);
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.card-custom {
    border: none;
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--card-shadow);
    transition: all .2s ease;
    height: 100%;
    border-top: 5px solid #cbd5e1;
}
.card-custom:hover { transform: translateY(-3px); }

.status-Registrado { border-top-color: #64748b; }
.status-Pendiente { border-top-color: var(--warning-color); }
.status-En-Proceso { border-top-color: #3b82f6; }
.status-Retrasada { border-top-color: var(--danger-color); }

.motivo-box { background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: .5rem .75rem; }

.btn-add {
    background-color: var(--primary-color);
    border: none;
    padding: .6rem 1.5rem;
    font-weight: 600;
    border-radius: 8px;
}

.card-finalizada {
    border: none;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / .1);
    border-top: 5px solid var(--success-color);
    transition: transform .2s ease;
}
.card-finalizada:hover { transform: translateY(-4px); }

.stamp-success {
    color: var(--success-color);
    font-weight: bold;
    text-transform: uppercase;
    border: 2px solid var(--success-color);
    padding: 2px 10px;
    border-radius: 6px;
    font-size: .7rem;
    letter-spacing: 1px;
}

footer { flex-shrink: 0; background: #fff; border-top: 1px solid #e2e8f0; }

/* ---------- LOGIN ---------- */
.login-wrap {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.login-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04);
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
}
.login-card .brand-logo { width: 70px; height: auto; margin-bottom: 1rem; }
.btn-login {
    background: var(--primary-color);
    border: none;
    border-radius: 10px;
    padding: .75rem;
    font-weight: 700;
}
.btn-login:hover { background: var(--primary-dark); }

/* ---------- UTILIDADES ---------- */
.offline-banner {
    background: #fef3c7;
    color: #92400e;
    text-align: center;
    font-size: .8rem;
    padding: .4rem;
    position: sticky;
    top: 0;
    z-index: 1200;
}

.skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #edf2f7 37%, #e2e8f0 63%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease infinite;
    border-radius: 10px;
    height: 140px;
}
@keyframes skeleton-loading {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

.task-actions .btn { padding: .2rem .5rem; font-size: .75rem; }

.badge-role-Admin { background: #2563eb; }
.badge-role-Tecnico { background: #64748b; }
