/* ==========================================================================
   AvoloPay — CSS Édition Client & Sélection Profil (v4.0 Redesign)
   src/style/editclient_form.css
   ========================================================================== */

.edit-form-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 22, 40, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeInOverlay 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.edit-client-container {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: popInForm 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

@keyframes popInForm {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Header */
.edit-client-header {
    background: linear-gradient(135deg, #0a1628, #0d2137);
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.edit-client-header .header-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.edit-client-header .header-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #00B4D8, #0077b6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.15rem;
    box-shadow: 0 4px 12px rgba(0, 180, 216, 0.3);
}

.edit-client-header h2 {
    margin: 0;
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.edit-client-header .header-subtitle {
    margin: 3px 0 0 0;
    color: #94a3b8;
    font-size: 0.8rem;
}

.btn-modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cbd5e1;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Tab Header Navigation */
.tab-header {
    display: flex;
    background: #f1f5f9;
    padding: 6px;
    gap: 6px;
    margin: 16px 20px 0;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    color: #64748b;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    min-height: 42px;
}

.tab-btn i {
    font-size: 0.95rem;
}

.tab-btn:hover:not(.active) {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.6);
}

.tab-btn.active {
    background: #ffffff;
    color: #0077b6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    font-weight: 700;
}

/* Form Structure */
#edit-client-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.tab-content {
    display: none;
    padding: 20px;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    max-height: calc(90vh - 200px);
}

.tab-content.active {
    display: flex;
    animation: fadeInContent 0.25s ease;
}

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

.edit-client-container .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.edit-client-container label {
    font-size: 0.84rem;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 6px;
}

.edit-client-container label i {
    color: #0077b6;
}

.edit-client-container input[type="text"],
.edit-client-container input[type="email"],
.edit-client-container input[type="tel"],
.edit-client-container input[type="date"],
.edit-client-container select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #0f172a;
    background: #f8fafc;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.edit-client-container input:focus,
.edit-client-container select:focus {
    border-color: #00B4D8;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
    outline: none;
}

.edit-client-container input[readonly] {
    background: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
    cursor: default;
}

/* Profile Selection Summary Banner */
.profile-selection-summary {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    border: 1.5px solid #38bdf8;
    border-radius: 14px;
    padding: 12px 16px;
}

.summary-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.summary-badge i {
    font-size: 1.5rem;
    color: #0284c7;
}

.summary-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: #0369a1;
}

.summary-value {
    font-size: 0.92rem;
    font-weight: 700;
    color: #0c4a6e;
    margin-top: 2px;
}

/* Account Search Bar */
.account-search-bar {
    position: relative;
    width: 100%;
}

.account-search-bar i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.account-search-bar input {
    padding-left: 38px !important;
}

/* Account Cards & Profile Grid */
.account-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Account Card Item */
.account-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 14px;
    transition: all 0.2s ease;
}

.account-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.account-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #e2e8f0;
}

.account-card-email {
    font-size: 0.88rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
    word-break: break-all;
}

.account-card-email i {
    color: #0077b6;
    font-size: 0.95rem;
}

.account-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.account-badge.free {
    background: #dcfce7;
    color: #166534;
}

.account-badge.full {
    background: #fee2e2;
    color: #991b1b;
}

/* Profile Chips Grid */
.profile-chips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
}

.profile-chip {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1.5px solid transparent;
    user-select: none;
}

/* Profile Chip States */
.profile-chip.current {
    background: linear-gradient(135deg, #0077b6, #00b4d8);
    color: #ffffff;
    border-color: #0077b6;
    box-shadow: 0 4px 10px rgba(0, 180, 216, 0.3);
}

.profile-chip.free {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}

.profile-chip.free:hover {
    background: #00B4D8;
    color: #ffffff;
    border-color: #0096c7;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 180, 216, 0.25);
}

.profile-chip.selected {
    background: #00B4D8 !important;
    color: #ffffff !important;
    border-color: #0077b6 !important;
    box-shadow: 0 0 0 2px #0077b6, 0 4px 12px rgba(0, 180, 216, 0.35) !important;
}

.profile-chip.unavailable {
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
    cursor: not-allowed;
    opacity: 0.65;
    pointer-events: none;
}

.chip-status-tag {
    font-size: 0.68rem;
    padding: 1px 5px;
    border-radius: 4px;
}

.profile-chip.current .chip-status-tag {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.profile-chip.free .chip-status-tag {
    background: #bae6fd;
    color: #0369a1;
}

.profile-chip.unavailable .chip-status-tag {
    background: #e2e8f0;
    color: #64748b;
}

.profile-read-only-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 4px;
}

/* Form Actions Footer */
.edit-client-container .form-actions {
    padding: 14px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.edit-client-container .btn-save {
    background: linear-gradient(135deg, #0077b6, #00b4d8);
    color: #ffffff;
    border: none;
    padding: 10px 22px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(0, 180, 216, 0.3);
    transition: all 0.2s ease;
}

.edit-client-container .btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 180, 216, 0.4);
}

.edit-client-container .btn-cancel {
    background: #ffffff;
    color: #64748b;
    border: 1.5px solid #cbd5e1;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.edit-client-container .btn-cancel:hover {
    background: #f1f5f9;
    color: #334155;
    border-color: #94a3b8;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .edit-form-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .edit-client-container {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
    }

    .tab-header {
        margin: 12px 14px 0;
    }

    .tab-btn {
        padding: 8px;
        font-size: 0.8rem;
        min-height: 40px;
    }

    .tab-btn span {
        display: inline;
    }

    .tab-content {
        padding: 14px;
        max-height: calc(92vh - 190px);
    }

    .profile-chips-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-read-only-grid {
        grid-template-columns: 1fr;
    }

    .edit-client-container .form-actions {
        padding: 12px 14px;
    }

    .edit-client-container .btn-save,
    .edit-client-container .btn-cancel {
        flex: 1;
        justify-content: center;
    }
}