/**
 * Frontend Styles for Restaurant Booking Plugin
 */

:root {
    --rbf-primary: #000000;
    --rbf-primary-light: #333333;
    --rbf-primary-dark: #000000;
    --rbf-secondary: #f8b500;
    --rbf-success: #28a745;
    --rbf-error: #dc3545;
    --rbf-text: #333;
    --rbf-text-light: #666;
    --rbf-border: #e1e5e9;
    --rbf-bg-light: #f8f9fa;
    --rbf-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --rbf-shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
    --rbf-radius: 8px;
    --rbf-transition: all 0.3s ease;
}

.rbf-form-container {
    position: relative;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 2rem;
    border-radius: var(--rbf-radius);
    box-shadow: var(--rbf-shadow);
}

#rbf-message-anchor {
    position: absolute;
    top: -20px;
}

.rbf-form {
    max-width: 580px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: var(--rbf-radius);
    box-shadow: var(--rbf-shadow);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

/* Progress Indicator */
.rbf-progress-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.rbf-progress-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--rbf-border);
    z-index: 1;
    transform: translateY(-50%);
}

.rbf-progress-step {
    position: relative;
    z-index: 2;
    background: white;
    border: 2px solid var(--rbf-border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--rbf-text-light);
    transition: var(--rbf-transition);
}

.rbf-progress-step.active {
    border-color: var(--rbf-primary);
    background: var(--rbf-primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(44, 90, 160, 0.2);
}

.rbf-progress-step.completed {
    border-color: var(--rbf-success);
    background: var(--rbf-success);
    color: white;
}

.rbf-progress-step.completed::before {
    content: '✓';
}

.rbf-step {
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--rbf-transition);
}

.rbf-step.active {
    opacity: 1;
    transform: translateY(0);
}

.rbf-step > label {
    display: block;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--rbf-text);
    font-size: 1.1rem;
}

#rbf-meal-notice {
    font-size: .9em;
    font-style: italic;
    color: var(--rbf-text-light);
    margin-top: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #e8f4fd 0%, #d3e8fc 100%);
    border-left: 4px solid var(--rbf-primary);
    border-radius: var(--rbf-radius);
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.rbf-form input[type='text'],
.rbf-form input[type='email'],
.rbf-form input[type='tel'],
.rbf-form select,
.rbf-form textarea {
    box-sizing: border-box;
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--rbf-border);
    border-radius: var(--rbf-radius);
    font-size: 16px;
    background: white;
    color: var(--rbf-text);
    transition: var(--rbf-transition);
    font-family: inherit;
}

.rbf-form input[type='text']:focus,
.rbf-form input[type='email']:focus,
.rbf-form input[type='tel']:focus,
.rbf-form select:focus,
.rbf-form textarea:focus {
    outline: none;
    border-color: var(--rbf-primary);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.rbf-form textarea {
    min-height: 100px;
    resize: vertical;
}
    background: #fff;
}

.rbf-radio-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 1rem;
    max-width: 100%;
}

.rbf-radio-group input[type='radio'] {
    opacity: 0;
    position: absolute;
    width: 0;
}

.rbf-radio-group label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    border: 2px solid var(--rbf-border);
    border-radius: var(--rbf-radius);
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: var(--rbf-transition);
    background: white;
    color: var(--rbf-text);
    min-height: 56px;
    word-break: break-word;
    hyphens: auto;
}

.rbf-radio-group label:hover {
    background: var(--rbf-bg-light);
    border-color: var(--rbf-primary-light);
    transform: translateY(-2px);
    box-shadow: var(--rbf-shadow);
}

.rbf-radio-group input[type='radio']:checked + label {
    background: linear-gradient(135deg, var(--rbf-primary) 0%, var(--rbf-primary-dark) 100%);
    color: white;
    border-color: var(--rbf-primary);
    box-shadow: var(--rbf-shadow-hover);
    transform: translateY(-2px);
}

.rbf-people-selector {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0 auto;
    border: 2px solid var(--rbf-border);
    border-radius: var(--rbf-radius);
    overflow: hidden;
    background: white;
}

.rbf-people-selector button {
    width: 50px;
    height: 50px;
    font-size: 20px;
    font-weight: bold;
    border: none;
    background: var(--rbf-bg-light);
    cursor: pointer;
    line-height: 1;
    color: var(--rbf-primary);
    transition: var(--rbf-transition);
}

.rbf-people-selector button:hover:not(:disabled) {
    background: var(--rbf-primary);
    color: white;
}

