/**
 * Frontend CSS for Makeup Artist Booking plugin
 */

/* Base form styles - these will be overridden by dynamic styles */
.mab-booking-form-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    font-size: 16px;
}

.mab-booking-form * {
    box-sizing: border-box;
}

.mab-booking-form {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mab-form-row {
    margin-bottom: 20px;
}

.mab-form-row-container {
    display: flex;
    gap: 4%;
    margin-bottom: 20px;
    align-items: flex-start;
}

.mab-form-row.half {
    flex: 1;
    margin-bottom: 0;
    margin-right: 0;
    box-sizing: border-box;
}

.mab-form-row.half:nth-child(even),
.mab-form-row.half:last-child {
    margin-right: 0;
}

.mab-form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.mab-form-label.required:after {
    content: ' *';
    color: #e74c3c;
}

.mab-form-control {
    width: 100%;
    padding: 16px 18px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #ffffff;
    min-height: 52px;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.mab-form-control select,
.mab-form-control[type="select"],
select.mab-form-control {
    padding-right: 40px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Date input specific styling to match other fields */
.mab-form-control[type="date"] {
    padding: 16px 18px;
    padding-right: 45px;
    background: #ffffff;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    font-size: 16px;
    min-height: 52px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    color: #333;
    font-family: inherit;
    position: relative;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3e%3c/rect%3e%3cline x1='16' y1='2' x2='16' y2='6'%3e%3c/line%3e%3cline x1='8' y1='2' x2='8' y2='6'%3e%3c/line%3e%3cline x1='3' y1='10' x2='21' y2='10'%3e%3c/line%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
}

.mab-form-control[type="date"]::-webkit-calendar-picker-indicator {
    background: transparent;
    bottom: 0;
    color: transparent;
    cursor: pointer;
    height: auto;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: auto;
}

.mab-form-control[type="date"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    display: none;
}

.mab-form-control[type="date"]::-webkit-clear-button {
    -webkit-appearance: none;
    display: none;
}

.mab-form-control[type="date"]:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

/* Date field placeholder/empty state styling */
.mab-form-control[type="date"]:invalid {
    color: #999;
}

.mab-form-control[type="date"]:valid {
    color: #333;
}

.mab-form-control:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.mab-form-control.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.mab-form-control:disabled {
    background: #f8f9fa;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Phone number wrapper */
.mab-phone-wrapper {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.mab-phone-country {
    flex: 0 0 100px;
    min-width: 100px;
    max-width: 120px;
}

.mab-phone-number {
    flex: 1;
}

/* Legacy styles for backward compatibility */
.mab-phone-full {
    width: 100%;
}

/* Services checkboxes */
.mab-services-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.mab-checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.mab-checkbox-wrapper:hover {
    background-color: #f8f9fa;
}

.mab-checkbox {
    width: 18px !important;
    height: 18px;
    margin: 0 !important;
    flex-shrink: 0;
    accent-color: #007cba;
}

.mab-checkbox-wrapper label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
    font-size: 16px;
    line-height: 1.4;
}

/* Submit button */
.mab-submit-button {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: #ffffff;
    border: none;
    padding: 18px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
    min-height: 56px;
}

.mab-submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 124, 186, 0.4);
}

.mab-submit-button:active {
    transform: translateY(0);
}

.mab-submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 10px rgba(0, 124, 186, 0.2);
}

/* Error messages */
.mab-error-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    display: block;
    min-height: 16px;
}

/* Success message */
.mab-success-message {
    color: #27ae60;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    padding: 15px 20px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
}

/* Loading spinner */
.mab-loading {
    display: none;
    text-align: center;
    padding: 30px 20px;
    color: #666;
}

.mab-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: mab-spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes mab-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Phone confirmation modal */
.mab-phone-confirmation {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.7) !important;
    display: none;
    justify-content: center !important;
    align-items: center !important;
    z-index: 10000 !important;
    backdrop-filter: blur(2px);
}

.mab-phone-confirmation-content {
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: mab-modal-appear 0.3s ease-out;
}

@keyframes mab-modal-appear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.mab-phone-confirmation h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

.mab-phone-display {
    font-size: 16px;
    font-weight: 600;
    color: #007cba;
    background: #f0f8ff;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 15px 0;
    border: 2px solid #e6f3ff;
}

