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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: -webkit-gradient(linear, left top, left bottom, color-stop(42%, #25d366), color-stop(80%, #20c55e));
    background: linear-gradient(180deg, #25d366 42%, #20c55e 80%);
    min-height: 100vh;
    color: white;
    line-height: 1.6;
    overflow: hidden;
    transition: padding-top 0.2s ease;
}

body.header-visible {
    padding-top: 50px;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    position: relative;
    z-index: 2;
}

/* Floating Elements */
.floating-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

.floating-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 6s ease-in-out infinite;
}

.circle-1 {
    width: 80px;
    height: 80px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.circle-2 {
    width: 120px;
    height: 120px;
    top: 60%;
    right: 15%;
    animation-delay: 2s;
}

.circle-3 {
    width: 60px;
    height: 60px;
    bottom: 20%;
    left: 20%;
    animation-delay: 4s;
}

.circle-4 {
    width: 100px;
    height: 100px;
    top: 30%;
    right: 30%;
    animation-delay: 1s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* Main Content */
main {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-top: 20px;
}

/* Sections */
section {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    color: #333;
}

section h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #2c3e50;
    text-align: center;
}

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

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

/* Search Options */
.search-options {
    margin-bottom: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background-color: #25d366;
    border-color: #25d366;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Search Fields */
.search-fields {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.search-field {
    flex: 1;
    min-width: 0;
    padding: 12px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    background: white;
    color: #2c3e50;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-field::placeholder {
    color: #95a5a6;
}

.search-field:focus {
    outline: none;
    border-color: #25d366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

/* Mobile responsive search fields */
@media (max-width: 480px) {
    .search-fields {
        flex-direction: column;
        gap: 6px;
    }
    
    .search-field {
        width: 100%;
    }
}

.form-group label {
    font-weight: 500;
    color: #34495e;
    font-size: 0.9rem;
}

.create-hint {
    font-weight: 400;
    color: #3498db;
    font-size: 0.8rem;
    font-style: italic;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.create-hint:hover {
    color: #2980b9;
}

.form-group input,
.form-group textarea {
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #25d366;
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Search Results */
.search-results {
    position: relative;
    z-index: 10;
}

.search-result-item {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-result-item:hover {
    background: #f8f9fa;
    border-color: #25d366;
    transform: translateY(-1px);
}

.search-result-item:last-child {
    margin-bottom: 0;
}

.result-ref {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.result-address {
    color: #7f8c8d;
    font-size: 0.8rem;
    margin-top: 2px;
}

.result-zip {
    color: #95a5a6;
    font-size: 0.75rem;
    margin-top: 2px;
}

/* Selected Delivery Info */
.selected-delivery {
    background: #f8f9fa;
    border: 2px solid #25d366;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
}

.selected-delivery h3 {
    color: #2c3e50;
    font-size: 1.1rem;
    margin-bottom: 12px;
    text-align: center;
}

.delivery-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.detail-item .label {
    font-weight: 500;
    color: #7f8c8d;
    font-size: 0.85rem;
}

.detail-item .value {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

/* Manual Entry Form */
.manual-entry {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
}

.manual-entry h3 {
    color: #856404;
    font-size: 1.1rem;
    margin-bottom: 12px;
    text-align: center;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    min-height: 48px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
    min-height: 56px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
    min-height: 36px;
}

.btn-success {
    background: linear-gradient(135deg, #25d366, #20c55e);
    color: white;
}

.btn-primary {
    background: linear-gradient(135deg, #34b7f1, #2196f3);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
}

.btn .icon {
    font-size: 1.2em;
}

/* Login Modal */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.login-modal.show {
    opacity: 1;
    visibility: visible;
}

.login-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.login-modal.show .login-content {
    transform: scale(1);
}

.login-content h2 {
    text-align: center;
    margin-bottom: 25px;
    color: #2c3e50;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    margin-top: 15px;
    text-align: center;
}

/* User Info Bar */
.user-info-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: opacity 0.2s ease, visibility 0.2s ease;
    min-height: 50px;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 480px;
    margin: 0 auto;
}

.user-name {
    font-weight: 600;
    color: #2c3e50;
}

/* Success Modal */
.success-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.success-modal.show {
    opacity: 1;
    visibility: visible;
}

.success-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.success-modal.show .success-content {
    transform: scale(1);
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.success-content h2 {
    color: #25d366;
    margin-bottom: 15px;
}

.success-content p {
    color: #7f8c8d;
    margin-bottom: 20px;
}

.success-details {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading-overlay p {
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    section {
        padding: 20px;
    }
    
    .btn-large {
        padding: 14px 28px;
        font-size: 1rem;
    }
    
    .login-content,
    .success-content {
        padding: 25px;
    }
}

/* Animation for form elements */
.form-group input:focus,
.form-group textarea:focus {
    animation: focusGlow 0.3s ease;
}

@keyframes focusGlow {
    0% { box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1); }
    50% { box-shadow: 0 0 0 6px rgba(37, 211, 102, 0.2); }
    100% { box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1); }
}

/* Create Modal */
.create-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.create-modal.show {
    opacity: 1;
    visibility: visible;
}

.create-content {
    background: white;
    padding: 25px;
    border-radius: 20px;
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.create-modal.show .create-content {
    transform: scale(1);
}

.create-content h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.4rem;
    text-align: center;
}

.create-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.modal-buttons .btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 0.9rem;
}

/* Autocomplete Dropdown Styles */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.autocomplete-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.autocomplete-option:last-child {
    border-bottom: none;
}

.autocomplete-option:hover,
.autocomplete-option.selected {
    background: #f8f9fa;
}

.autocomplete-option.selected {
    background: #e8f5e9;
}

.option-address {
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.option-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.option-code {
    font-size: 0.8rem;
    color: #7f8c8d;
    font-weight: 500;
}

.option-zip {
    font-size: 0.75rem;
    color: #95a5a6;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Mobile-friendly touch targets */
@media (max-width: 480px) {
    .autocomplete-option {
        padding: 16px;
        min-height: 56px;
    }

    .option-address {
        font-size: 1rem;
    }

    .option-code {
        font-size: 0.85rem;
    }

    .option-zip {
        font-size: 0.8rem;
    }
}