/* ============================================================================
   MCI PROVIDER MANAGER v4.2 - FRONTEND STYLES
   ============================================================================ */

:root {
    --mci-primary:   #539CCC;
    --mci-secondary: #3d7aad;
    --mci-success:   #27ae60;
    --mci-danger:    #e74c3c;
    --mci-dark:      #1d2327;
    --mci-light:     #f0f4f8;
    --mci-border:    #dde3ea;
}

/* Reset */
.mci-pm-list-container,
.mci-pm-profile-container,
.mci-pm-edit-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    color: #1d2327;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* ============================================================================
   LISTADO - BÚSQUEDA Y FILTROS
   ============================================================================ */

.mci-pm-search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    align-items: center;
}

.mci-pm-search-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid var(--mci-border);
    border-radius: 8px;
    font-size: 15px;
}

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

.mci-pm-btn-primary,
.mci-pm-btn-secondary {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.mci-pm-btn-primary:hover {
    background: #2574a9;
}

.mci-pm-btn-secondary {
    background: #95a5a6;
    color: white;
}

.mci-pm-btn-secondary:hover {
    background: #7f8c8d;
}

/* Panel de Filtros */
.mci-pm-filters-panel {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.mci-pm-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.mci-pm-filter-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #34495e;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mci-pm-filter-select,
.mci-pm-filter-input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--mci-border);
    border-radius: 6px;
    font-size: 14px;
}

.mci-pm-filter-select:focus,
.mci-pm-filter-input:focus {
    outline: none;
    border-color: var(--mci-primary);
}

/* Contador */
.mci-pm-total-count {
    background: var(--mci-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
}

.mci-pm-total-count span {
    background: white;
    color: var(--mci-primary);
    padding: 3px 12px;
    border-radius: 20px;
    margin-left: 8px;
    font-weight: 700;
    font-size: 14px;
}

/* Tabla */
.mci-pm-table-wrapper {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.mci-pm-table thead {
    background: var(--mci-dark);
    color: white;
}

.mci-pm-table th {
    padding: 9px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
}

/* ── Sort arrows ─────────────────────────────────────────────── */
.mci-pm-table th.mci-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.mci-pm-table th.mci-sortable:hover {
    background: rgba(255,255,255,0.12);
}
.mci-sort-arrows {
    display: inline-flex;
    flex-direction: column;
    margin-left: 5px;
    vertical-align: middle;
    line-height: 1;
    gap: 1px;
}
.mci-sort-arrows span {
    font-size: 9px;
    opacity: 0.35;
    line-height: 1;
}
.mci-pm-table th.mci-sort-asc  .mci-sort-arrows .mci-arrow-up,
.mci-pm-table th.mci-sort-desc .mci-sort-arrows .mci-arrow-down {
    opacity: 1;
}

.mci-pm-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--mci-light);
    font-size: 13px;
    line-height: 1.3;
}

.mci-pm-table tbody tr:hover {
    background: #f8f9fa;
}

.mci-pm-btn-view {
    background: var(--mci-primary);
    color: white;
    padding: 8px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-block;
}

.mci-pm-btn-view:hover {
    background: #2574a9;
    text-decoration: none;
    color: white;
}

/* Paginación */
.mci-pm-pagination {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    overflow-x: auto;
}

.mci-pm-page-btn {
    padding: 7px 12px;
    border: 1px solid var(--mci-border);
    background: white;
    color: #1d2327;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
    min-width: 36px;
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.mci-pm-page-btn.mci-page-dots {
    border: none;
    background: none;
    cursor: default;
    color: #646970;
    pointer-events: none;
}

.mci-pm-page-btn:hover {
    background: #e8f4f8;
    color: #1d2327;
    border-color: #539CCC;
}

.mci-pm-page-btn.active {
    background: #539CCC;
    color: #fff;
    border-color: #539CCC;
}

/* Spinner */
.mci-pm-spinner {
    border: 4px solid rgba(0,0,0,0.1);
    border-top: 4px solid var(--mci-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

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

/* ============================================================================
   EDIT PROVIDER - FORMULARIO
   ============================================================================ */

.mci-pm-edit-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.mci-pm-edit-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--mci-primary);
}

.mci-pm-title {
    font-size: 32px;
    font-weight: 600;
    color: var(--mci-dark);
    margin: 0 0 10px 0;
}

.mci-pm-title i {
    color: var(--mci-primary);
    margin-right: 10px;
}

.mci-pm-subtitle {
    font-size: 18px;
    color: #7f8c8d;
}

/* Tabs */
.mci-pm-tabs-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--mci-border);
    flex-wrap: wrap;
}

.mci-pm-tab-btn {
    background: transparent;
    border: none;
    padding: 15px 25px;
    font-size: 15px;
    font-weight: 600;
    color: #7f8c8d;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mci-pm-tab-btn:hover {
    color: var(--mci-primary);
    background: rgba(46, 134, 193, 0.05);
}

