* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2C1810;
    --secondary-color: #5D4037;
    --accent-color: #D4A574;
    --text-dark: #333;
    --text-light: #666;
    --bg-light: #e8e4df;
    --border-color: #ddd;
    --success-color: #4CAF50;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
}

/* Navigation */
.navbar {
    background-color: var(--primary-color);
    color: white;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: var(--accent-color);
}

#authNav {
    display: flex;
    gap: 1rem;
}

#authNav a {
    color: white;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s;
}

#authNav a:hover {
    color: var(--accent-color);
}

/* Views */
.view {
    display: none;
    min-height: calc(100vh - 60px);
    animation: fadeIn 0.3s;
}

/* Map view specific - no scroll */
#mapView {
    height: calc(100vh - 60px);
    max-height: calc(100vh - 60px);
    overflow: hidden;
}

/* Portrait mode - allow page scroll for map view */
@media (max-aspect-ratio: 1/1) {
    #mapView {
        overflow: visible;
        height: auto;
        min-height: calc(100vh - 60px);
    }
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
}

.container-full {
    width: 100%;
    height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 3rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    text-align: center;
}

.hero h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

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

/* Sections */
.section {
    background: white;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.section h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.3rem;
}

/* Town Select */
.town-select {
    position: relative;
}

.town-select input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    background-color: white;
    transition: border-color 0.3s;
}

.town-select input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.town-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 5px 5px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.town-results.active {
    display: block;
}

.town-result-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.town-result-item:last-child {
    border-bottom: none;
}

.town-result-item:hover {
    background-color: var(--bg-light);
    color: var(--primary-color);
    font-weight: 500;
}

/* Sort toggle button */
.sort-toggle-btn {
    padding: 8px 16px;
    border: 2px solid var(--secondary-color);
    border-radius: 4px;
    background-color: white;
    color: var(--text-dark);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    font-weight: 500;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sort-toggle-btn:hover {
    background-color: var(--bg-light);
    border-color: var(--primary-color);
}

.sort-toggle-btn:active {
    transform: scale(0.98);
}

.sort-toggle-btn.rating-mode {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--primary-color);
}

.sort-toggle-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Map rating filter buttons */
.map-rating-btn {
    padding: 6px 10px;
    border: 1px solid var(--secondary-color);
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    font-family: inherit;
    color: var(--text-dark);
    min-height: 36px;
}

.map-rating-btn:hover {
    background-color: var(--bg-light);
    border-color: var(--primary-color);
}

.map-rating-btn:active {
    transform: scale(0.98);
}

.map-rating-btn.rating-mode {
    background-color: var(--accent-color);
    color: var(--primary-color);
    border-color: var(--accent-color);
    font-weight: bold;
}

.map-rating-btn:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Restaurant List */
.restaurant-list {
    display: grid;
    gap: 1rem;
}

