/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    min-height: calc(100vh - 40px);
}

.form-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

/* iOrderAI Banner */
.banner {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    padding: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 48px;
    height: 48px;
}

.logo img {
    width: 32px !important;
    height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    object-fit: contain;
    display: block;
}

.brand-text h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.brand-text p {
    margin: 5px 0 0 0;
    font-size: 14px;
    opacity: 0.9;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* Header */
h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 30px;
}

h3 {
    color: #34495e;
    font-size: 1.3rem;
    font-weight: 600;
    margin: 30px 0 20px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #ecf0f1;
}

/* Form Styles */
.address-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.form-control {
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #fff;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control:read-only {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

.form-control::placeholder {
    color: #adb5bd;
}

/* Address input container with GPS button */
.address-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* Autocomplete specific styling */
#autocomplete {
    background-color: #fff;
    border-color: #667eea;
    font-weight: 500;
    font-size: 18px;
    padding: 18px 56px 18px 16px; /* Adjusted right padding to align with 40px button + spacing */
    height: 60px;
    width: 100%;
    max-width: 600px;
}

#autocomplete:focus {
    border-color: #5a67d8;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* GPS Button Styling */
.gps-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #667eea;
    border: none;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    color: white;
}

.gps-button:hover {
    background: #5a67d8;
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.gps-button:active {
    transform: translateY(-50%) scale(0.95);
}

.gps-button:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: translateY(-50%);
}

.gps-button:disabled:hover {
    transform: translateY(-50%);
    box-shadow: none;
}

.gps-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.gps-button.loading .gps-icon {
    animation: spin 1s linear infinite;
}

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

/* GPS button states */
.gps-button.success {
    background: #10b981;
}

.gps-button.error {
    background: #ef4444;
}

.help-text {
    color: #6c757d;
    font-size: 0.85rem;
    font-style: italic;
}

