/* =====================================================
 * SISU - Estilos del Portal y Login
 * Cargado desde login/index.phtml y portal/index.phtml
 * ===================================================== */

/* =====================================================
 * VARIABLES GLOBALES
 * ===================================================== */
:root {
    /* Aliases locales → apuntan al theme.css centralizado */
    --color-principal:   var(--color-primary);
    --color-secundario:  var(--color-primary-dark);
    --color-accent:      var(--color-secondary);
    --color-fondo:       var(--white);
    --color-auxiliar:    var(--gray-100);
    --color-hover:       var(--color-primary-dark);
    --color-disabled:    var(--gray-500);
}

/* =====================================================
 * LOGIN
 * ===================================================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
}

.login-body {
    background: linear-gradient(135deg, var(--secondary-500) 0%, var(--color-primary) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.login-wrapper {
    width: 60%;
    max-width: 60%;
    height: 70vh;
    margin: auto;
}

.login-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    min-height: 60vh;
}

/* Slider izquierdo */
.login-slider {
    position: relative;
    background: var(--white);
    border-right: 6px solid var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    overflow: hidden;
    width: 100%;
}

.slider-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: white;
}

.slider-image {
    width: 100%;
    max-width: 400px;
    margin-bottom: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-20px); }
}

.slider-caption {
    margin-top: 2rem;
    color: #000;
}

.slider-caption h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.slider-caption p {
    font-size: 1.5rem;
    font-style: italic;
    opacity: 0.95;
    line-height: 1.6;
}

.slider-background {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.8;
}

/* Formulario derecho */
.login-form-container {
    padding: 4rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(to bottom, var(--color-primary) 0%, var(--white) 100%);
}

.login-card {
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo img {
    max-width: 180px;
    height: auto;
}

.login-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-principal);
    margin-bottom: 0.5rem;
    text-align: center;
}

.login-subtitle {
    color: #666;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
    font-size: 0.95rem;
}

.login-form-container .form-control {
    width: 100%;
    padding: 0.4rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.login-form-container .form-control:focus {
    outline: none;
    border-color: var(--color-principal);
    background: white;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-800) 10%, transparent);
}

.login-form-container .form-control::placeholder {
    color: #999;
}

.btn-login {
    width: 100%;
    padding: 0.4rem;
    background: linear-gradient(135deg, var(--color-principal) 0%, var(--color-secundario) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--primary-800) 30%, transparent);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-login.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid white;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: #999;
    font-size: 0.875rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e0e0e0;
}

.divider span {
    padding: 0 1rem;
}

.btn-google {
    width: 100%;
    padding: 0.4rem;
    background: white;
    color: #333;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-decoration: none;
}

.btn-google:hover {
    background: #f8f9fa;
    border-color: #ccc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-google img {
    width: 20px;
    height: 20px;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.login-footer p {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

.login-footer a {
    color: var(--color-principal);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.login-footer a:hover {
    color: var(--color-secundario);
    text-decoration: underline;
}

/* Responsive login */
@media (max-width: 968px) {
    .login-container {
        grid-template-columns: 1fr;
    }
    .login-slider {
        display: none;
    }
    .login-form-container {
        padding: 3rem 2rem;
    }
}

@media (max-width: 576px) {
    .login-wrapper {
        margin: 1rem;
        width: auto;
        max-width: 100%;
    }
    .login-form-container {
        padding: 2rem 1.5rem;
    }
    .login-title {
        font-size: 1.5rem;
    }
}

/* =====================================================
 * PORTAL
 * ===================================================== */
.portal-body {
    background-color: var(--color-auxiliar);
}

/* Header */
.dashboard-header {
    background: linear-gradient(135deg, var(--color-principal) 0%, var(--color-primary-dark) 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.header-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
}

.header-subtitle {
    font-size: 0.95rem;
    opacity: 0.95;
    margin-bottom: 1rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-header {
    background-color: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-header:hover {
    background-color: rgba(255,255,255,0.25);
    color: white;
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

.btn-logout {
    background-color: rgba(220, 53, 69, 0.8);
    border-color: rgba(220, 53, 69, 0.9);
}

.btn-logout:hover {
    background-color: rgba(220, 53, 69, 1);
}

/* Main Content */
.dashboard-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Controls */
.controls {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    flex-wrap: wrap;
}

.search-section {
    flex: 1;
    min-width: 280px;
}

.search-box {
    position: relative;
    margin-bottom: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-principal);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-800) 10%, transparent);
}

.search-box::before {
    content: "\F52A";
    font-family: "bootstrap-icons";
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 1.1rem;
}

.filter-controls {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #555;
    margin: 0;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.view-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.view-controls {
    display: flex;
    gap: 0.5rem;
    background: var(--color-auxiliar);
    padding: 0.25rem;
    border-radius: 8px;
}

.btn-view {
    padding: 0.5rem 1.25rem;
    border: none;
    background: transparent;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

.btn-view.active {
    background: var(--color-principal);
    color: white;
}

.btn-view:hover:not(.active) {
    background: color-mix(in srgb, var(--primary-800) 10%, transparent);
}

.access-info {
    font-size: 0.875rem;
    color: #666;
    margin: 0;
    font-weight: 500;
}

/* Grid de módulos */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.modules-grid.active {
    display: grid;
}

.module-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    border: 2px solid transparent;
}

.module-card.enabled:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--primary-800) 15%, transparent);
    border-color: var(--color-principal);
}

.module-card.disabled {
    opacity: 0.5;
    filter: grayscale(100%);
    cursor: not-allowed;
}

.module-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-auxiliar);
    border-radius: 12px;
    padding: 0.75rem;
}

