/* ============================================
   BINUP - Service Person + Chat Styles
   ============================================ */

/* ---- Service Person Page Layout ---- */
.sp-page {
    max-width: 900px;
    margin: 0 auto;
}

.sp-page .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--gray);
    text-decoration: none;
    margin-bottom: 20px;
    font-size: 14px;
    transition: color 0.2s;
}

.sp-page .back-link:hover {
    color: var(--primary);
}

/* ---- OTP Display Card ---- */
.otp-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 16px;
    padding: 28px 32px;
    text-align: center;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.otp-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(51,255,170,0.06) 0%, transparent 70%);
    animation: otpGlow 6s ease-in-out infinite;
}

@keyframes otpGlow {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(10%, 10%); }
}

.otp-card h3 {
    color: #94a3b8;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
    position: relative;
}

.otp-digits {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
    position: relative;
}

.otp-digit {
    width: 56px;
    height: 68px;
    background: rgba(255,255,255,0.07);
    border: 2px solid rgba(51,255,170,0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 900;
    color: #33ffaa;
    font-family: 'Poppins', monospace;
    text-shadow: 0 0 20px rgba(51,255,170,0.3);
}

.otp-card .otp-note {
    font-size: 12px;
    color: #64748b;
    position: relative;
}

.otp-verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(16,185,129,0.15);
    color: #10b981;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    position: relative;
}

/* ---- CRM Respect Note ---- */
.crm-note {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fbbf24;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.crm-note .crm-icon {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.crm-note .crm-text {
    font-size: 13px;
    color: #92400e;
    line-height: 1.6;
}

.crm-note .crm-text strong {
    color: #78350f;
}

/* ---- Service Person Profile Card ---- */
.sp-profile-card {
    background: var(--white);
    border-radius: 16px;
    padding: 28px;
    border: 1px solid var(--light-gray);
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.sp-profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.sp-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    flex-shrink: 0;
}

.sp-avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #00cc88 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 900;
    color: #fff;
    flex-shrink: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.sp-info h2 {
    font-size: 22px;
    margin-bottom: 4px;
    color: var(--dark);
}

.sp-info .sp-specialization {
    color: var(--gray);
    font-size: 14px;
    margin-bottom: 8px;
}

.sp-info .sp-stats {
    display: flex;
    gap: 16px;
    align-items: center;
}

.sp-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--gray);
}

.sp-stat strong {
    color: var(--dark);
}

.sp-stat .star-gold {
    color: #f59e0b;
}

.sp-bio {
    background: var(--bg-soft);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--gray);
    line-height: 1.6;
}

.sp-contact-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.sp-contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.sp-contact-btn.call {
    background: #10b981;
    color: white;
}

.sp-contact-btn.call:hover {
    background: #059669;
    transform: translateY(-1px);
}

.sp-contact-btn.chat-scroll {
    background: var(--primary);
    color: var(--dark);
}

.sp-contact-btn.chat-scroll:hover {
    background: #00e68a;
    transform: translateY(-1px);
}

/* ---- Booking Summary Mini Card ---- */
.sp-booking-summary {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--light-gray);
    padding: 18px 22px;
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.sp-booking-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sp-booking-item .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray);
    font-weight: 600;
}

.sp-booking-item .value {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}

/* ---- Chat Interface ---- */
.chat-container {
    background: var(--white);
    border-radius: 16px;
    border: 1px solid var(--light-gray);
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.chat-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: #0f172a;
}

.chat-header-info h4 {
    font-size: 14px;
    margin: 0;
}

.chat-header-info span {
    font-size: 11px;
    color: #94a3b8;
}

.chat-messages {
    height: 380px;
    overflow-y: auto;
    padding: 20px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 4px;
}

.chat-empty {
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
    padding: 60px 20px;
}

.chat-empty .chat-empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

/* ---- Chat Bubbles ---- */
.chat-bubble {
    display: flex;
    gap: 8px;
    max-width: 80%;
    animation: chatFadeIn 0.25s ease;
}

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

.chat-bubble.chat-user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.chat-bubble.chat-person {
    margin-right: auto;
}

.chat-avatar-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 4px;
}

.chat-user .chat-avatar-small {
    background: var(--primary);
    color: #0f172a;
}

.chat-person .chat-avatar-small {
    background: #e2e8f0;
    color: #475569;
}