.rbf-people-selector button:disabled {
    background: #f8f8f8;
    cursor: not-allowed;
    color: #ccc;
}

.rbf-people-selector input {
    flex: 1;
    height: 50px;
    text-align: center;
    font-weight: 700;
    border: none;
    font-size: 18px;
    color: var(--rbf-text);
    background: white;
}

#rbf-submit {
    width: 100%;
    padding: 16px 24px;
    margin-top: 2rem;
    font-size: 18px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--rbf-primary) 0%, var(--rbf-primary-dark) 100%);
    border: none;
    border-radius: var(--rbf-radius);
    cursor: pointer;
    transition: var(--rbf-transition);
    box-shadow: var(--rbf-shadow);
}

#rbf-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--rbf-shadow-hover);
}

#rbf-submit:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.rbf-success-message,
.rbf-error-message {
    padding: 18px 20px;
    margin-bottom: 20px;
    border-radius: var(--rbf-radius);
    border: none;
    font-weight: 500;
    box-shadow: var(--rbf-shadow);
    animation: slideInDown 0.5s ease;
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.rbf-success-message {
    color: white;
    background: linear-gradient(135deg, var(--rbf-success) 0%, #218838 100%);
}

.rbf-error-message {
    color: white;
    background: linear-gradient(135deg, var(--rbf-error) 0%, #c82333 100%);
}

/* Enhanced International Telephone Input Styling - Redesigned for Better Flag Visibility */
.iti {
    width: 100% !important;
    position: relative;
    display: block;
    border-radius: var(--rbf-radius);
    background: white;
    border: 2px solid var(--rbf-border);
    transition: all 0.3s ease;
    min-height: 52px;
}

.iti:focus-within {
    border-color: var(--rbf-primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Redesigned Flag Container - More Prominent and Visible */
.iti__flag-container {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 90px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-right: 1px solid var(--rbf-border);
    border-radius: var(--rbf-radius) 0 0 var(--rbf-radius);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.iti__flag-container:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #f8f9fa 100%);
    border-right-color: var(--rbf-primary);
}

.iti__selected-flag {
    background: transparent;
    border: none;
    height: 100%;
    width: 100%;
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: var(--rbf-radius) 0 0 var(--rbf-radius);
    transition: all 0.3s ease;
}

.iti__selected-flag:hover {
    background: rgba(0, 0, 0, 0.02);
}

.iti__selected-flag:focus {
    background: rgba(0, 0, 0, 0.05);
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Enhanced Flag Design - Larger and More Visible */
.iti__flag {
    /* Restore default flag dimensions to prevent distortion */
    width: 20px;
    height: 15px;
    flex-shrink: 0;
    margin-right: 6px;
}

/* Improved Arrow Design */
.iti__arrow {
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #666;
    margin-left: 2px;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.iti__arrow--up {
    border-top: none;
    border-bottom: 6px solid #666;
}

.iti__selected-flag:hover .iti__arrow {
    border-top-color: var(--rbf-primary);
    opacity: 1;
}

.iti__selected-flag:hover .iti__arrow--up {
    border-bottom-color: var(--rbf-primary);
}

/* Redesigned Country Dropdown - More Attractive and Readable */
.iti__country-list {
    background: white;
    border: 2px solid var(--rbf-primary);
    border-radius: 12px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 9999 !important;
    max-height: 240px;
    overflow-y: auto;
    position: absolute;
    width: 340px !important;
    top: 100%;
    left: 0;
    margin-top: 8px;
    animation: dropdownFadeIn 0.3s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.iti__country {
    padding: 16px 20px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    min-height: 52px;
}

.iti__country:last-child {
    border-bottom: none;
}

.iti__country:hover,
.iti__country:focus {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0.05) 100%);
    outline: none;
    transform: translateX(3px);
}

.iti__country.iti__highlight {
    background: linear-gradient(135deg, var(--rbf-primary) 0%, var(--rbf-primary-dark) 100%);
    color: white;
    transform: translateX(3px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Enhanced Flag in Dropdown */
.iti__country .iti__flag {
    /* Match dropdown flags with default sprite size */
    width: 20px;
    height: 15px;
    margin-right: 14px;
}

.iti__country-name {
    font-size: 15px;
    flex: 1;
    font-weight: 500;
    color: #333;
}

.iti__highlight .iti__country-name {
    color: white;
    font-weight: 600;
}

.iti__dial-code {
    margin-left: auto;
    font-size: 14px;
    color: #666;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.05);
    padding: 6px 10px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    min-width: 50px;
    text-align: center;
}

.iti__highlight .iti__dial-code {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.15);
    font-weight: 700;
}

/* Enhanced Input Field Integration */
.iti input[type="tel"] {
    padding-left: 100px !important;
    border-radius: 0 var(--rbf-radius) var(--rbf-radius) 0 !important;
    border: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
    font-size: 16px;
    font-weight: 500;
    min-height: 50px;
    background: white;
    color: var(--rbf-text);
    transition: none; /* Let the parent .iti handle transitions */
}

.iti input[type="tel"]:focus {
    outline: none;
    box-shadow: none; /* Parent .iti handles focus styling */
}

/* Container Integration */
.rbf-form .iti {
    z-index: 10;
    position: relative;
    margin-bottom: 1rem;
}

.rbf-form .iti.iti--container-open {
    z-index: 9999;
}

.iti--allow-dropdown input {
    padding-left: 100px !important;
    border-radius: 0 var(--rbf-radius) var(--rbf-radius) 0 !important;
}

/* Mobile Responsive Design - Enhanced for Better Flag Visibility */
@media (max-width: 768px) {
    .iti__country-list {
        max-height: 200px;
        box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
        width: 320px !important;
        border-radius: 16px;
        border: 2px solid var(--rbf-primary);
    }
    
    .iti__country {
        padding: 18px 20px;
        min-height: 56px;
        display: flex;
        align-items: center;
    }
    
    .iti__country-name {
        font-size: 16px;
        font-weight: 500;
    }
    
    .iti__dial-code {
        font-size: 15px;
        padding: 8px 12px;
        border-radius: 8px;
    }
    
    .iti__selected-flag {
        min-height: 56px;
        width: 95px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--rbf-radius) 0 0 var(--rbf-radius);
    }

    .iti__flag-container {
        width: 95px;
        border-radius: var(--rbf-radius) 0 0 var(--rbf-radius);
    }

    .iti input[type="tel"] {
        padding-left: 105px !important;
        font-size: 16px !important; /* Prevent iOS zoom */
        min-height: 54px;
        border-radius: 0 var(--rbf-radius) var(--rbf-radius) 0 !important;
    }
    
    /* Enhanced Mobile Flag Design */
    .iti__flag {
        width: 28px;
        height: 21px;
        margin-right: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.1);
        border-radius: 3px;
    }
    
    .iti__country .iti__flag {
        width: 30px;
        height: 22px;
        margin-right: 16px;
    }
    
    .iti__arrow {
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-top: 7px solid #666;
        margin-left: 4px;
    }
    
    .iti__arrow--up {
        border-top: none;
        border-bottom: 7px solid #666;
    }
    
    /* Enhanced Mobile Container */
    .iti {
        min-height: 56px;
        border: 2px solid var(--rbf-border);
        border-radius: var(--rbf-radius);
    }
    
    .iti:focus-within {
        border-color: var(--rbf-primary);
        box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
    }
}

/* Enhanced validation states and fallback styling */
.rbf-tel-invalid {
    border-color: var(--rbf-error) !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15) !important;
}

.rbf-tel-fallback {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 50%) !important;
    border-color: #ffc107 !important;
    position: relative;
}

.rbf-tel-fallback::before {
    content: "⚠️ ";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #856404;
    font-size: 16px;
}

.rbf-tel-fallback::placeholder {
    color: #856404 !important;
    font-style: italic;
}

/* Enhanced container class for custom styling */
.rbf-iti-enhanced {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.rbf-iti-enhanced:focus-within {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 0 0 3px rgba(0, 0, 0, 0.1);
}
}

/* Add visual indicator for fallback mode */
.rbf-tel-fallback::before {
    content: "⚠️ ";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

/* Ensure proper spacing when in fallback mode */
.rbf-tel-fallback {
    padding-left: 30px !important;
}

/* Style individual consent labels to stack vertically */
.rbf-checkbox-group label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--rbf-text);
    cursor: pointer;
    transition: var(--rbf-transition);
    text-align: left;
    line-height: 1.5; /* Improve line spacing for better readability */
}

/* Ensure the checkbox text content flows properly */
.rbf-checkbox-group label > span,
.rbf-checkbox-group label > *:not(input) {
    flex: 1;
    word-wrap: break-word;
    hyphens: auto;
}

/* Specific styling for privacy link to ensure it flows inline */
.rbf-checkbox-group label span a {
    display: inline;
    white-space: nowrap;
}

.rbf-checkbox-group label:hover {
    color: var(--rbf-primary);
}

.rbf-checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--rbf-primary);
    cursor: pointer;
    margin: 0;
}

