/* =====================================================
   DEVQUIS CONTROL - Estilos del Sistema
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Colores principales */
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --primary-light: #e8ecfd;
    --secondary: #6c757d;
    --success: #2ec27e;
    --warning: #f5a623;
    --danger: #e74c3c;
    --info: #3498db;

    /* Fondo y superficies */
    --bg-body: #f0f2f5;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    --bg-sidebar-active: #4361ee;
    --bg-card: #ffffff;
    --bg-navbar: #ffffff;

    /* Texto */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-sidebar: #94a3b8;
    --text-sidebar-active: #ffffff;

    /* Bordes */
    --border-color: #e2e8f0;
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);

    /* Transiciones */
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.875rem;
    background-color: var(--bg-body);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* =====================================================
   LOGIN PAGE
   ===================================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #4361ee 100%);
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: rgba(67, 97, 238, 0.15);
    top: -200px;
    right: -200px;
    animation: float 6s ease-in-out infinite;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(67, 97, 238, 0.1);
    bottom: -150px;
    left: -150px;
    animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.login-logo h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.login-logo .logo-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.4);
}

.login-card .form-control {
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.65rem 0.85rem 0.65rem 2.75rem;
    font-size: 0.875rem;
    transition: var(--transition);
    background-color: #f8fafc;
}

.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
    background-color: #fff;
}

.login-card .input-group {
    position: relative;
}

.login-card .input-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    z-index: 5;
    font-size: 1rem;
}

.login-card .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--border-radius);
    padding: 0.65rem 1.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.login-card .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

.login-card .form-check-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.login-card .forgot-link {
    font-size: 0.8rem;
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

.login-card .forgot-link:hover {
    color: var(--primary-dark);
}

/* =====================================================
   SIDEBAR
   ===================================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--bg-sidebar-hover);
    border-radius: 2px;
}

.sidebar-header {
    padding: 1.25rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header .sidebar-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    border-radius: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-header h5 {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    white-space: nowrap;
}

.sidebar-header small {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: block;
}

.sidebar-menu {
    list-style: none;
    padding: 0.75rem 0;
    margin: 0;
}

.sidebar-menu .menu-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 1rem 1.25rem 0.5rem;
}

.sidebar-menu .menu-item {
    margin: 1px 0.6rem;
}

.sidebar-menu .menu-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    color: var(--text-sidebar);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-size: 0.82rem;
    font-weight: 400;
}

.sidebar-menu .menu-item a:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}

.sidebar-menu .menu-item a.active {
    background: var(--bg-sidebar-active);
    color: #fff;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
}

.sidebar-menu .menu-item a i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-menu .menu-item .badge {
    margin-left: auto;
    font-size: 0.65rem;
    padding: 0.2em 0.55em;
}

/* Sidebar Collapsed State (PC) */
.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-header h5,
.sidebar.collapsed .sidebar-header small {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 1.25rem 0;
}

.sidebar.collapsed .menu-label {
    display: none;
}

.sidebar.collapsed .menu-item a span,
.sidebar.collapsed .menu-item .badge {
    display: none;
}

.sidebar.collapsed .menu-item a {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .menu-item a i {
    font-size: 1.25rem;
}

/* =====================================================
   MAIN CONTENT
   ===================================================== */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* =====================================================
   TOP NAVBAR
   ===================================================== */

.top-navbar {
    background: var(--bg-navbar);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow-sm);
}

.top-navbar .navbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* =====================================================
   SIDEBAR COLLAPSED (PC)
   ===================================================== */
@media (min-width: 992px) {
    .sidebar.collapsed {
        width: 76px;
    }

    .sidebar.collapsed .sidebar-header {
        padding: 1.25rem 0.75rem;
        justify-content: center;
    }

    .sidebar.collapsed .sidebar-header div {
        display: none;
    }

    .sidebar.collapsed .sidebar-header img {
        height: 30px;
    }

    .sidebar.collapsed .sidebar-menu .menu-label {
        display: none;
    }

    .sidebar.collapsed .sidebar-menu .menu-item a {
        padding: 0.8rem 0;
        justify-content: center;
    }
    
    .sidebar.collapsed .sidebar-menu .menu-item a span,
    .sidebar.collapsed .sidebar-menu .menu-item a .badge {
        display: none;
    }

    .sidebar.collapsed .sidebar-menu .menu-item a i {
        margin: 0 !important;
        font-size: 1.3rem;
    }

    .sidebar.collapsed + .main-content {
        margin-left: 76px;
    }
}

.top-navbar .sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.top-navbar .sidebar-toggle:hover {
    background: var(--bg-body);
    color: var(--primary);
}

.top-navbar .page-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

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

.navbar-icon-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 1.15rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.navbar-icon-btn:hover {
    background: var(--bg-body);
    color: var(--primary);
}

.navbar-icon-btn .notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-navbar);
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-primary);
}

