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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 20%, #ffeaa7 40%, #a8e6cf 60%, #87ceeb 80%, #dda0dd 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    color: #2c3e50;
    line-height: 1.6;
    padding-bottom: 80px; /* Space for floating action bar */
    min-height: 100vh;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Main Container */
.main-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

@media (min-width: 768px) {
    .main-container {
        max-width: 375px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Header Section */
.header {
    text-align: center;
    margin-bottom: 32px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    line-height: 1.3;
}

.subtitle {
    font-size: 18px;
    color: #555;
    font-weight: 500;
}

/* Form Styles */
.form-section {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.form-group {
    margin-bottom: 20px;
}

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

.form-input,
.form-select {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    border: 2px solid #e1e8ed;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border: 2px solid #3498db;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    transform: translateY(-1px);
}

.form-select {
    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='%23667eea' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' 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;
}

/* Error Messages */
.error-message {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 4px;
    min-height: 18px;
}

/* More Options Toggle */
.more-options-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #eee;
    margin-bottom: 16px;
}

.more-options-toggle:hover {
    color: #3498db;
}

#moreOptionsText {
    font-weight: 500;
    color: #2c3e50;
}

.caret {
    font-size: 12px;
    color: #7f8c8d;
    transition: transform 0.2s ease;
}

.caret.rotated {
    transform: rotate(180deg);
}

/* Optional Filters */
.optional-filters {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 0;
    opacity: 0;
}

.optional-filters.show {
    max-height: 500px;
    opacity: 1;
    margin-bottom: 20px;
}

/* Mobile-specific more options height */
@media (max-width: 414px) {
    .optional-filters.show {
        max-height: 600px;
    }
}

/* Form Button Group */
.form-button-group {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.form-button-group .primary-button {
    width: 100%;
}

/* Results Section */
.results-section {
    margin-top: 8px;
}

.results-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.results-subtitle {
    color: #7f8c8d;
    font-size: 14px;
    margin-bottom: 24px;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 20px 20px;
}

/* Mobile-specific loading state optimization */
@media (max-width: 414px) {
    .loading-state {
        padding: 12px 20px;
    }
    
    .results-section {
        margin-top: 4px;
    }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-state p {
    color: #7f8c8d;
    font-size: 16px;
}

/* Loading Dots Animation */
.loading-dots::after {
    content: '';
    display: inline-block;
    animation: loadingDots 3s infinite;
}

@keyframes loadingDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

/* Results Grid */
.results-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Place Card */
.place-card {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.place-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.place-card:active {
    transform: translateY(-2px);
}

.place-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 16px 16px 0 0;
}

.place-image-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 48px;
    border-radius: 16px 16px 0 0;
}

.place-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.place-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: nowrap;
}

.place-name {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.3;
    flex: 1;
    margin-right: 12px;
}

.place-rating {
    font-size: 16px;
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
}

.place-description {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 8px;
}

.place-category {
    font-size: 13px;
    color: #3498db;
    font-weight: 500;
    margin-bottom: 4px;
}

.place-address {
    font-size: 13px;
    color: #7f8c8d;
    line-height: 1.3;
}

/* No Results State */
.no-results-state {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
}

/* Floating Action Bar */
.floating-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.1);
    padding: 16px 20px;
    z-index: 1000;
}

.button-group {
    display: flex;
    gap: 12px;
    max-width: 375px;
    margin: 0 auto;
}

/* Buttons */
.primary-button,
.secondary-button {
    flex: 1;
    padding: 18px 28px;
    border-radius: 16px;
    border: none;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 56px;
    position: relative;
    overflow: hidden;
}

.primary-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.primary-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 50%, #de81e9 100%);
}

.primary-button:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.secondary-button {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    color: #2c3e50;
    border: 2px solid rgba(102, 126, 234, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.secondary-button:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.secondary-button:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 375px) {
    .main-container {
        padding: 16px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .place-card {
        flex-direction: column;
    }
    
    .place-image,
    .place-image-placeholder {
        width: 100%;
        height: 120px;
    }
}

/* Focus styles for accessibility */
.form-input:focus-visible,
.form-select:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.place-card:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Touch improvements for mobile */
@media (hover: none) and (pointer: coarse) {
    .place-card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .primary-button:hover,
    .secondary-button:hover {
        transform: none;
    }
}