.restaurant-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.restaurant-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.restaurant-name {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.restaurant-address {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.rating-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rating-stars {
    color: var(--accent-color);
    font-size: 1rem;
}

.rating-count {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Recent Reviews List */
.recent-reviews-list {
    display: grid;
    gap: 1rem;
}

.review-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.review-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.review-header {
    margin-bottom: 0.5rem;
}

.review-restaurant-name {
    font-size: 1rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.review-location {
    font-size: 0.85rem;
    color: var(--text-light);
}

.review-ratings {
    margin: 8px 0;
    font-size: 0.9em;
    color: #d4af37;
    font-weight: bold;
}

.review-comment {
    font-size: 0.95rem;
    color: var(--text-dark);
    line-height: 1.5;
    margin: 0.75rem 0;
}

.review-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
}

.review-author {
    font-weight: 500;
}

.review-date {
    font-style: italic;
}

.show-more-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
    margin-left: 0.5rem;
    text-decoration: underline;
    font-weight: 500;
}

.show-more-btn:hover {
    color: var(--primary-color);
}



/* Town List */
.town-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.town-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.town-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.town-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.town-stars {
    font-size: 1.2rem;
    color: var(--accent-color);
}

.town-rating-value {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.town-stats {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0;
}

/* Review Form Section */
.review-form-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.review-form-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.rating-selector {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rating-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.rating-option:hover {
    background-color: var(--bg-light);
}

.rating-option input[type="radio"] {
    margin-right: 0.75rem;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.review-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.reviews-list-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.reviews-list-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.review-card {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.review-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.review-card-author {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1rem;
}

.review-card-date {
    color: var(--text-light);
    font-size: 0.85rem;
}

.review-card-rating {
    color: var(--accent-color);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    font-weight: bold;
}

.review-card-text {
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 0.95rem;
}

.detail-header {
    margin-bottom: 1.5rem;
}

.detail-header h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.detail-info {
    margin-bottom: 1rem;
}

.detail-info p {
    margin-bottom: 0.25rem;
    color: var(--text-light);
}

.detail-label {
    font-weight: bold;
    color: var(--primary-color);
}

.reviews-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
}

.reviews-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.review-item {
    background: var(--bg-light);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 5px;
    border-left: 3px solid var(--secondary-color);
}

.review-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.review-author {
    font-weight: bold;
}

.review-date {
    color: var(--text-light);
}

.review-rating {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.review-text {
    color: var(--text-dark);
    line-height: 1.5;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-back {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: scale(1.02);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--primary-color);
}

.btn-back {
    background-color: transparent;
    color: var(--primary-color);
    padding: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.btn-back:hover {
    background-color: var(--bg-light);
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1rem;
}

.btn-pagination {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: var(--secondary-color);
    color: white;
    transition: all 0.3s;
    font-weight: bold;
}

.btn-pagination:hover:not(:disabled) {
    background-color: var(--primary-color);
    transform: scale(1.05);
}

.btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 200;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: linear-gradient(135deg, #f9f7f4 0%, #f0ebe4 100%);
    padding: 2rem;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(139, 69, 19, 0.4), inset 0 1px 0 rgba(255,255,255,0.5);
    max-height: 90vh;
    overflow-y: auto;
    border: 3px solid var(--secondary-color);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    border-bottom: 3px solid var(--accent-color);
    padding-bottom: 0.75rem;
    font-size: 1.8rem;
}

.close {
    float: right;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: var(--primary-color);
}

/* Form */
form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

input, textarea, select {
    padding: 0.75rem;
    border: 2px solid var(--secondary-color);
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s, background-color 0.3s;
    background-color: #fefdfb;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 5px rgba(139, 69, 19, 0.3);
}

/* Password field container with toggle button */
.password-field-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-field-container input {
    flex: 1;
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    line-height: 1;
}

.password-toggle:hover {
    opacity: 0.7;
}

.password-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 3px;
}

.password-toggle .eye-icon {
    display: inline-block;
    pointer-events: none;
}

.rating-input {
    margin: 1rem 0;
}

.rating-input label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.stars {
    display: flex;
    gap: 0.5rem;
}

.stars input {
    display: none;
}

.stars label {
    cursor: pointer;
    font-size: 1.5rem;
    transition: color 0.2s;
}

/* Map */
.map-container {
    flex: 0 0 45vh;
    width: 100%;
    position: relative;
    max-height: 45vh;
}

#map {
    width: 100%;
    height: 100%;
}

/* Map loading overlay */
.map-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.map-loading-spinner {
    text-align: center;
}

.map-loading-spinner .spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.map-loading-spinner p {
    color: var(--text-dark);
    font-weight: 500;
    margin: 0;
}

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

.map-info {
    background: white;
    padding: 1rem;
    border-top: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    max-height: 100%;
}

/* Portrait mode - ensure map-info scrolls internally */
@media (max-aspect-ratio: 1/1) {
    .map-info {
        overflow-y: auto;
    }
    
    #mapSearchResults {
        max-height: none !important;
        overflow-y: visible !important;
    }
}

/* Landscape mode: move map-info to the left side */
@media (min-aspect-ratio: 1/1) {
    body:has(#mapView.active) {
        overflow: hidden;
    }
    
    #mapView {
        height: calc(100vh - 60px);
        max-height: calc(100vh - 60px);
        overflow: hidden;
    }
    
    .container-full {
        flex-direction: row;
        height: calc(100vh - 60px);
    }
    
    .map-info {
        order: -1;
        border-top: none;
        border-right: 2px solid var(--border-color);
        width: 320px;
        min-width: 320px;
        max-width: 320px;
        height: 100%;
        overflow-y: auto;
    }
    
    .map-container {
        flex: 1 1 auto;
        max-height: 100%;
        height: 100%;
    }
    
    #mapSearchResults {
        max-height: none !important;
        overflow-y: visible !important;
    }
}

.map-info h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.map-info p {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.selected-restaurant-card {
    cursor: pointer;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: #f9f9f9;
    transition: all 0.2s;
}

.selected-restaurant-card:hover {
    background: #f0f0f0;
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Utility Classes */
.placeholder {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nav-menu {
        gap: 1rem;
        font-size: 0.9rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .town-list {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .container {
        padding: 1rem;
    }

    .section {
        padding: 1rem;
    }

    .restaurant-card {
        padding: 0.8rem;
    }

    .restaurant-name {
        font-size: 1rem;
    }

    .btn-primary, .btn-secondary {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .navbar-container {
        padding: 0.75rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .nav-menu {
        gap: 0.5rem;
        font-size: 0.8rem;
    }

    .hero {
        padding: 2rem 1rem;
    }

    .hero h1 {
        font-size: 1.3rem;
    }

    .modal-content {
        width: 100%;
        border-radius: 0;
    }
}

/* Notifications */
.notification {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.notification-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.notification-message {
    flex: 1;
    word-break: break-word;
}

.notification-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.notification-close:hover {
    opacity: 1;
}

.notification-close:active {
    transform: scale(1.1);
}

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

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* CAPTCHA Grid */
.captcha-grid-item {
    transition: all 0.2s !important;
}

.captcha-grid-item:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.2);
}

.captcha-grid-item.selected {
    border-color: #8B4513 !important;
    background-color: #f0ebe4 !important;
}

/* Map Search Results */
#mapSearchResults {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

#mapSearchResults::-webkit-scrollbar {
    width: 8px;
}

#mapSearchResults::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#mapSearchResults::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#mapSearchResults::-webkit-scrollbar-thumb:hover {
    background: #555;
}

#mapSearchResults:empty {
    border: none;
}


/* Google Ads - Sticky Sidebar */
.sidebar-ad {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    margin: 20px auto;
    display: none; /* Hidden until Google approves */
}

.sidebar-ad-left {
    order: 1;
}

.sidebar-ad-right {
    order: 3;
}

/* Desktop: Sticky sidebars */
@media (min-width: 1000px) {
    .sidebar-ad {
        position: fixed;
        top: 80px;
        width: 160px;
        min-height: 600px;
        z-index: 10;
        margin: 0;
        display: none !important; /* Hidden until Google approves */
    }
    
    .sidebar-ad-left {
        left: 20px;
    }
    
    .sidebar-ad-right {
        right: 20px;
    }
}

/* Mobile/Tablet: Inline ads */
@media (max-width: 999px) {
    .sidebar-ad {
        position: static;
        width: 100%;
        max-width: 100%;
        min-height: 100px;
        display: none !important; /* Hidden until Google approves */
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .hero {
        margin-bottom: 0.5rem;
    }
}