.mci-pm-tab-btn.active {
    color: var(--mci-primary);
    border-bottom-color: var(--mci-primary);
}

.mci-pm-edit-form {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mci-pm-tab-content {
    display: none;
}

.mci-pm-tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

.mci-pm-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

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

.mci-pm-form-group.full-width {
    grid-column: 1 / -1;
}

.mci-pm-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--mci-dark);
    font-size: 14px;
}

.mci-pm-form-group label .required {
    color: var(--mci-danger);
}

.mci-pm-form-group input,
.mci-pm-form-group select,
.mci-pm-form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--mci-border);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
}

.mci-pm-form-group input:focus,
.mci-pm-form-group select:focus,
.mci-pm-form-group textarea:focus {
    outline: none;
    border-color: var(--mci-primary);
    box-shadow: 0 0 0 3px rgba(46, 134, 193, 0.1);
}

.mci-pm-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--mci-border);
}

.mci-pm-btn {
    padding: 14px 30px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer !important;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 10;
    pointer-events: auto !important;
}

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

.mci-pm-btn-primary:hover {
    background: #2574a9;
    transform: translateY(-2px);
}

.mci-pm-btn-secondary {
    background: #95a5a6;
    color: white;
}

.mci-pm-btn-secondary:hover {
    background: #7f8c8d;
}

.mci-pm-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.mci-pm-loading p {
    color: white;
    margin-top: 20px;
    font-size: 18px;
}

.mci-pm-error {
    background: #fee;
    border-left: 4px solid var(--mci-danger);
    padding: 15px 20px;
    border-radius: 8px;
    color: #c0392b;
    margin: 20px 0;
}

/* Especialidades por nivel hospitalario */
.mci-pm-specialties-group {
    margin: 30px 0;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--mci-primary);
}

.mci-pm-specialties-group h4 {
    margin: 0 0 20px 0;
    color: var(--mci-dark);
    font-size: 16px;
    font-weight: 600;
}

.mci-pm-checkboxes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.mci-pm-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.mci-pm-checkbox-label:hover {
    border-color: var(--mci-primary);
    background: #f0f7fc;
}

.mci-pm-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.mci-pm-checkbox-label input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: var(--mci-primary);
}

.mci-pm-checkbox-label span {
    flex: 1;
    font-size: 14px;
    color: #333;
}

/* ============================================================================
   PROFILE - HEADER ACTION BUTTONS
   ============================================================================ */

.mci-pm-profile-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--mci-primary);
}

.mci-pm-profile-title h1 {
    margin: 0 0 5px 0;
    font-size: 28px;
    color: var(--mci-dark);
}

.mci-pm-profile-id {
    font-size: 13px;
    color: #7f8c8d;
}

.mci-pm-profile-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* Botón View Files - Verde */
.mci-pm-btn-files {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--mci-success);
    color: white !important;
    border-radius: 8px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
    box-shadow: 0 2px 6px rgba(39, 174, 96, 0.3);
}

.mci-pm-btn-files:hover {
    background: #229954;
    transform: translateY(-2px);
    color: white !important;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
    text-decoration: none !important;
}

/* Botón Edit Profile - Azul */
.mci-pm-btn-edit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--mci-primary);
    color: white !important;
    border-radius: 8px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
}

.mci-pm-btn-edit:hover {
    background: #2574a9;
    transform: translateY(-2px);
    color: white !important;
    text-decoration: none !important;
}

/* Botón Back - Gris */
.mci-pm-btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #95a5a6;
    color: white !important;
    border-radius: 8px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
}

.mci-pm-btn-back:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
    color: white !important;
    text-decoration: none !important;
}

/* Profile Tabs */
.mci-pm-profile-tabs {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--mci-border);
}

.mci-pm-profile-tab {
    background: transparent;
    border: none;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #7f8c8d;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mci-pm-profile-tab:hover {
    color: var(--mci-primary);
}

.mci-pm-profile-tab.active {
    color: var(--mci-primary);
    border-bottom-color: var(--mci-primary);
}

.mci-pm-profile-tab-content {
    display: none;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.mci-pm-profile-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.mci-pm-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.mci-pm-info-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid var(--mci-primary);
}

.mci-pm-info-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.mci-pm-info-value {
    display: block;
    font-size: 15px;
    color: var(--mci-dark);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .mci-pm-form-row {
        grid-template-columns: 1fr;
    }
    
    .mci-pm-tabs-nav {
        overflow-x: auto;
    }
    
    .mci-pm-filters-grid {
        grid-template-columns: 1fr;
    }
    
    .mci-pm-checkboxes-grid {
        grid-template-columns: 1fr;
    }
}