.module-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.module-icon span {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-principal);
}

.module-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 1rem 0;
}

.btn-module {
    width: 100%;
    padding: 0.625rem;
    border: none;
    border-radius: 6px;
    background: var(--color-principal);
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-module:hover:not(:disabled) {
    background: var(--color-hover);
    transform: scale(1.05);
}

.btn-module:disabled {
    background: var(--color-disabled);
    cursor: not-allowed;
}

/* Vista de lista */
.modules-list {
    display: none;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.modules-list.active {
    display: block;
}

.table-responsive {
    margin: 0;
}

.table {
    margin: 0;
}

.table thead th {
    background: var(--color-principal);
    color: white;
    border: none;
    padding: 1rem;
    font-weight: 600;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: var(--color-auxiliar);
}

.table tbody tr.disabled {
    opacity: 0.5;
    filter: grayscale(100%);
}

.list-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-auxiliar);
    border-radius: 8px;
    padding: 0.5rem;
}

.list-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.status-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge.enabled {
    background: #d4edda;
    color: #155724;
}

.status-badge.disabled {
    background: #f8d7da;
    color: #721c24;
}

.btn-list-action {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-list-action.enabled {
    background: var(--color-principal);
    color: white;
}

.btn-list-action.enabled:hover {
    background: var(--color-hover);
}

.btn-list-action.disabled {
    background: var(--color-disabled);
    color: white;
    cursor: not-allowed;
}

/* Estado vacío */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    display: none;
}

.empty-state.active {
    display: block;
}

.empty-state i {
    font-size: 4rem;
    color: #ccc;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #999;
}

/* Modales */
.modal-header {
    background: var(--color-principal);
    color: white;
    border-bottom: none;
}

.modal-header .btn-close {
    filter: invert(1);
}

.modal-footer {
    border-top: 1px solid #e0e0e0;
}

.form-select:focus,
.form-control:focus {
    border-color: var(--color-principal);
    box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--primary-800) 25%, transparent);
}

/* Reglas de contraseña */
.password-rules {
    margin-top: 0.75rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.rule-item {
    font-size: 0.85rem;
    padding: 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.rule-item.no {
    color: #dc3545;
}

.rule-item.no i {
    color: #dc3545;
}

.rule-item.yes {
    color: #198754;
}

.rule-item.yes i::before {
    content: "\F26B";
}

/* Responsive portal */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
    }
    .view-section {
        width: 100%;
        align-items: stretch;
    }
    .view-controls {
        justify-content: center;
    }
    .modules-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    .header-content h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .modules-grid {
        grid-template-columns: 1fr 1fr;
    }
    .dashboard-content {
        padding: 1rem;
    }
}
