/**
 * Viva Consumer Profile Styles
 * v2024-12-22a
 */

/* ============================================
   OVERLAY & MODAL
   ============================================ */

.viva-profile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 10000;
    animation: viva-overlay-in 0.2s ease;
}

@keyframes viva-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.viva-profile-modal {
    background: white;
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: viva-modal-in 0.3s ease;
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

@keyframes viva-modal-in {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@media (min-width: 768px) {
    .viva-profile-overlay {
        align-items: center;
    }

    .viva-profile-modal {
        border-radius: 16px;
        max-height: 80vh;
    }
}

.viva-profile-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-100, #F3F4F6);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600, #4A5565);
    transition: background 0.2s;
    z-index: 1;
}

.viva-profile-close:hover {
    background: var(--gray-200, #E5E7EB);
}

.viva-profile-modal-content {
    padding: 24px;
}

/* ============================================
   STEP LAYOUT
   ============================================ */

.viva-profile-step {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.viva-profile-step-header {
    text-align: center;
    position: relative;
}

.viva-profile-step-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900, #101828);
    margin: 0 0 8px;
}

.viva-profile-step-header p {
    font-size: 14px;
    color: var(--gray-500, #6A7282);
    margin: 0;
}

.viva-profile-step-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6900 0%, #FF8533 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: white;
}

.viva-profile-step-icon-success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

.viva-profile-back-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: var(--gray-100, #F3F4F6);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600, #4A5565);
    transition: background 0.2s;
}

.viva-profile-back-btn:hover {
    background: var(--gray-200, #E5E7EB);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.viva-profile-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.viva-profile-input-group {
    display: flex;
    align-items: center;
    background: var(--gray-50, #F9FAFB);
    border: 1px solid var(--gray-200, #E5E7EB);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.viva-profile-input-group:focus-within {
    border-color: #FF6900;
    box-shadow: 0 0 0 3px rgba(255, 105, 0, 0.1);
}

.viva-profile-input-prefix {
    padding: 14px 12px 14px 16px;
    font-size: 16px;
    color: var(--gray-500, #6A7282);
    font-weight: 500;
    background: var(--gray-100, #F3F4F6);
    border-right: 1px solid var(--gray-200, #E5E7EB);
}

.viva-profile-input-group .viva-profile-input {
    border: none;
    border-radius: 0;
}

.viva-profile-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-family: inherit;
    border: 1px solid var(--gray-200, #E5E7EB);
    border-radius: 12px;
    background: var(--gray-50, #F9FAFB);
    color: var(--gray-900, #101828);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.viva-profile-input:focus {
    outline: none;
    border-color: #FF6900;
    box-shadow: 0 0 0 3px rgba(255, 105, 0, 0.1);
}

.viva-profile-input::placeholder {
    color: var(--gray-400, #99A1AF);
}

/* OTP Inputs */
.viva-profile-otp-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.viva-profile-otp-inputs input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    border: 1px solid var(--gray-200, #E5E7EB);
    border-radius: 12px;
    background: var(--gray-50, #F9FAFB);
    color: var(--gray-900, #101828);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.viva-profile-otp-inputs input:focus {
    outline: none;
    border-color: #FF6900;
    box-shadow: 0 0 0 3px rgba(255, 105, 0, 0.1);
}

/* Error Message */
.viva-profile-error {
    font-size: 14px;
    color: #EF4444;
    margin: 0;
    padding: 12px 16px;
    background: #FEF2F2;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   BUTTONS
   ============================================ */

.viva-profile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: none;
}

.viva-profile-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.viva-profile-btn-primary {
    background: linear-gradient(135deg, #FF6900 0%, #FF8533 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 105, 0, 0.25);
}

.viva-profile-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 105, 0, 0.35);
}

.viva-profile-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.viva-profile-btn-full {
    width: 100%;
}

.viva-profile-btn-link {
    padding: 8px;
    color: var(--gray-500, #6A7282);
    font-weight: 400;
}

.viva-profile-btn-link:hover {
    color: #FF6900;
}

/* ============================================
   TERMS & RESEND
   ============================================ */

.viva-profile-terms {
    font-size: 12px;
    color: var(--gray-400, #99A1AF);
    text-align: center;
    margin: 0;
}

.viva-profile-terms a {
    color: var(--gray-500, #6A7282);
    text-decoration: underline;
}

.viva-profile-resend {
    font-size: 14px;
    color: var(--gray-500, #6A7282);
    text-align: center;
    margin: 0;
}

.viva-profile-resend button {
    color: #FF6900;
    font-weight: 500;
}

/* ============================================
   PROFILE PROMPT (In-chat prompt)
   ============================================ */

.viva-profile-prompt {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.3s ease;
}

.viva-profile-prompt-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6900 0%, #FF8533 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.viva-profile-prompt-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900, #101828);
    margin: 0 0 4px;
}

.viva-profile-prompt-content p {
    font-size: 14px;
    color: var(--gray-500, #6A7282);
    margin: 0;
    line-height: 1.5;
}

.viva-profile-prompt-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ============================================
   PROFILE CARD (Logged-in state)
   ============================================ */

.viva-profile-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.viva-profile-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--gray-100, #F3F4F6);
}

.viva-profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6900 0%, #FF8533 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

.viva-profile-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.viva-profile-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900, #101828);
}

.viva-profile-phone {
    font-size: 13px;
    color: var(--gray-500, #6A7282);
}

.viva-profile-menu-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400, #99A1AF);
    transition: background 0.2s;
}

.viva-profile-menu-btn:hover {
    background: var(--gray-100, #F3F4F6);
    color: var(--gray-600, #4A5565);
}

/* Appointments */
.viva-profile-appointments {
    padding: 12px 16px;
}

.viva-profile-appointments h4 {
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-400, #99A1AF);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 12px;
}

.viva-profile-appt-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
}

.viva-profile-appt-item + .viva-profile-appt-item {
    border-top: 1px solid var(--gray-100, #F3F4F6);
}

.viva-profile-appt-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--gray-100, #F3F4F6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500, #6A7282);
    flex-shrink: 0;
}

.viva-profile-appt-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.viva-profile-appt-service {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-900, #101828);
}

.viva-profile-appt-time {
    font-size: 13px;
    color: #FF6900;
}

.viva-profile-appt-business {
    font-size: 12px;
    color: var(--gray-500, #6A7282);
}

/* ============================================
   PROFILE MENU (Dropdown)
   ============================================ */

.viva-profile-menu {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    padding: 8px;
    z-index: 10001;
    animation: viva-menu-in 0.15s ease;
}

@keyframes viva-menu-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.viva-profile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-700, #374151);
    transition: background 0.15s;
    text-align: left;
}

.viva-profile-menu-item:hover {
    background: var(--gray-100, #F3F4F6);
}

.viva-profile-menu-item svg {
    color: var(--gray-400, #99A1AF);
}

.viva-profile-menu-danger {
    color: #EF4444;
}

.viva-profile-menu-danger svg {
    color: #EF4444;
}

/* ============================================
   SUCCESS STATE
   ============================================ */

.viva-profile-success .viva-profile-step-header {
    padding-top: 20px;
}

.viva-profile-success .viva-profile-step-icon {
    width: 80px;
    height: 80px;
}

.viva-profile-success .viva-profile-step-icon svg {
    width: 40px;
    height: 40px;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

/* ============================================
   HEADER PROFILE PILL (Compact in-header display)
   ============================================ */

.viva-profile-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 9999px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.viva-profile-pill:hover {
    background: rgba(255, 255, 255, 0.2);
}

.viva-profile-pill svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.viva-profile-pill-chevron {
    opacity: 0.7;
    margin-left: 2px;
}

/* Profile Pill Dropdown */
.viva-profile-pill-dropdown {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    padding: 8px;
    z-index: 10001;
    animation: viva-menu-in 0.15s ease;
}

.viva-profile-pill-dropdown-header {
    padding: 12px;
    border-bottom: 1px solid var(--gray-100, #F3F4F6);
    margin-bottom: 4px;
}

.viva-profile-pill-dropdown-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900, #101828);
}

.viva-profile-pill-dropdown-phone {
    font-size: 13px;
    color: var(--gray-500, #6A7282);
    margin-top: 2px;
}

.viva-profile-pill-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-700, #374151);
    transition: background 0.15s;
    text-align: left;
    font-family: inherit;
}

.viva-profile-pill-dropdown-item:hover {
    background: var(--gray-100, #F3F4F6);
}

.viva-profile-pill-dropdown-item svg {
    color: var(--gray-400, #99A1AF);
    width: 16px;
    height: 16px;
}

.viva-profile-pill-dropdown-danger {
    color: #EF4444;
}

.viva-profile-pill-dropdown-danger svg {
    color: #EF4444;
}