.chat-content {
    background: white;
    border-radius: 14px;
    padding: 10px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.chat-user .chat-content {
    background: var(--primary);
    color: #0f172a;
}

.chat-sender-name {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 3px;
    opacity: 0.7;
}

.chat-text {
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.chat-time {
    font-size: 10px;
    opacity: 0.5;
    margin-top: 4px;
    text-align: right;
}

.chat-sending {
    opacity: 0.6;
}

.chat-sending-icon {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ---- Chat Input ---- */
.chat-input-area {
    padding: 14px 16px;
    border-top: 1px solid var(--light-gray);
    background: white;
}

.chat-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    display: none;
}

.chat-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-form textarea {
    flex: 1;
    border: 1px solid var(--light-gray);
    border-radius: 12px;
    padding: 10px 14px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    resize: none;
    min-height: 42px;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-form textarea:focus {
    border-color: var(--primary);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #0f172a;
    border: none;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.chat-send-btn:hover {
    background: #00e68a;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- Tip Section ---- */
.tip-section {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-radius: 14px;
    padding: 22px 24px;
    margin-top: 16px;
}

.tip-section h4 {
    font-size: 16px;
    color: #166534;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tip-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.tip-option {
    display: none;
}

.tip-option + label {
    padding: 10px 22px;
    background: white;
    border: 2px solid #86efac;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: #166534;
    transition: all 0.2s;
}

.tip-option:checked + label {
    background: #166534;
    color: white;
    border-color: #166534;
    transform: scale(1.05);
}

.tip-option + label:hover {
    border-color: #166534;
}

.tip-custom-input {
    display: none;
    margin-bottom: 14px;
}

.tip-custom-input.visible {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tip-custom-input input {
    width: 120px;
    padding: 8px 12px;
    border: 2px solid #86efac;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
}

.tip-submit-btn {
    background: #166534;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tip-submit-btn:hover {
    background: #15803d;
    transform: translateY(-1px);
}

.tip-given {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(22,101,52,0.08);
    padding: 12px 18px;
    border-radius: 10px;
    color: #166534;
    font-weight: 600;
}

/* ---- Profile Avatar ---- */
.profile-avatar-section {
    text-align: center;
    margin-bottom: 28px;
}

.profile-avatar-wrap {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.profile-avatar-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
    box-shadow: 0 4px 20px rgba(51,255,170,0.15);
    transition: transform 0.2s;
}

.profile-avatar-img:hover {
    transform: scale(1.05);
}

.profile-avatar-initial {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #00cc88 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 900;
    color: #0f172a;
    border: 4px solid rgba(51,255,170,0.3);
    box-shadow: 0 4px 20px rgba(51,255,170,0.15);
    transition: transform 0.2s;
}

.profile-avatar-initial:hover {
    transform: scale(1.05);
}

.profile-avatar-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 36px;
    height: 36px;
    background: var(--dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border: 3px solid var(--white);
    cursor: pointer;
    transition: all 0.2s;
}

.profile-avatar-overlay:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.profile-avatar-label {
    font-size: 13px;
    color: var(--gray);
    margin-top: 10px;
    display: block;
}

/* ---- Nav Profile Dropdown Pill ---- */
.nav-profile-dropdown {
    position: relative;
}

.nav-profile-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50px;
    padding: 5px 14px 5px 5px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Poppins', sans-serif;
    color: inherit;
}

.nav-profile-trigger:hover {
    background: rgba(255,255,255,0.14);
    border-color: var(--primary);
}

.nav-profile-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nav-profile-initial {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, #00cc88 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    border-radius: 50%;
}

.nav-profile-name {
    font-size: 13px;
    font-weight: 600;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-profile-chevron {
    font-size: 10px;
    opacity: 0.6;
    transition: transform 0.2s;
}

.nav-profile-dropdown.open .nav-profile-chevron {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.nav-profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.97);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 9999;
    overflow: hidden;
}

.nav-profile-dropdown.open .nav-profile-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.nav-profile-menu-header {
    padding: 16px 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-profile-menu-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.nav-profile-menu-email {
    font-size: 12px;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-profile-menu-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 0;
}

.nav-profile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    text-decoration: none;
    transition: all 0.15s;
}

.nav-profile-menu-item:hover {
    background: #f8fafc;
    color: #0f172a;
    padding-left: 22px;
}

.nav-profile-logout {
    color: #dc2626;
}

.nav-profile-logout:hover {
    background: #fef2f2;
    color: #b91c1c;
}

@media (max-width: 768px) {
    .nav-profile-name {
        display: none;
    }
    .nav-profile-chevron {
        display: none;
    }
    .nav-profile-trigger {
        padding: 4px;
        border-radius: 50%;
        background: transparent;
        border: 2px solid var(--primary);
    }
    .nav-profile-menu {
        right: -10px;
        min-width: 220px;
    }
}

/* ---- GPS / Location Styles ---- */
.gps-detect-section {
    margin-bottom: 16px;
}

.gps-detect-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Poppins', sans-serif;
}

.gps-detect-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
}

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

.gps-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

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

.gps-status {
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 8px;
    display: none;
}

.gps-status-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #86efac;
}

.gps-status-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.gps-status-loading {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #93c5fd;
}

/* ---- Map Container ---- */
.map-container {
    width: 100%;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--light-gray);
    margin: 14px 0;
    position: relative;
}

.map-container .leaflet-container {
    height: 100%;
    width: 100%;
    border-radius: 10px;
}

/* ---- Slot Availability Badges ---- */
.slot-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    margin-left: 6px;
}