/* Textarea */
textarea.form-control {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* Select */
select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

/* Sections */
.address-details {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    display: none; /* Initially hidden until address is selected */
}

.contact-details {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

/* Buttons */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e1e8ed;
}

.btn-primary,
.btn-secondary {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

/* Success Message */
.success-message {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    color: white;
    border-radius: 12px;
    margin-top: 20px;
}

.success-message h3 {
    color: white;
    margin-bottom: 10px;
    border-bottom: none;
}

.success-message p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Google Places Autocomplete Styling */
.pac-container {
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: none;
    margin-top: 5px;
    z-index: 9999;
}

.pac-item {
    padding: 12px 16px;
    border-bottom: 1px solid #e1e8ed;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.pac-item:hover {
    background-color: #f8f9fa;
}

.pac-item-selected {
    background-color: #667eea;
    color: white;
}

.pac-matched {
    font-weight: 600;
}

/* Delivery Method Section */
.delivery-method-section {
    margin-bottom: 25px;
}

.delivery-options {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.delivery-option {
    flex: 1;
}

.delivery-option input[type="radio"] {
    display: none;
}

.delivery-option-label {
    display: flex;
    align-items: center;
    padding: 20px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    gap: 15px;
}

.delivery-option-label:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.delivery-option input[type="radio"]:checked + .delivery-option-label {
    border-color: #667eea;
    background: linear-gradient(135deg, #f8f9ff 0%, #e8f0ff 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.option-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.delivery-option input[type="radio"]:checked + .delivery-option-label .option-icon {
    background: #667eea;
    color: white;
}

.option-icon svg {
    width: 18px;
    height: 18px;
    color: #6c757d;
    transition: color 0.3s ease;
}

.delivery-option input[type="radio"]:checked + .delivery-option-label .option-icon svg {
    color: white;
}

.option-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.option-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2c3e50;
}

.option-description {
    font-size: 0.9rem;
    color: #6c757d;
    line-height: 1.4;
}

.delivery-option input[type="radio"]:checked + .delivery-option-label .option-title {
    color: #667eea;
}

/* Required field indicator */
label[for="first_name"]:after,
label[for="last_name"]:after,
label[for="phone"]:after {
    content: " *";
    color: #e74c3c;
    font-weight: bold;
}

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .container {
        min-height: calc(100vh - 10px);
        padding: 0;
        align-items: flex-start;
    }
    
    .form-container {
        padding: 20px 15px;
        margin: 5px 0;
        border-radius: 8px;
        max-height: none;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    }
    
    /* Mobile banner styling */
    .banner {
        margin: -20px -15px 25px -15px;
        padding: 15px;
        border-radius: 8px 8px 0 0;
    }
    
    .logo-container {
        flex-direction: row;
        gap: 12px;
    }
    
    .brand-text h2 {
        font-size: 24px;
    }
    
    .brand-text p {
        font-size: 13px;
    }
    
    .logo {
        width: 40px;
        height: 40px;
        padding: 6px;
    }
    
    .logo img {
        width: 28px !important;
        height: 28px !important;
        max-width: 28px !important;
        max-height: 28px !important;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-bottom: 6px;
    }
    
    .subtitle {
        font-size: 1rem;
        margin-bottom: 25px;
    }
    
    /* Mobile delivery options */
    .delivery-options {
        flex-direction: column;
        gap: 12px;
    }
    
    .delivery-option-label {
        padding: 16px;
        gap: 12px;
    }
    
    .option-icon {
        width: 40px;
        height: 40px;
    }
    
    .option-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .option-title {
        font-size: 1rem;
    }
    
    .option-description {
        font-size: 0.85rem;
    }

    /* Mobile-optimized form rows */
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Larger touch targets for mobile */
    .form-control {
        padding: 16px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 6px;
        min-height: 48px; /* Minimum touch target size */
        -webkit-appearance: none;
    }
    
    /* Textarea specific mobile styling */
    textarea.form-control {
        min-height: 100px;
        resize: vertical;
    }
    
    /* Select dropdown mobile optimization */
    select.form-control {
        padding: 16px 40px 16px 14px;
        background-size: 20px;
        background-position: right 14px center;
        -webkit-appearance: none;
    }
    
    /* Mobile-friendly buttons */
    .form-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-top: 25px;
        position: sticky;
        bottom: 0;
        background: white;
        padding: 15px 0 5px 0;
        border-top: 1px solid #e1e8ed;
        margin-left: -15px;
        margin-right: -15px;
        padding-left: 15px;
        padding-right: 15px;
        z-index: 100;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        padding: 18px 20px;
        font-size: 1.1rem;
        min-height: 52px;
        border-radius: 8px;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Section styling for mobile */
    .address-details {
        padding: 20px 15px;
        margin: 15px -15px;
        border-radius: 0;
        border-left: none;
        border-top: 4px solid #667eea;
        background-color: #f8f9fa;
        display: none; /* Initially hidden until address is selected */
    }
    
    .contact-details {
        padding: 20px 15px;
        margin: 15px -15px;
        border-radius: 0;
        border-left: none;
        border-top: 4px solid #667eea;
        background-color: #f8f9fa;
    }
    
    h3 {
        font-size: 1.2rem;
        margin: 20px 0 15px 0;
    }
    
    /* Mobile autocomplete styling */
    #autocomplete {
        font-size: 18px;
        padding: 20px 56px 20px 16px; /* Adjusted right padding to align with button */
        height: 64px;
        -webkit-appearance: none;
    }
    
    /* Mobile GPS button styling */
    .gps-button {
        right: 10px;
        width: 40px;
        height: 40px;
        border-radius: 8px;
    }
    
    .gps-icon {
        width: 22px;
        height: 22px;
    }
    
    .help-text {
        font-size: 0.9rem;
        margin-top: 4px;
    }
    
    /* Mobile Google Places styling */
    .pac-container {
        margin-top: 2px;
        border-radius: 6px;
    }
    
    .pac-item {
        padding: 14px 16px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
    }
    
    .container {
        min-height: 100vh;
    }
    
    .form-container {
        padding: 15px 12px;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }
    
    /* Very small screen banner styling */
    .banner {
        margin: -15px -12px 20px -12px;
        padding: 12px;
        border-radius: 0;
    }
    
    .brand-text h2 {
        font-size: 22px;
    }
    
    .brand-text p {
        font-size: 12px;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    .form-control {
        padding: 14px 12px;
        font-size: 16px;
    }
    
    .address-details {
        padding: 15px 12px;
        margin: 12px -12px;
        display: none; /* Initially hidden until address is selected */
    }
    
    .contact-details {
        padding: 15px 12px;
        margin: 12px -12px;
    }
    
    .form-actions {
        margin-left: -12px;
        margin-right: -12px;
        padding-left: 12px;
        padding-right: 12px;
    }
    
    /* Smaller buttons for very small screens */
    .btn-primary,
    .btn-secondary {
        padding: 16px 18px;
        font-size: 1rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Styles for touch devices */
    .form-control:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
        transform: scale(1.01);
        transition: all 0.2s ease;
    }
    
    .btn-primary:active,
    .btn-secondary:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    /* Larger tap targets for labels */
    label {
        padding: 6px 0;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Remove hover effects on touch devices */
    .btn-primary:hover,
    .btn-secondary:hover {
        transform: none;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .form-container {
        max-height: 85vh;
        overflow-y: auto;
    }
    
    .form-actions {
        position: relative;
        bottom: auto;
    }
    
    h1 {
        font-size: 1.5rem;
        margin-bottom: 4px;
    }
    
    .subtitle {
        margin-bottom: 20px;
    }
}

/* Loading state */
.form-control.loading {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%23666' d='M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z' opacity='.25'/%3E%3Cpath fill='%23666' d='M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z'%3E%3CanimateTransform attributeName='transform' dur='0.75s' repeatCount='indefinite' type='rotate' values='0 12 12;360 12 12'/%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
}

/* Animation for form sections */
.address-details.show,
.contact-details {
    animation: slideIn 0.5s ease-out;
}

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

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-control {
        border-width: 3px;
    }
    
    .btn-primary,
    .btn-secondary {
        border: 2px solid currentColor;
    }
}

/* Location Permission Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    border-bottom: none;
    color: white;
}

.close {
    color: rgba(255, 255, 255, 0.8);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close:hover {
    color: white;
}

.modal-body {
    padding: 25px;
}

.modal-body p {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1rem;
    line-height: 1.5;
}

.permission-steps {
    margin: 20px 0;
}

.step {
    display: flex;
    align-items: center;
    margin: 15px 0;
    padding: 12px;
    background: #f8f9ff;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.step-number {
    background: #667eea;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    margin-right: 12px;
    flex-shrink: 0;
}

.privacy-note {
    background: #e8f5e8;
    padding: 12px;
    border-radius: 6px;
    margin-top: 20px;
    border-left: 4px solid #4CAF50;
}

.privacy-note small {
    color: #2e7d32;
    font-size: 0.9rem;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-footer button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-footer .btn-primary {
    background: #667eea;
    color: white;
}

.modal-footer .btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.modal-footer .btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.modal-footer .btn-secondary:hover {
    background: #e0e0e0;
}

/* Mobile modal styling */
@media (max-width: 768px) {
    .modal-content {
        margin: 5% auto;
        width: 95%;
        max-width: none;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .step {
        padding: 10px;
        margin: 12px 0;
    }
    
    .modal-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    .modal-footer button {
        width: 100%;
        padding: 14px 20px;
        font-size: 1rem;
    }
}