@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700;900&display=swap');

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

body {
    font-family: 'Roboto', sans-serif;
    background: #f5f5f5;
    color: #1a1a1a;
    line-height: 1.6;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid #e5e5e5;
    padding: 24px 0;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    flex: 1;
}

.header-right {
    display: flex;
    align-items: center;
}

.logo {
    font-size: 32px;
    font-weight: 900;
    color: #dc143c;
    margin-bottom: 4px;
}

.tagline {
    font-size: 15px;
    color: #666;
    font-weight: 400;
}

/* Auth Components */
.user-section {
    display: flex;
    align-items: center;
}

.sign-in-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #dc143c;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.sign-in-btn:hover {
    background: #b8112e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #dc143c;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
}

.sign-out-btn {
    padding: 8px 16px;
    background: #f5f5f5;
    color: #666;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.sign-out-btn:hover {
    background: #e5e5e5;
    color: #1a1a1a;
}

.sync-status {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: #28a745;
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s;
    z-index: 1000;
}

.sync-status.error {
    background: #dc143c;
}

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

/* Filters Bar */
.filters-bar {
    background: white;
    border-bottom: 1px solid #e5e5e5;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.filters-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 50px;
    background: white;
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 180px;
}

.filter-select:hover {
    border-color: #dc143c;
}

.filter-select:focus {
    outline: none;
    border-color: #dc143c;
    box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.1);
}

.filter-chip {
    padding: 10px 20px;
    border: 1px solid #e5e5e5;
    border-radius: 50px;
    background: white;
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip:hover {
    background: #f5f5f5;
    border-color: #ddd;
}

.filter-chip.active {
    background: #dc143c;
    color: white;
    border-color: #dc143c;
}

.stats-compact {
    margin-left: auto;
    padding: 10px 20px;
    background: #f5f5f5;
    border-radius: 50px;
}

.stat-text {
    font-size: 14px;
    color: #666;
}

.stat-text strong {
    color: #dc143c;
    font-weight: 700;
}

/* View Toggle */
.view-toggle {
    max-width: 1400px;
    margin: 24px auto 16px;
    padding: 0 24px;
    display: flex;
    gap: 8px;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn:hover {
    background: #f5f5f5;
}

.view-btn.active {
    background: #1a1a1a;
    color: white;
    border-color: #1a1a1a;
}

/* Main Wrapper */
.main-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px 48px;
}

/* Grid View */
.content-grid {
    margin-top: 24px;
}

.restaurant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* Restaurant Card */
.restaurant-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid #e5e5e5;
    position: relative;
}

.restaurant-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
    border-color: #dc143c;
}

.restaurant-card.visited {
    border: 2px solid #28a745;
}

.restaurant-card.visited::before {
    content: '✓';
    position: absolute;
    top: 16px;
    right: 16px;
    background: #28a745;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    z-index: 1;
}

.restaurant-card.wishlist {
    border: 2px solid #ffc107;
}

.restaurant-card.wishlist::before {
    content: '⭐';
    position: absolute;
    top: 16px;
    right: 16px;
    background: #ffc107;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    z-index: 1;
}

.card-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #dc143c 0%, #a00d2e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    position: relative;
    background-size: cover;
    background-position: center;
}

.restaurant-card[data-status="closed"] {
    opacity: 0.7;
}

.restaurant-card[data-status="closed"] .card-image::after {
    content: 'CLOSED';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
}

.card-content {
    padding: 20px;
}

.card-header {
    margin-bottom: 12px;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 6px;
}

.card-location {
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-meta {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.card-badge {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
}

.badge-open {
    background: #d4edda;
    color: #155724;
}

.badge-currently-open {
    background: #d4edda;
    color: #155724;
}

.badge-closed {
    background: #f8d7da;
    color: #721c24;
}

.badge-cuisine {
    background: #f5f5f5;
    color: #666;
}

.card-show {
    font-size: 12px;
    color: #999;
    font-style: italic;
    margin-top: 8px;
}

/* Map View */
.map-view {
    margin-top: 24px;
}

.map-canvas {
    width: 100%;
    height: calc(100vh - 300px);
    border-radius: 12px;
    border: 1px solid #e5e5e5;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

.modal.active {
    display: block;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.2s;
}

.modal-dialog {
    position: relative;
    background: white;
    margin: 48px auto;
    max-width: 700px;
    border-radius: 16px;
    animation: slideUp 0.3s;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f5f5f5;
    transform: scale(1.1);
}

.modal-body {
    padding: 40px;
}

.modal-header-section {
    margin-bottom: 32px;
}

.modal-title {
    font-size: 32px;
    font-weight: 900;
    color: #1a1a1a;
    margin-bottom: 12px;
}

.modal-location {
    font-size: 18px;
    color: #666;
    margin-bottom: 16px;
}

.modal-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.modal-section {
    margin-bottom: 32px;
}

.modal-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
}

.modal-text {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
}

.modal-detail-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.modal-detail-label {
    font-weight: 500;
    color: #1a1a1a;
    width: 120px;
}

.modal-detail-value {
    color: #666;
    flex: 1;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
}

.modal-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: #dc143c;
    color: white;
}

.btn-primary:hover {
    background: #b8112e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.3);
}

.btn-secondary {
    background: #1a1a1a;
    color: white;
}

.btn-secondary:hover {
    background: #333;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #f5f5f5;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 24px;
}

.checkbox-wrapper:hover {
    background: #e9e9e9;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: #28a745;
}

.checkbox-label {
    font-size: 16px;
    font-weight: 500;
    color: #1a1a1a;
    cursor: pointer;
}

/* Track Options */
.track-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.track-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.track-option:hover {
    border-color: #ccc;
    background: #f9f9f9;
}

.track-option input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.track-option input[type="radio"]:checked + .track-label {
    font-weight: 700;
}

.track-option.visited-option:has(input:checked) {
    border-color: #28a745;
    background: #d4edda;
}

.track-option.wishlist-option:has(input:checked) {
    border-color: #ffc107;
    background: #fff3cd;
}

.track-label {
    font-size: 16px;
    color: #1a1a1a;
    cursor: pointer;
    flex: 1;
}

.btn-submit {
    width: 100%;
    margin-top: 8px;
}

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

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

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.popup-content {
    padding: 4px;
    min-width: 200px;
}

.popup-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 6px;
    color: #1a1a1a;
}

.popup-location {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.popup-btn {
    display: block;
    width: 100%;
    padding: 8px;
    background: #dc143c;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    font-family: 'Roboto', sans-serif;
}

.popup-btn:hover {
    background: #b8112e;
}

/* Responsive */
@media (max-width: 768px) {
    .restaurant-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .stats-compact {
        margin-left: 0;
        text-align: center;
    }
    
    .modal-dialog {
        margin: 0;
        max-height: 100%;
        min-height: 100vh;
        min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .modal-body {
        padding: 24px;
        padding-bottom: 60px; /* Extra padding at bottom to ensure buttons are visible */
        overflow-y: auto;
        flex: 1;
    }
    
    .modal-title {
        font-size: 24px;
    }
    
    .modal-actions {
        padding-bottom: env(safe-area-inset-bottom, 20px); /* iOS safe area */
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f5f5f5;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}
