/* ===============================================
   AppSASIN3 - Sistema de Gestión de Servicios SASA
   Estilos CSS Responsivos
   =============================================== */

/* Variables CSS - Colores Corporativos SASA */
:root {
    /* Colores principales SASA */
    --primary-color: #1E5A96;
    --primary-dark: #163d66;
    --primary-light: #4A90E2;
    --accent-color: #C41E3A;

    /* Colores de estado */
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #C41E3A;
    --warning-color: #f59e0b;
    --info-color: #4A90E2;

    /* Neutros */
    --light-bg: #f8fafc;
    --dark-text: #1a1a1a;
    --border-color: #e5e7eb;
    --white: #ffffff;

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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: var(--light-bg);
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Navbar - Diseño Minimalista SASA */
.navbar {
    background-color: var(--white);
    border-bottom: 2px solid var(--primary-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand a {
    font-size: 1.5rem;
    color: var(--primary-color);
    text-decoration: none;
    padding: 1rem 0;
    display: block;
}

.navbar-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.navbar-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--dark-text);
    margin: 3px 0;
    transition: 0.3s;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 1rem;
    align-items: center;
}

.navbar-nav a {
    color: var(--dark-text);
    text-decoration: none;
    padding: 0.5rem 1rem;
    display: block;
    transition: color 0.3s;
}

.navbar-nav a:hover {
    color: var(--primary-color);
}

.navbar-right {
    margin-left: auto;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    list-style: none;
    padding: 0.5rem 0;
    margin-top: 0.25rem;
}

.dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-menu li a {
    padding: 0.5rem 1rem;
    display: block;
}

.dropdown-menu li a:hover {
    background-color: var(--light-bg);
}

/* Sub-menús anidados (dropdown dentro de dropdown) */
.dropdown-menu .dropdown {
    position: relative;
}

.dropdown-menu .dropdown > a.dropdown-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.dropdown-menu .dropdown > a.dropdown-toggle::after {
    content: '▶';
    font-size: 0.7rem;
    margin-left: 0.5rem;
    transition: transform 0.2s;
}

.dropdown-menu .dropdown.active > a.dropdown-toggle::after {
    transform: rotate(90deg);
}

/* Sub-menús de segundo nivel - DEBEN estar ocultos por defecto */
.dropdown-menu .dropdown-menu {
    display: none !important;
    position: static;
    margin-left: 1.5rem;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
    padding: 0.25rem 0;
    box-shadow: none;
    border: none;
    border-left: 3px solid #3b82f6;
    background: transparent;
}

/* Solo mostrar cuando el padre tiene clase active */
.dropdown-menu .dropdown.active > .dropdown-menu {
    display: block !important;
}

/* Items dentro de sub-menús anidados */
.dropdown-menu .dropdown-menu li a {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    color: #475569;
}

.dropdown-menu .dropdown-menu li a:hover {
    background-color: #e0e7ff;
    color: #1e40af;
}

/* Login page - Diseño Minimalista SASA */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #ffffff;
    position: relative;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

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

.login-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--secondary-color);
    font-size: 0.875rem;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.875rem;
    color: var(--secondary-color);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
}

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

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

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

.btn-secondary:hover {
    opacity: 0.9;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-block {
    display: block;
    width: 100%;
    margin-bottom: 0.5rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

/* Cards - Estilo Minimalista */
.card {
    background: var(--white);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: box-shadow 0.3s ease;
}

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

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 2px solid var(--primary-light);
    background: linear-gradient(to right, rgba(30, 90, 150, 0.03), transparent);
}

.card-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--primary-color);
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--light-bg);
}

/* Dashboard grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table thead {
    background-color: var(--light-bg);
}

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

.table th {
    font-weight: 600;
    color: var(--dark-text);
}

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

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-creada {
    background-color: #17a2b8;
    color: white;
}

.badge-pendiente {
    background-color: #ffc107;
    color: #333;
}

.badge-en-progreso {
    background-color: #007bff;
    color: white;
}

.badge-completada {
    background-color: #28a745;
    color: white;
}

.badge-cancelada {
    background-color: #dc3545;
    color: white;
}

/* Page header */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary-color);
    position: relative;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--accent-color);
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar-toggle {
        display: flex;
    }

    .navbar-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 1rem;
        border-top: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
    }

    .navbar-menu.active {
        display: flex;
    }

    .navbar-nav {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    .navbar-nav li {
        width: 100%;
    }

    .navbar-right {
        margin-left: 0;
        width: 100%;
    }

    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        background: var(--light-bg);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .table {
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
    }

    /* Tabla responsiva en móviles */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .btn {
        font-size: 0.875rem;
        padding: 0.4rem 0.8rem;
    }
}

/* Loading spinner */
.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utilidades */
.text-center {
    text-align: center;
}

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

.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; }

.hidden {
    display: none;
}

/* ===============================================
   MODALES - Estilos para ventanas modales
   =============================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background-color: var(--white);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--primary-light);
    background: linear-gradient(to right, rgba(30, 90, 150, 0.03), transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--light-bg);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.btn-close:hover {
    background-color: var(--light-bg);
    color: var(--danger-color);
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    opacity: 0.9;
}

/* Responsive modals */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        margin: 10px auto;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}
