﻿/* ==========================================================================
   TEMA EMPRESA - MINIMAL ENTERPRISE UI (SaaS Design)
   Color Principal: #003576
========================================================================== */
:root {
    --color-primario: #003576;
    --color-primario-hover: #002350;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --color-borde: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --secondary: #3b82f6;
    --night-bg: #eef4ff;
    --night-header: #e0ebff;
    --multi-ot: #8b5cf6;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

button {
    font-family: inherit;
    outline: none;
}

/* =========================================================
   1. LAYOUT Y SIDEBAR
========================================================= */
.layout-app {
    display: flex;
    min-height: 100vh;
}

.sidenav {
    width: var(--sidebar-width);
    background-color: var(--bg-white);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    border-right: 1px solid var(--color-borde);
    transition: transform 0.3s ease;
}

.sidenav-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid var(--color-borde);
}

.avatar-circle {
    width: 56px;
    height: 56px;
    border: 2px solid var(--color-borde);
    background-color: var(--bg-light);
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px auto;
    border-radius: 12px;
    color: var(--color-primario);
}

.user-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.nav-list {
    flex: 1;
    padding: 20px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    transition: var(--transition);
}

    .nav-link i {
        width: 24px;
        font-size: 1.1rem;
        margin-right: 12px;
        text-align: center;
        opacity: 0.8;
    }

    .nav-link:hover {
        background-color: var(--bg-light);
        color: var(--text-main);
    }

    .nav-link.active {
        background-color: #e0ebff;
        color: var(--color-primario);
    }

        .nav-link.active i {
            opacity: 1;
        }

.sidenav-footer {
    padding: 20px 12px;
    border-top: 1px solid var(--color-borde);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
    min-width: 0;
    overflow-x: hidden;
}

.page-container {
    padding: 30px 40px;
    flex: 1;
    min-width: 0;
}

.top-header {
    display: flex;
    padding: 15px 40px;
    background: var(--bg-light);
    align-items: center;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

    .top-header h3 {
        color: var(--color-primario);
        font-weight: 700;
        font-size: 1.1rem;
        margin: 0;
    }

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
}

    .menu-toggle:hover {
        color: var(--color-primario);
    }

body.sidebar-collapsed .sidenav {
    transform: translateX(-100%);
}

body.sidebar-collapsed .main-content {
    margin-left: 0;
}

/* =========================================================
   2. COMPONENTES ESTRUCTURALES GLOBAL
========================================================= */
.dashboard-grid {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.panel {
    background: var(--bg-white);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--color-borde);
    box-shadow: var(--shadow-card);
}

.form-panel {
    flex: 1;
    min-width: 320px;
}

.list-panel {
    flex: 2.5;
    min-width: 600px;
}

