/* =====================================================
   SOLTEC CCTV SAS - Estilos del Sistema
   Diseño moderno inspirado en dashboard ACRU
   ===================================================== */

/* Variables CSS */
:root {
    /* Colores principales */
    --primary: #1a73e8;
    --primary-light: #4285f4;
    --primary-dark: #1557b0;
    --secondary: #34a853;
    --accent: #fbbc04;
    --danger: #ea4335;
    --warning: #ff9800;

    /* Colores de fondo */
    --bg-main: #f8f9fa;
    --bg-card: #ffffff;
    --bg-sidebar: #1a1a2e;
    --bg-sidebar-hover: #16213e;

    /* Colores de texto */
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-muted: #9aa0a6;
    --text-white: #ffffff;

    /* Bordes y sombras */
    --border-color: #e8eaed;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);

    /* Bordes redondeados */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transiciones */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Tamaños */
    --sidebar-width: 280px;
    --header-height: 70px;
}

/* Reset y base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: 1rem;
}

/* =====================================================
   PÁGINA DE LOGIN
   ===================================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(26, 115, 232, 0.1) 0%, transparent 50%);
    animation: pulse 15s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 50px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo img {
    height: 50px;
    margin-bottom: 10px;
}

.login-logo h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

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

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--bg-card);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(26, 115, 232, 0.4);
}

.btn-secondary {
    background: var(--bg-main);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

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

.btn-success {
    background: linear-gradient(135deg, var(--secondary) 0%, #2d9144 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #c62828 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #f57c00 100%);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-sm);
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header img {
    height: 40px;
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-section {
    margin-bottom: 25px;
}

.nav-section-title {
    padding: 0 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: white;
}

.nav-item.active {
    background: var(--bg-sidebar-hover);
    color: white;
    border-left-color: var(--primary);
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Contenido principal */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-main);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    width: 300px;
}

.header-search input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.notification-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-main);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.user-menu:hover {
    background: var(--border-color);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.user-info {
    text-align: left;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

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

/* Page Content */
.page-content {
    padding: 30px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    color: var(--text-secondary);
    margin-top: 5px;
}

/* =====================================================
   CARDS Y WIDGETS
   ===================================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

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

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    background: var(--bg-main);
    border-top: 1px solid var(--border-color);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.blue {
    background: rgba(26, 115, 232, 0.1);
    color: var(--primary);
}

.stat-icon.green {
    background: rgba(52, 168, 83, 0.1);
    color: var(--secondary);
}

.stat-icon.yellow {
    background: rgba(251, 188, 4, 0.1);
    color: var(--accent);
}

.stat-icon.red {
    background: rgba(234, 67, 53, 0.1);
    color: var(--danger);
}

.stat-icon.orange {
    background: rgba(255, 152, 0, 0.1);
    color: var(--warning);
}

.stat-info {
    text-align: right;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    margin-top: 8px;
    padding: 4px 8px;
    border-radius: 20px;
}

.stat-change.positive {
    background: rgba(52, 168, 83, 0.1);
    color: var(--secondary);
}

.stat-change.negative {
    background: rgba(234, 67, 53, 0.1);
    color: var(--danger);
}

/* =====================================================
   ALERTAS POR TIEMPO
   ===================================================== */
.alerts-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.alert-card {
    padding: 20px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 16px;
}

.alert-card.critical {
    background: linear-gradient(135deg, rgba(234, 67, 53, 0.1) 0%, rgba(234, 67, 53, 0.05) 100%);
    border: 1px solid rgba(234, 67, 53, 0.2);
}

.alert-card.high {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.1) 0%, rgba(255, 152, 0, 0.05) 100%);
    border: 1px solid rgba(255, 152, 0, 0.2);
}

.alert-card.medium {
    background: linear-gradient(135deg, rgba(251, 188, 4, 0.1) 0%, rgba(251, 188, 4, 0.05) 100%);
    border: 1px solid rgba(251, 188, 4, 0.2);
}

.alert-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.alert-card.critical .alert-icon {
    background: var(--danger);
    color: white;
}

.alert-card.high .alert-icon {
    background: var(--warning);
    color: white;
}

.alert-card.medium .alert-icon {
    background: var(--accent);
    color: white;
}

.alert-info h4 {
    font-weight: 600;
    margin-bottom: 4px;
}

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

.alert-count {
    margin-left: auto;
    font-size: 2rem;
    font-weight: 700;
}

.alert-card.critical .alert-count {
    color: var(--danger);
}

.alert-card.high .alert-count {
    color: var(--warning);
}

.alert-card.medium .alert-count {
    color: var(--accent);
}

/* =====================================================
   TABLAS
   ===================================================== */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-main);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--bg-main);
}

/* Badges de estado */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-pending {
    background: rgba(251, 188, 4, 0.1);
    color: #b8860b;
}

.badge-assigned {
    background: rgba(26, 115, 232, 0.1);
    color: var(--primary);
}

.badge-progress {
    background: rgba(156, 39, 176, 0.1);
    color: #9c27b0;
}

.badge-completed {
    background: rgba(52, 168, 83, 0.1);
    color: var(--secondary);
}

.badge-cancelled {
    background: rgba(234, 67, 53, 0.1);
    color: var(--danger);
}

.badge-instalacion {
    background: rgba(52, 168, 83, 0.1);
    color: var(--secondary);
}

.badge-preventivo {
    background: rgba(26, 115, 232, 0.1);
    color: var(--primary);
}

.badge-correctivo {
    background: rgba(255, 152, 0, 0.1);
    color: var(--warning);
}

/* =====================================================
   MODALES
   ===================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--border-color);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* =====================================================
   UTILIDADES
   ===================================================== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--secondary);
}

.text-primary {
    color: var(--primary);
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.hidden {
    display: none !important;
}

/* Loader */
.loader {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 16px 24px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    min-width: 300px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid var(--secondary);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.info {
    border-left: 4px solid var(--primary);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

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

    .alerts-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header-search {
        display: none;
    }

    .page-content {
        padding: 20px;
    }

    .modal {
        width: 95%;
        max-width: none;
    }
}

/* =====================================================
   ESTILOS DE ACTIVIDAD RECIENTE
   ===================================================== */
.activity-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    padding-left: 5px;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.icon-primary {
    background: rgba(26, 115, 232, 0.1);
    color: var(--primary);
}

.activity-icon.icon-warning {
    background: rgba(255, 152, 0, 0.1);
    color: var(--warning);
}

.activity-icon.icon-success {
    background: rgba(52, 168, 83, 0.1);
    color: var(--secondary);
}

.activity-icon.icon-danger {
    background: rgba(234, 67, 53, 0.1);
    color: var(--danger);
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.activity-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    line-height: 1.3;
}

.activity-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}