/* OTP section */
.mab-otp-section {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.mab-otp-input {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 4px;
    margin: 15px 0;
    padding: 12px;
    border: 2px solid #007cba;
    border-radius: 6px;
    max-width: 200px;
    background: #ffffff;
}

.mab-otp-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.2);
}

.mab-otp-error {
    color: #e74c3c;
    margin: 10px 0;
    font-size: 14px;
    min-height: 20px;
}

.mab-resend-otp {
    background: none;
    border: none;
    color: #007cba;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
    margin: 10px 0;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.mab-resend-otp:hover {
    background-color: #f0f8ff;
}

.mab-resend-otp:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mab-otp-countdown {
    color: #666;
    font-size: 12px;
    margin-top: 5px;
}

/* Phone confirmation actions */
.mab-phone-actions {
    margin-top: 25px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.mab-phone-edit,
.mab-phone-confirm {
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 100px;
}

.mab-phone-edit {
    background: #6c757d;
    color: #ffffff;
}

.mab-phone-edit:hover {
    background: #5a6268;
}

.mab-phone-confirm {
    background: #007cba;
    color: #ffffff;
}

.mab-phone-confirm:hover {
    background: #005a87;
}

/* reCAPTCHA styling */
.g-recaptcha {
    margin: 15px 0;
    display: flex;
    justify-content: center;
}

/* Responsive design */
@media (max-width: 768px) {
    .mab-booking-form {
        padding: 15px;
        margin: 10px;
    }
    
    /* Stack half-width fields on mobile for occasion/people and date/time */
    .mab-form-row-container {
        flex-direction: column;
        gap: 0;
    }
    
    .mab-form-row.half {
        flex: none;
        width: 100%;
        margin-bottom: 20px;
    }
    
    .mab-phone-wrapper {
        flex-direction: row; /* Keep phone fields in one row on mobile */
        gap: 8px;
    }
    
    .mab-phone-country {
        flex: 0 0 80px;
        min-width: 80px;
        max-width: 100px;
    }
    
    .mab-phone-number {
        flex: 1;
    }
    
    .mab-phone-full {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .mab-services-wrapper {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .mab-phone-confirmation-content {
        padding: 20px;
        margin: 20px;
    }
    
    .mab-phone-actions {
        flex-direction: column;
    }
    
    .mab-phone-edit,
    .mab-phone-confirm {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .mab-booking-form {
        padding: 12px;
        border-radius: 6px;
    }
    
    .mab-form-control {
        padding: 16px 18px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 52px;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
    
    /* Ensure date fields look consistent on mobile */
    .mab-form-control[type="date"] {
        padding: 16px 18px;
        padding-right: 45px;
        font-size: 16px;
        min-height: 52px;
        background: #ffffff;
        border: 2px solid #e1e1e1;
        border-radius: 6px;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        color: #333;
        line-height: 1.4;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3e%3c/rect%3e%3cline x1='16' y1='2' x2='16' y2='6'%3e%3c/line%3e%3cline x1='8' y1='2' x2='8' y2='6'%3e%3c/line%3e%3cline x1='3' y1='10' x2='21' y2='10'%3e%3c/line%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 20px;
    }
    
    .mab-form-control[type="date"]::-webkit-calendar-picker-indicator {
        opacity: 0;
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        cursor: pointer;
    }
    
    .mab-submit-button {
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .mab-phone-confirmation-content {
        padding: 15px;
        border-radius: 8px;
    }
    
    .mab-otp-input {
        font-size: 18px;
        letter-spacing: 2px;
        max-width: 180px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mab-form-control {
        border-width: 3px;
    }
    
    .mab-form-control:focus {
        border-color: #000;
        box-shadow: 0 0 0 3px #000;
    }
    
    .mab-submit-button {
        background: #000;
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .mab-form-control,
    .mab-submit-button,
    .mab-checkbox-wrapper,
    .mab-phone-edit,
    .mab-phone-confirm,
    .mab-resend-otp {
        transition: none;
    }
    
    .mab-spinner {
        animation: none;
        border-top-color: transparent;
    }
    
    @keyframes mab-modal-appear {
        from, to {
            opacity: 1;
            transform: none;
        }
    }
}