.aps-title {
    color: var(--text-main);
    font-size: 1.4rem;
    margin-bottom: 24px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* =========================================================
   3. LOGIN PREMIUM (Estilo SaaS Minimalista)
========================================================= */
body.bg-login-premium {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background-color: var(--bg-light);
    /* Sutil gradiente radial para dar profundidad sin usar imágenes */
    background-image: radial-gradient(circle at center, #ffffff 0%, var(--bg-light) 100%);
}

.login-premium-card {
    background: var(--bg-white);
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-modal);
    border: 1px solid var(--color-borde);
    text-align: center;
}

.login-logo-box {
    width: 64px;
    height: 64px;
    background: var(--bg-light);
    border: 1px solid var(--color-borde);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    font-size: 1.8rem;
    color: var(--color-primario);
    box-shadow: var(--shadow-sm);
}

.login-premium-card h2 {
    color: var(--text-main);
    font-weight: 800;
    font-size: 1.8rem;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.login-premium-card p.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 30px;
}

/* Float Labels adaptados a SaaS Moderno */
.input-minimal-group {
    position: relative;
    margin-bottom: 24px;
    text-align: left;
}

    .input-minimal-group input {
        width: 100%;
        padding: 14px 16px;
        font-size: 1rem;
        color: var(--text-main);
        border: 1px solid var(--color-borde);
        border-radius: 12px;
        outline: none;
        background: var(--bg-white);
        transition: var(--transition);
        font-family: inherit;
    }

        .input-minimal-group input:focus {
            border-color: var(--secondary);
            box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
        }

    .input-minimal-group label {
        position: absolute;
        top: 15px;
        left: 16px;
        font-size: 1rem;
        color: var(--text-muted);
        pointer-events: none;
        transition: var(--transition);
        background: var(--bg-white);
        padding: 0 4px;
    }

    /* Magia del Float Label */
    .input-minimal-group input:focus ~ label,
    .input-minimal-group input:not(:placeholder-shown) ~ label {
        top: -10px;
        left: 12px;
        font-size: 0.8rem;
        color: var(--secondary);
        font-weight: 700;
    }

.login-eye-icon {
    position: absolute;
    right: 16px;
    top: 16px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    transition: 0.2s;
}

    .login-eye-icon:hover {
        color: var(--text-main);
    }

    .login-eye-icon.active {
        color: var(--secondary);
    }

.btn-login {
    width: 100%;
    padding: 14px;
    font-size: 1.05rem;
    border-radius: 12px;
    margin-top: 5px;
}

.alert-minimal {
    background-color: #fef2f2;
    color: #dc2626;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 20px;
    border: 1px solid #fecaca;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   4. FORMULARIOS GENERALES
========================================================= */
.form-group {
    margin-bottom: 20px;
}

    .form-group label {
        display: block;
        margin-bottom: 8px;
        font-weight: 600;
        font-size: 0.85rem;
        color: var(--text-muted);
    }

    .form-group input, .form-group select, .form-control, .input-modern {
        width: 100%;
        padding: 12px 16px;
        border: 1px solid var(--color-borde);
        border-radius: 10px;
        font-size: 0.95rem;
        outline: none;
        background: var(--bg-white);
        color: var(--text-main);
        transition: var(--transition);
        font-family: inherit;
        box-shadow: var(--shadow-sm);
    }

        .form-group input:focus, .form-group select:focus, .form-control:focus, .input-modern:focus {
            border-color: var(--secondary);
            box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
        }

        .form-group input::placeholder, .form-control::placeholder, .input-modern::placeholder {
            color: #94a3b8;
        }

/* =========================================================
   5. BOTONES ENTERPRISE
========================================================= */
.btn-premium, .btn-action-sec, .btn-create-ot, .btn-action-prog {
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-premium {
    background-color: var(--color-primario);
    color: white;
    padding: 12px 24px;
    box-shadow: var(--shadow-sm);
}

    .btn-premium:hover {
        background-color: var(--color-primario-hover);
        transform: translateY(-2px);
        box-shadow: var(--shadow-card);
    }

.btn-action-sec {
    background-color: var(--bg-light);
    color: var(--text-muted);
    padding: 10px 16px;
    border: 1px solid var(--color-borde);
}

    .btn-action-sec:hover {
        background-color: #f1f5f9;
        color: var(--text-main);
    }

.btn-create-ot {
    background-color: var(--success);
    color: white;
    padding: 12px 24px;
    box-shadow: var(--shadow-sm);
}

    .btn-create-ot:hover {
        background-color: #059669;
        transform: translateY(-2px);
        box-shadow: var(--shadow-card);
    }

.btn-action-prog {
    background-color: var(--warning);
    color: black;
    padding: 6px 10px;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px;
    border-radius: 8px;
    transition: 0.2s;
    color: var(--text-muted);
}

    .btn-icon:hover {
        background-color: var(--bg-light);
        color: var(--text-main);
    }

/* =========================================================
   6. TABLAS LIMPIAS (Baja carga cognitiva)
========================================================= */
.table-scroll-container {
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid var(--color-borde);
    border-radius: 12px;
    background: white;
}

.ot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 0;
}

    .ot-table th {
        background-color: var(--bg-white);
        color: var(--text-muted);
        font-weight: 600;
        padding: 16px;
        text-align: left;
        border-bottom: 2px solid var(--color-borde);
        font-size: 0.8rem;
        position: sticky;
        top: 0;
        z-index: 2;
    }

    .ot-table td {
        padding: 16px;
        text-align: left;
        border-bottom: 1px solid #f1f5f9;
        vertical-align: middle;
        color: var(--text-main);
    }

    .ot-table tbody tr {
        transition: background 0.2s;
    }

        .ot-table tbody tr:hover {
            background-color: #f8fafc;
        }

/* =========================================================
   7. PESTAÑAS (TABS) - Estilo Segmented Control
========================================================= */
.aps-tabs {
    display: inline-flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    gap: 4px;
    margin-bottom: 24px;
}

.aps-tab-btn {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
    /* 🟢 AÑADIDO: Flexbox para alinear el icono con el texto */
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

    .aps-tab-btn:hover {
        color: var(--text-main);
    }

    .aps-tab-btn.active {
        background: white;
        color: var(--color-primario);
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

.aps-tab-content {
    display: none;
}

    .aps-tab-content.active {
        display: block;
        animation: fadeIn 0.3s ease-in-out;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
   8. MODALES (Minimalistas)
========================================================= */
.aps-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 20px;
}

.aps-modal-content {
    background-color: #fff;
    margin: 2vh auto;
    padding: 32px;
    border-radius: 20px;
    width: 100%;
    max-width: 900px;
    position: relative;
    box-shadow: var(--shadow-modal);
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--color-borde);
}

@keyframes slideDown {
    from {
        transform: translateY(-20px) scale(0.98);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.aps-close-btn {
    position: absolute;
    right: 24px;
    top: 24px;
    font-size: 24px;
    font-weight: 300;
    color: #94a3b8;
    cursor: pointer;
    transition: 0.2s;
    background: #f1f5f9;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

    .aps-close-btn:hover {
        background: #fee2e2;
        color: var(--danger);
    }

/* =========================================================
   9. BADGES (Etiquetas de Estado)
========================================================= */
.aps-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
}

    .aps-badge.success {
        background-color: #ecfdf5;
        color: #059669;
        border-color: #a7f3d0;
    }

    .aps-badge.danger {
        background-color: #fef2f2;
        color: #dc2626;
        border-color: #fecaca;
    }

    .aps-badge.warning {
        background-color: #fffbeb;
        color: #d97706;
        border-color: #fde68a;
    }

    .aps-badge.info {
        background-color: #f0f9ff;
        color: #0284c7;
        border-color: #bae6fd;
    }

    .aps-badge.multi {
        background-color: #f5f3ff;
        color: #7c3aed;
        border-color: #ddd6fe;
    }

/* =========================================================
   10. TARJETAS DE INICIO (Dashboard Cards)
========================================================= */
.home-dashboard-header {
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease-out;
}

    .home-dashboard-header h2 {
        color: var(--text-main);
        font-family: inherit;
        font-size: 2.2rem;
        margin-bottom: 5px;
        font-weight: 800;
        letter-spacing: -0.5px;
    }

.home-card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 32px 24px;
    border: 1px solid var(--color-borde);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    animation: fadeInUp 0.6s ease-out backwards;
}

    .home-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-card);
        border-color: var(--secondary);
    }

.home-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    transition: transform 0.3s ease;
}

.home-card:hover .home-card-icon {
    transform: scale(1.05);
}

.icon-gantt {
    background: #f0f9ff;
    color: #0284c7;
}

.icon-proc {
    background: #fffbeb;
    color: #d97706;
}

.icon-term {
    background: #ecfdf5;
    color: #059669;
}

.icon-user {
    background: #f5f3ff;
    color: #7c3aed;
}

.icon-log {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.home-card h4 {
    margin: 0;
    font-weight: 700;
    font-size: 1.2rem;
}

.home-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
