/**
 * VendorVibes Custom Mobile Select
 * Beautiful bottom sheet style select for iOS/Android
 */

/* Hide default select arrow */
.vv-select-wrap select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Custom Select Wrapper */
.vv-select-wrap {
    position: relative;
    width: 100%;
}

/* Custom Select Trigger Button */
.vv-select-trigger {
    width: 100%;
    padding: 14px 45px 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    color: #1f2937;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    min-height: 52px;
}

.vv-select-trigger:active {
    transform: scale(0.98);
    background: #f9fafb;
}

.vv-select-trigger:focus {
    outline: none;
    border-color: var(--accent, #e94560);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.vv-select-trigger .select-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.vv-select-trigger .select-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vv-select-trigger .select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 12px;
    pointer-events: none;
    transition: transform 0.2s;
}

.vv-select-trigger.open .select-arrow {
    transform: translateY(-50%) rotate(180deg);
}

/* Placeholder state */
.vv-select-trigger.placeholder {
    color: #9ca3af;
}

/* Status colors for select trigger */
.vv-select-trigger[data-status="accepted"] {
    border-color: #10b981;
    background: #ecfdf5;
    color: #059669;
}

.vv-select-trigger[data-status="contacted"] {
    border-color: #8b5cf6;
    background: #f5f3ff;
    color: #7c3aed;
}

.vv-select-trigger[data-status="won"] {
    border-color: #22c55e;
    background: #f0fdf4;
    color: #16a34a;
}

.vv-select-trigger[data-status="lost"] {
    border-color: #ef4444;
    background: #fef2f2;
    color: #dc2626;
}

/* ============================================
   BOTTOM SHEET MODAL
   ============================================ */

.vv-bottom-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: none;
    pointer-events: none;
}

.vv-bottom-sheet.active {
    display: block;
    pointer-events: auto;
}

/* Backdrop */
.vv-sheet-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.vv-bottom-sheet.active .vv-sheet-backdrop {
    opacity: 1;
}

/* Sheet Content */
.vv-sheet-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 24px 24px 0 0;
    max-height: 80vh;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vv-bottom-sheet.active .vv-sheet-content {
    transform: translateY(0);
}

/* Sheet Handle */
.vv-sheet-handle {
    width: 36px;
    height: 5px;
    background: #d1d5db;
    border-radius: 3px;
    margin: 10px auto 0;
    flex-shrink: 0;
}

/* Sheet Header */
.vv-sheet-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.vv-sheet-title {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.vv-sheet-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f3f4f6;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #6b7280;
    cursor: pointer;
}

.vv-sheet-close:active {
    background: #e5e7eb;
}

/* Sheet Options */
.vv-sheet-options {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}

/* Single Option */
.vv-sheet-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.vv-sheet-option:active {
    background: #f3f4f6;
}

.vv-sheet-option.selected {
    background: #f0fdf4;
}

.vv-sheet-option.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Option Icon */
.vv-option-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: #f3f4f6;
    color: #6b7280;
}

.vv-option-icon.accepted { background: #d1fae5; color: #059669; }
.vv-option-icon.contacted { background: #e0e7ff; color: #4f46e5; }
.vv-option-icon.won { background: #dcfce7; color: #16a34a; }
.vv-option-icon.lost { background: #fee2e2; color: #dc2626; }
.vv-option-icon.pending { background: #fef3c7; color: #d97706; }
.vv-option-icon.default { background: #f3f4f6; color: #6b7280; }

/* Option Text */
.vv-option-text {
    flex: 1;
    min-width: 0;
}

.vv-option-text strong {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
}

.vv-option-text span {
    display: block;
    font-size: 13px;
    color: #6b7280;
}

/* Option Check */
.vv-option-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #10b981;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s;
    flex-shrink: 0;
}

.vv-sheet-option.selected .vv-option-check {
    opacity: 1;
    transform: scale(1);
}

/* Sheet Footer (Cancel Button) */
.vv-sheet-footer {
    padding: 12px 20px 20px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    /* Safe area for iPhone X+ */
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

.vv-sheet-cancel {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 14px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.vv-sheet-cancel:active {
    background: #e5e7eb;
}

/* ============================================
   FORM SELECT STYLING
   ============================================ */

/* Standard form selects */
.form-group select,
.input-icon select,
.search-field select,
.profile-form select,
.auth-form select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    cursor: pointer;
}

/* Touch-friendly select for forms */
@media (max-width: 768px) {
    .form-group select,
    .input-icon select,
    .profile-form select,
    .auth-form select {
        min-height: 52px;
        font-size: 16px; /* Prevents iOS zoom */
    }
}

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

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

@keyframes vvSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes vvBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.95); }
}

/* ============================================
   SAFE AREA INSETS (for notched phones)
   ============================================ */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .vv-sheet-content {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ============================================
   DARK MODE SUPPORT (optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .vv-bottom-sheet .vv-sheet-content {
        /* Add dark mode styles if needed */
    }
}

/* ============================================
   DESKTOP FALLBACK
   ============================================ */

@media (min-width: 769px) {
    .vv-sheet-content {
        max-width: 400px;
        left: 50%;
        transform: translateX(-50%) translateY(100%);
        border-radius: 24px;
        bottom: 20px;
    }
    
    .vv-bottom-sheet.active .vv-sheet-content {
        transform: translateX(-50%) translateY(0);
    }
}