.rbf-checkbox-group a {
    color: var(--rbf-primary);
    text-decoration: none;
    font-weight: 500;
}

.rbf-checkbox-group a:hover {
    text-decoration: underline;
}

/* Help text styling */
.rbf-help-text {
    display: block;
    font-size: 13px;
    color: var(--rbf-text-light);
    margin-top: 6px;
    font-style: italic;
}

/* Section titles */
.rbf-section-title {
    color: var(--rbf-primary);
    font-size: 20px;
    margin: 0 0 1.5rem 0;
    font-weight: 600;
    border-bottom: 2px solid var(--rbf-border);
    padding-bottom: 8px;
}

.rbf-consent-title {
    color: var(--rbf-text);
    font-size: 16px;
    margin: 1.5rem 0 1rem 0;
    font-weight: 600;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
/* Responsive Design - Mobile First Approach */

/* Extra Small Mobile (320px - 374px) */
@media (max-width: 374px) {
    .rbf-form-container {
        padding: 0.125rem;
        margin: 0.125rem;
    }
    
    .rbf-form {
        padding: 0.5rem;
    }
    
    .rbf-progress-step {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    
    .rbf-step > label {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }
    
    .rbf-radio-group {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .rbf-radio-group label {
        padding: 14px 16px;
        font-size: 14px;
        min-height: 50px;
    }
    
    .rbf-people-selector button {
        width: 44px;
        height: 44px;
        font-size: 18px;
        min-height: 44px;
    }
    
    .rbf-people-selector input {
        height: 44px;
        font-size: 15px;
    }
    
    .rbf-form input[type='text'],
    .rbf-form input[type='email'],
    .rbf-form input[type='tel'],
    .rbf-form select,
    .rbf-form textarea {
        padding: 14px 12px;
        font-size: 16px; /* Prevent iOS zoom */
    }
    
    #rbf-submit {
        padding: 16px 20px;
        font-size: 16px;
        min-height: 50px;
    }
}

/* Small Mobile (375px - 479px) */
@media (min-width: 375px) and (max-width: 479px) {
    .rbf-form-container {
        padding: 0.25rem;
        margin: 0.25rem;
    }
    
    .rbf-form {
        padding: 0.75rem;
    }
    
    .rbf-progress-step {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }
    
    .rbf-step > label {
        font-size: 1rem;
    }
    
    .rbf-radio-group {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .rbf-radio-group label {
        padding: 14px 12px;
        font-size: 14px;
        min-height: 52px;
    }
    
    .rbf-people-selector button {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .rbf-people-selector input {
        height: 48px;
        font-size: 16px;
    }
    
    .rbf-checkbox-group label {
        font-size: 13px;
        gap: 8px;
    }
    
    .rbf-checkbox-group input[type="checkbox"] {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }
}

/* Medium Mobile (414px - 479px) */
@media (min-width: 414px) and (max-width: 479px) {
    .rbf-form-container {
        padding: 0.5rem;
        margin: 0.5rem;
    }
    
    .rbf-form {
        padding: 1rem;
    }
    
    .rbf-progress-step {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .rbf-radio-group {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .rbf-radio-group label {
        padding: 16px 14px;
        font-size: 15px;
        min-height: 54px;
    }
    
    .rbf-people-selector button {
        width: 48px;
        height: 48px;
        font-size: 20px;
        min-height: 48px;
    }
    
    .rbf-people-selector input {
        height: 48px;
        font-size: 17px;
    }
    
    .rbf-checkbox-group input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }
}

/* Large Mobile (480px - 767px) */
@media (min-width: 480px) and (max-width: 767px) {
    .rbf-form-container {
        padding: 0.75rem;
        margin: 0.75rem;
    }
    
    .rbf-form {
        padding: 1.25rem;
    }
    
    .rbf-progress-step {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }
    
    .rbf-radio-group {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 12px;
    }
    
    .rbf-radio-group label {
        padding: 16px 18px;
        font-size: 15px;
        min-height: 56px;
    }
    
    .rbf-people-selector button {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .rbf-people-selector input {
        height: 48px;
        flex: 1;
    }
}

/* Tablet and smaller mobile (up to 768px) */
@media (max-width: 768px) {
    .rbf-form-container {
        padding: 0.5rem;
        margin: 0.5rem;
    }
    
    .rbf-form {
        padding: 1rem;
    }
    
    .rbf-progress-step {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .rbf-radio-group {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }
    
    .rbf-radio-group label {
        padding: 16px 12px;
        font-size: 15px;
        min-height: 52px;
    }
    
    .rbf-people-selector {
        width: 100%;
    }
    
    .rbf-people-selector button {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .rbf-people-selector input {
        height: 44px;
        flex: 1;
    }
    
    /* Better touch targets and spacing */
    .rbf-form input[type='text'],
    .rbf-form input[type='email'],
    .rbf-form input[type='tel'],
    .rbf-form select,
    .rbf-form textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 16px;
        min-height: 48px; /* Ensure minimum touch target size */
        -webkit-appearance: none; /* Remove default iOS styling */
    }
    
    .rbf-form select {
        background-size: 16px;
        background-position: right 12px center;
        background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23666' d='m0 0l4 0l-2 5z'/></svg>");
        background-repeat: no-repeat;
        padding-right: 40px;
    }
    
    /* Better checkbox interaction */
    .rbf-checkbox-group input[type="checkbox"] {
        width: 22px;
        height: 22px;
        min-width: 22px;
        min-height: 22px;
    }
    
    /* Improved submit button */
    #rbf-submit {
        padding: 18px 24px;
        font-size: 17px;
        min-height: 48px;
        -webkit-tap-highlight-color: transparent; /* Remove iOS tap highlight */
        touch-action: manipulation; /* Prevent double-tap zoom */
    }
    
    /* Better radio button touch targets */
    .rbf-radio-group label {
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 14px 16px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        font-size: 15px;
    }
    
    /* Improve people selector touch targets */
    .rbf-people-selector button {
        min-height: 44px;
        min-width: 44px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
}

/* Tablet Portrait (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .rbf-form-container {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .rbf-form {
        padding: 1.75rem;
    }
    
    .rbf-progress-step {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }
    
    .rbf-radio-group {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 14px;
        max-width: 600px;
        margin: 0 auto 1rem auto;
    }
    
    .rbf-radio-group label {
        padding: 18px 24px;
        font-size: 16px;
        min-height: 58px;
    }
    
    .rbf-people-selector button {
        width: 52px;
        height: 52px;
        font-size: 22px;
    }
    
    .rbf-people-selector input {
        height: 52px;
        font-size: 20px;
    }
}

/* Desktop and Large Tablets (1025px+) */
@media (min-width: 1025px) {
    .rbf-radio-group {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 16px;
        max-width: 700px;
        margin: 0 auto 1rem auto;
    }
    
    .rbf-radio-group label {
        padding: 20px 28px;
        font-size: 16px;
        min-height: 60px;
        font-weight: 600;
    }
    
    .rbf-radio-group label:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    }
    
    .rbf-radio-group input[type='radio']:checked + label {
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    }
    
    /* Optimized layouts for specific number of meals */
    .rbf-radio-group.meals-2 {
        grid-template-columns: 1fr 1fr;
        max-width: 400px;
    }
    
    .rbf-radio-group.meals-3 {
        grid-template-columns: 1fr 1fr 1fr;
        max-width: 600px;
    }
    
    .rbf-radio-group.meals-4 {
        grid-template-columns: 1fr 1fr;
        max-width: 450px;
    }
    
    .rbf-radio-group.meals-5,
    .rbf-radio-group.meals-6 {
        grid-template-columns: 1fr 1fr 1fr;
        max-width: 650px;
    }
}

/* Loading State */
.rbf-loading {
    position: relative;
    overflow: hidden;
}

.rbf-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: loading 1.5s infinite;
}

@keyframes loading {
    to {
        left: 100%;
    }
}

/* Mobile touch interactions */
@media (max-width: 768px) {
    .rbf-radio-group label.touch-active {
        background: var(--rbf-bg-light) !important;
        transform: scale(0.98) !important;
        transition: all 0.1s ease !important;
    }
    
    .rbf-people-selector button.touch-active {
        background: var(--rbf-primary) !important;
        color: white !important;
        transform: scale(0.95) !important;
        transition: all 0.1s ease !important;
    }
    
    #rbf-submit:active {
        transform: translateY(0) scale(0.98) !important;
        transition: all 0.1s ease !important;
    }
    
    .rbf-checkbox-group label:active {
        opacity: 0.8;
        transition: opacity 0.1s ease;
    }
}

/* Fallback styling when intlTelInput fails */
.rbf-tel-fallback {
    background-color: #fff3cd !important;
    border-color: #ffeaa7 !important;
}

.rbf-tel-fallback::placeholder {
    color: #856404 !important;
}