.slot-status.available {
    background: #dcfce7;
    color: #166534;
}

.slot-status.filling_fast {
    background: #fff7ed;
    color: #c2410c;
    animation: slotPulse 1.5s infinite;
}

.slot-status.full {
    background: #fef2f2;
    color: #dc2626;
}

@keyframes slotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.time-slot-option.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.time-slot-option.disabled span {
    text-decoration: line-through;
}

/* ---- Mobile Profile Header (hamburger menu) ---- */
.mobile-profile-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border: var(--border-size) solid var(--black);
    color: #fff;
    margin-bottom: 4px;
}

.mobile-profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #00cc88 100%);
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
}

.mobile-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-profile-header strong {
    font-size: 1rem;
    display: block;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    /* Service Person Page */
    .sp-page {
        padding: 0 4px;
    }

    .sp-profile-header {
        flex-direction: column;
        text-align: center;
    }

    .sp-info .sp-stats {
        justify-content: center;
    }

    .sp-contact-row {
        justify-content: center;
        flex-direction: column;
    }

    .sp-contact-btn {
        justify-content: center;
        width: 100%;
    }

    .sp-booking-summary {
        grid-template-columns: 1fr 1fr;
    }

    .sp-profile-card {
        padding: 20px 16px;
    }

    /* OTP */
    .otp-card {
        padding: 20px 16px;
    }

    .otp-digit {
        width: 48px;
        height: 58px;
        font-size: 24px;
    }

    /* Chat */
    .chat-messages {
        height: 300px;
        padding: 14px;
    }

    .chat-bubble {
        max-width: 90%;
    }

    .chat-form textarea {
        font-size: 16px; /* prevent iOS zoom */
    }

    /* Tip */
    .tip-section {
        padding: 18px 16px;
    }

    .tip-options {
        flex-direction: column;
    }

    .tip-option + label {
        text-align: center;
    }

    /* Profile Avatar */
    .profile-avatar-img,
    .profile-avatar-initial {
        width: 100px;
        height: 100px;
    }

    .profile-avatar-initial {
        font-size: 40px;
    }

    /* CRM Note */
    .crm-note {
        padding: 14px 16px;
        flex-direction: column;
        text-align: center;
    }

    /* Map */
    .map-container {
        height: 250px;
    }

    /* GPS */
    .gps-detect-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .sp-booking-summary {
        grid-template-columns: 1fr;
    }

    .otp-digit {
        width: 42px;
        height: 50px;
        font-size: 20px;
    }

    .otp-card h3 {
        font-size: 12px;
    }

    .sp-avatar, .sp-avatar-placeholder {
        width: 64px;
        height: 64px;
        font-size: 26px;
    }

    .sp-info h2 {
        font-size: 18px;
    }

    .chat-messages {
        height: 260px;
    }

    .map-container {
        height: 200px;
    }

    .profile-avatar-img,
    .profile-avatar-initial {
        width: 80px;
        height: 80px;
    }

    .profile-avatar-initial {
        font-size: 32px;
    }
}

/* iPhone specific (390px-430px) */
@media (max-width: 430px) {
    .nav-profile-trigger {
        width: 34px;
        height: 34px;
        padding: 2px;
    }

    .nav-profile-avatar {
        width: 28px;
        height: 28px;
    }

    .cart-link {
        width: 34px;
        height: 34px;
    }

    .cart-icon-emoji {
        font-size: 1rem;
    }

    .nav-profile-menu {
        right: -50px;
        min-width: 240px;
    }

    .mobile-profile-header {
        padding: 14px 16px;
    }

    .mobile-profile-avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}