.user-dropdown:hover {
    background: var(--bg-body);
}

.user-dropdown .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.8rem;
}

.user-dropdown .user-info {
    line-height: 1.2;
}

.user-dropdown .user-info .user-name {
    font-size: 0.8rem;
    font-weight: 600;
}

.user-dropdown .user-info .user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* =====================================================
   PAGE CONTENT
   ===================================================== */

.page-content {
    padding: 1.5rem;
}

/* =====================================================
   CARDS
   ===================================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card {
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-card .stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-card .stat-icon.success { background: rgba(46,194,126,0.12); color: var(--success); }
.stat-card .stat-icon.warning { background: rgba(245,166,35,0.12); color: var(--warning); }
.stat-card .stat-icon.danger { background: rgba(231,76,60,0.12); color: var(--danger); }
.stat-card .stat-icon.info { background: rgba(52,152,219,0.12); color: var(--info); }

.stat-card .stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.stat-card .stat-info p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 0.15rem 0 0;
}

.stat-card .stat-info .stat-change {
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.stat-card .stat-info .stat-change.up { color: var(--success); }
.stat-card .stat-info .stat-change.down { color: var(--danger); }

/* =====================================================
   TABLE STYLES
   ===================================================== */

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-container .table-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.table-container .table-header h5 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.table {
    margin: 0;
    font-size: 0.82rem;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    padding: 0.75rem 1rem;
}

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

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

/* =====================================================
   BADGES / STATUS
   ===================================================== */

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3em 0.65em;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-status.activo { background: rgba(46,194,126,0.12); color: var(--success); }
.badge-status.prospecto { background: rgba(67,97,238,0.12); color: var(--primary); }
.badge-status.inactivo { background: rgba(100,116,139,0.12); color: var(--secondary); }
.badge-status.pendiente { background: rgba(245,166,35,0.12); color: var(--warning); }
.badge-status.vencido, .badge-status.cancelado { background: rgba(231,76,60,0.12); color: var(--danger); }
.badge-status.completado, .badge-status.finalizado { background: rgba(46,194,126,0.12); color: var(--success); }
.badge-status.diseno, .badge-status.pruebas { background: rgba(52,152,219,0.12); color: var(--info); }
.badge-status.desarrollo, .badge-status.implementacion, .badge-status.capacitacion { background: rgba(67,97,238,0.12); color: var(--primary); }

/* =====================================================
   BUTTONS
   ===================================================== */

.btn {
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    padding: 0.45rem 1rem;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 575.98px) {
    .page-content {
        padding: 1rem;
    }

    .login-card {
        padding: 1.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card .stat-info h3 {
        font-size: 1.25rem;
    }

    /* Navbar compact */
    .top-navbar {
        padding: 0 0.75rem;
        height: 54px;
    }
    .top-navbar .page-title {
        font-size: 0.88rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 130px;
    }
    .navbar-icon-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    /* Tables: ensure horizontal scroll */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    .table {
        font-size: 0.78rem;
    }
    .table th, .table td {
        padding: 0.45rem 0.5rem;
        white-space: nowrap;
    }

    /* Cards compact */
    .card-body {
        padding: 1rem;
    }

    /* Buttons compact */
    .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.85rem;
    }

    /* Hide action column text on very small screens */
    .btn-action-text { display: none; }

    /* Stat cards grid */
    .row.g-4 > * { margin-bottom: 0; }
}

@media (max-width: 767.98px) {
    /* Tables always scrollable on tablets */
    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    /* Stack action buttons */
    .d-flex.gap-2.flex-wrap-mobile { flex-wrap: wrap; }
    /* Page title smaller */
    .top-navbar .page-title { font-size: 0.9rem; }
}

/* =====================================================
   ANIMATIONS
   ===================================================== */

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =====================================================
   SCROLLBAR GLOBAL
   ===================================================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
