/* ============================================
   USUARIOS PAGE STYLES
   ============================================ */

.page-container {
    max-width: 1400px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 1.5rem;
}

.header-info h1 {
    font-size: 1.5rem;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.header-info p {
    color: var(--text-gray);
    font-size: 0.9rem;
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    background: var(--bg-white);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    align-items: center;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-gray);
    transition: var(--transition-fast);
}

.tab-btn svg {
    width: 18px;
    height: 18px;
}

.tab-btn:hover {
    background: var(--bg-gray);
    color: var(--text-dark);
}

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

.tab-btn.management {
    background: #f1f5f9;
    color: #64748b;
}

.tab-btn.management:hover {
    background: #e2e8f0;
    color: #475569;
}

.tab-btn.management.active {
    background: #6366f1;
    color: white;
}

.tab-separator {
    width: 1px;
    height: 28px;
    background: #e2e8f0;
    margin: 0 0.5rem;
    flex-shrink: 0;
}

/* Actions bar */
.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-section {
    display: flex;
    gap: 0.5rem;
}

.search-box input {
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    min-width: 280px;
    background: var(--bg-white);
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.btn-search {
    padding: 0.75rem 1.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-primary);
    color: white;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-add:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
}

.btn-add svg {
    width: 18px;
    height: 18px;
}

/* Content */
.content-area {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    min-height: 400px;
}

/* Cards grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.user-card {
    background: var(--bg-white);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    overflow: visible;
    transition: var(--transition-fast);
}

.user-card:hover {
    box-shadow: var(--shadow-md);
    /* NO usar transform aquí - crea stacking context y rompe z-index del dropdown */
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem;
    background: var(--bg-gray);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    color: white;
}

.user-type { background: linear-gradient(135deg, #0055A3 0%, #00407a 100%); }
.teacher-type { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.employee-type { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }
.student-type { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.parent-type { background: linear-gradient(135deg, #ec4899 0%, #db2777 100%); }

/* Card Actions */
.card-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #e2e8f0;
    background: var(--bg-light);
    justify-content: center;
}

.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-action svg {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
}

/* Los SVGs usan stroke="currentColor", por eso usamos color: */
.btn-action.edit {
    background: #dbeafe;
    color: #1d4ed8;
}

.btn-action.edit:hover {
    background: #bfdbfe;
}

.btn-action.key {
    background: #fef3c7;
    color: #b45309;
}

.btn-action.key:hover {
    background: #fde68a;
}

.btn-action.toggle {
    background: #fee2e2;
    color: #dc2626;
}

.btn-action.toggle:hover {
    background: #fecaca;
}

.btn-action.toggle.activate {
    background: #d1fae5;
    color: #059669;
}

.btn-action.toggle.activate:hover {
    background: #a7f3d0;
}

.btn-action.delete {
    background: #fee2e2;
    color: #dc2626;
}

.btn-action.delete:hover {
    background: #fecaca;
}

.card-body {
    padding: 1rem;
}

.card-body h3 {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.role-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.role-badge.teacher { background: #fef3c7; color: #b45309; }
.role-badge.employee { background: #ede9fe; color: #6d28d9; }
.role-badge.student { background: #d1fae5; color: #065f46; }
.role-badge.parent { background: #fce7f3; color: #be185d; }

.info-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-gray);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.info-row svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.active {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.inactive {
    background: #fee2e2;
    color: #991b1b;
}

.user-tag, .occupation-tag {
    font-size: 0.8rem;
    color: var(--text-gray);
}

/* Roles grid */
.roles-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.role-card {
    background: var(--bg-white);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition-fast);
}

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

.role-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #0055A3 0%, #00407a 100%);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.role-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.role-card h3 {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.role-card p {
    font-size: 0.8rem;
    color: var(--text-gray);
    margin-bottom: 1rem;
}

.role-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.btn-edit-role, .btn-delete-role {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.btn-edit-role {
    background: #fef3c7;
    color: #b45309;
}

.btn-edit-role:hover { background: #fde68a; }

.btn-delete-role {
    background: #fee2e2;
    color: #dc2626;
}

.btn-delete-role:hover { background: #fecaca; }

.btn-edit-role svg, .btn-delete-role svg {
    width: 16px;
    height: 16px;
}

/* Loading & Empty States */
.loading-state, .empty-state {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-gray);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    color: var(--text-light);
}

.empty-state h3 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

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

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

@media (max-width: 768px) {
    .tabs-container {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .tab-btn span {
        display: none;
    }

    .actions-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-section {
        flex-direction: column;
    }

    .search-box input {
        min-width: 100%;
    }

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

/* ============================================
   MODALES - Usar estas clases en lugar de inline
   ============================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-backdrop);
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: var(--z-modal);
}

.modal-content.sm { max-width: 400px; }
.modal-content.md { max-width: 500px; }
.modal-content.lg { max-width: 600px; }

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.1rem;
    color: #1e293b;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.btn-cancel {
    padding: 0.5rem 1rem;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.btn-cancel:hover {
    background: #e2e8f0;
}

.btn-save {
    padding: 0.5rem 1.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

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

.btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-delete {
    padding: 0.5rem 1.5rem;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.btn-delete:hover {
    background: #b91c1c;
}

.form-field {
    margin-bottom: 1rem;
}

.form-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
