/* ===================================
   Halal Yalla App - Landing Page Style Integration
   Version 2.2.3
   =================================== */

/* ===== Minimal App Header ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.app-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    max-width: 100%;
}

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

.app-logo-svg {
    flex-shrink: 0;
}

.app-logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.app-menu-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.app-menu-btn:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.app-menu-btn:active {
    transform: scale(0.95);
}

/* ===== Floating City Selector (FAB) ===== */
.city-fab {
    position: fixed;
    bottom: calc(70px + 1rem + env(safe-area-inset-bottom)); /* Above bottom nav */
    right: 1rem;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: white;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px;
}

.city-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.12);
}

.city-fab:active {
    transform: translateY(-1px) scale(0.98);
}

.city-fab-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.city-fab-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

/* ===== City Selector Modal ===== */
.city-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.city-modal.active {
    display: flex;
    opacity: 1;
}

.city-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.city-modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    width: 100%;
    max-width: 100%;
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.city-modal.active .city-modal-content {
    transform: translateY(0);
}

.city-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--bg-light);
}

.city-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.city-modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-light);
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.city-modal-close:hover {
    background: var(--primary-alpha);
    color: var(--primary);
}

.city-modal-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.city-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 2px solid var(--bg-light);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
    min-height: 72px;
    -webkit-tap-highlight-color: transparent;
}

.city-option:hover {
    border-color: var(--primary-light);
    background: var(--primary-alpha);
    transform: translateX(4px);
}

.city-option:active {
    transform: translateX(4px) scale(0.98);
}

.city-option.active {
    border-color: var(--primary);
    background: var(--primary-alpha);
}

.city-option-flag {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.city-option-info {
    flex: 1;
}

.city-option-info h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.city-option-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.city-option-check {
    font-size: 1.25rem;
    color: var(--primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.city-option.active .city-option-check {
    opacity: 1;
}

/* ===== App Main Container ===== */
.app-main {
    padding-top: 56px; /* Height of minimal header */
}

/* ===== Islamic Pattern Background ===== */
.pattern-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(30deg, var(--primary-alpha) 12%, transparent 12.5%, transparent 87%, var(--primary-alpha) 87.5%, var(--primary-alpha)),
        linear-gradient(150deg, var(--primary-alpha) 12%, transparent 12.5%, transparent 87%, var(--primary-alpha) 87.5%, var(--primary-alpha)),
        linear-gradient(30deg, var(--primary-alpha) 12%, transparent 12.5%, transparent 87%, var(--primary-alpha) 87.5%, var(--primary-alpha)),
        linear-gradient(150deg, var(--primary-alpha) 12%, transparent 12.5%, transparent 87%, var(--primary-alpha) 87.5%, var(--primary-alpha)),
        linear-gradient(60deg, rgba(46, 139, 87, 0.05) 25%, transparent 25.5%, transparent 75%, rgba(46, 139, 87, 0.05) 75%, rgba(46, 139, 87, 0.05)),
        linear-gradient(60deg, rgba(46, 139, 87, 0.05) 25%, transparent 25.5%, transparent 75%, rgba(46, 139, 87, 0.05) 75%, rgba(46, 139, 87, 0.05));
    background-size: 80px 140px;
    background-position: 0 0, 0 0, 40px 70px, 40px 70px, 0 0, 40px 70px;
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
}

/* ===== App Sections with Landing Page Style ===== */
.app-section {
    position: relative;
    min-height: calc(100vh - 56px);
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-white) 100%);
    overflow: hidden;
    display: none;
}

.app-section.active {
    display: block;
}

.section-inner {
    position: relative;
    z-index: 1;
    padding: 2rem 1rem;
    padding-bottom: calc(70px + 2rem + env(safe-area-inset-bottom));
}

.section-header {
    margin-bottom: 2rem;
    text-align: center;
}

.section-title-group {
    max-width: 600px;
    margin: 0 auto;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
}

.section-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* ===== Map Wrapper ===== */
.map-wrapper {
    position: relative;
    width: 100%;
    height: calc(100vh - 56px - 120px - 70px - env(safe-area-inset-bottom));
    min-height: 400px;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
    margin-top: 1rem;
}

.app-map {
    width: 100%;
    height: 100%;
}

/* ===== Place Details Panel - Redesigned ===== */
.place-details-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background: white;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 950;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.place-details-panel.active {
    transform: translateY(0);
}

.place-panel-drag-handle {
    padding: 0.75rem 0 0.5rem;
    display: flex;
    justify-content: center;
    cursor: grab;
    flex-shrink: 0;
    z-index: 15;
}

.drag-indicator {
    width: 40px;
    height: 4px;
    background: var(--bg-light);
    border-radius: 2px;
}

.place-panel-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--bg-light);
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 20;
    flex-shrink: 0;
}

.place-panel-close:hover {
    background: var(--primary-alpha);
    color: var(--primary);
}

.place-panel-close:active {
    transform: scale(0.95);
}

.place-panel-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 1.5rem 2rem;
    min-height: 0;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom) + 70px);
}

/* Place Panel Content Styles */
.place-panel-scroll .place-name {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.place-panel-scroll .place-name-local {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin: 0 0 1rem 0;
    font-weight: 500;
}

.place-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.place-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
}

.place-info-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.place-info-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.place-address-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--primary-alpha);
    border-radius: var(--radius-xl);
    border-left: 4px solid var(--primary);
}

.place-address-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.place-address-text {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.place-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.feature-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: white;
    border: 1.5px solid var(--bg-light);
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.feature-tag.verified {
    background: var(--primary-alpha);
    border-color: var(--primary);
    color: var(--primary);
}

.place-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--bg-light);
}

.place-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    min-height: 48px;
}

.place-action-btn.map-btn {
    background: var(--bg-white);
    color: #2D5F3F;
    border: 2px solid #2D5F3F;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.place-action-btn.map-btn:hover {
    background: #f0f7f4;
    box-shadow: 0 2px 8px rgba(45, 95, 63, 0.15);
}

.place-action-btn.website-btn {
    background: var(--bg-white);
    color: #1976D2;
    border: 2px solid #1976D2;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.place-action-btn.website-btn:hover {
    background: #e3f2fd;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.15);
}

.place-action-btn.secondary {
    background: var(--bg-white);
    color: var(--text-primary);
    border: 1.5px solid #E0E0E0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.place-action-btn.secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.place-action-btn:active {
    transform: scale(0.97);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ===== Desktop Optimizations ===== */
@media (min-width: 768px) {
    .app-header-container {
        padding: 1rem 2rem;
    }
    
    .app-logo-text {
        font-size: 1.25rem;
    }
    
    .city-fab {
        left: 2rem;
        padding: 1rem 1.5rem;
    }
    
    .city-fab-label {
        font-size: 1rem;
    }
    
    .section-inner {
        padding: 3rem 2rem;
    }
    
    .section-title {
        font-size: 2.5rem;
    }
    
    .section-subtitle {
        font-size: 1.25rem;
    }
    
    .map-wrapper {
        max-width: 1200px;
        margin: 2rem auto;
        height: calc(100vh - 56px - 200px);
    }
    
    .place-details-panel {
        left: auto;
        right: 2rem;
        bottom: 2rem;
        max-width: 480px;
        max-height: calc(100vh - 150px);
        border-radius: var(--radius-2xl);
        padding-bottom: 0;
    }
    
    .place-panel-scroll {
        padding: 0 2rem 2rem;
    }
}

@media (min-width: 1024px) {
    .app-header {
        display: none; /* Hide mobile header on desktop */
    }
    
    /* Desktop logo badge - top left */
    .app-logo {
        position: fixed;
        top: 1.5rem;
        left: 1.5rem;
        z-index: 1000;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.875rem 1.25rem;
        background: white;
        border-radius: 50px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
        transition: all 0.3s ease;
        cursor: pointer;
        text-decoration: none;
    }
    
    .app-logo:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    .app-logo-svg {
        width: 36px;
        height: 36px;
    }
    
    .app-logo-text {
        font-size: 1.25rem;
        font-weight: 700;
        color: var(--primary);
        letter-spacing: -0.02em;
    }
    
    /* Desktop city selector - moved to top-left below logo */
    .city-fab {
        position: fixed;
        top: 7.5rem;
        left: 1.5rem;
        bottom: auto;
        right: auto;
        z-index: 999;
        padding: 0.75rem 1rem;
        border-radius: 12px;
        background: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
        display: flex;
        align-items: center;
        gap: 0.75rem;
        width: auto;
        max-width: 200px;
        transform: none;
    }
    
    .city-fab:hover {
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.1);
        transform: translateY(-1px);
    }
    
    .city-fab-label {
        font-size: 0.95rem;
        font-weight: 600;
        display: block;
    }
    
    /* Desktop left sidebar navigation */
    .nav {
        display: flex !important;
        position: fixed;
        left: 1.5rem;
        top: 13rem;
        flex-direction: column;
        gap: 0.75rem;
        padding: 0;
        background: transparent;
        z-index: 900;
        border: none;
        box-shadow: none;
    }
    
    /* Hide Card Tool and Qibla buttons on desktop */
    .nav-btn[data-section="card"],
    .nav-btn[data-section="qibla"] {
        display: none !important;
    }
    
    .nav-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.875rem;
        width: 80px;
        height: 80px;
        border-radius: 16px;
        background: white;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        border: 1px solid #f0f0f0;
        color: var(--text-secondary);
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 0.85rem;
        font-weight: 500;
    }
    
    .nav-btn:hover {
        background: var(--primary-alpha);
        color: var(--primary);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(46, 139, 87, 0.2);
        border-color: var(--primary-alpha);
    }
    
    .nav-btn.active {
        background: var(--primary);
        color: white;
        box-shadow: 0 6px 16px rgba(46, 139, 87, 0.3);
        border-color: var(--primary);
    }
    
    .nav-icon {
        font-size: 2rem;
    }
    
    .nav-label {
        font-size: 0.7rem;
        text-align: center;
        line-height: 1.2;
    }
    
    .app-main {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        min-height: 100vh;
        padding-top: 0;
        margin-left: 0;
    }
    
    /* Allow sections to display when active */
    .app-section {
        display: none;
        grid-column: 1;
    }
    
    .app-section.active {
        display: block;
    }
    
    #mapSection {
        grid-template-columns: 1fr 420px;
        grid-template-rows: 1fr;
        gap: 0;
        height: 100vh;
        width: 100vw;
        overflow: hidden;
        padding: 0;
        min-height: 100vh;
        background: white;
    }
    
    #mapSection.active {
        display: grid;
    }
    
    /* Map section takes full space on desktop */
    #mapSection .pattern-bg {
        display: none;
    }
    
    #mapSection .section-inner {
        display: contents;
    }
    
    #mapSection .section-header {
        display: none; /* Hide header on map view */
    }
    
    .map-wrapper {
        grid-column: 1 / 2;
        grid-row: 1;
        height: 100vh;
        width: 100%;
        border-radius: 0;
        overflow: hidden;
        margin: 0;
        box-shadow: none;
    }
    
    .app-map {
        height: 100%;
        width: 100%;
    }
    
    /* Place panel as right sidebar on desktop */
    .place-details-panel {
        grid-column: 2 / 3;
        grid-row: 1;
        position: static !important;
        bottom: auto !important;
        right: auto !important;
        width: 100% !important;
        max-width: 420px !important;
        height: 100vh !important;
        border-radius: 0;
        margin: 0 !important;
        padding: 0 !important;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        background: white;
        border-left: 1px solid #e5e7eb;
        box-shadow: -2px 0 8px rgba(0, 0, 0, 0.08);
        z-index: 100;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    /* When no place selected, show a welcome message */
    .place-details-panel.hidden {
        display: flex;
        align-items: center;
        justify-content: center;
        background: #f9fafb;
        border-left: 1px solid #e5e7eb;
    }
    
    .place-details-panel.hidden::before {
        content: '👈 Select a place on the map to see details';
        font-size: 1.125rem;
        color: #6b7280;
        text-align: center;
        padding: 2rem;
        max-width: 300px;
    }
    
    .place-panel-drag-handle {
        display: none;
    }
    
    .place-panel-close {
        display: block;
        position: absolute;
        top: 1.5rem;
        right: 1.5rem;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: #f3f4f6;
        border: none;
        color: #6b7280;
        font-size: 1.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
        z-index: 10;
    }
    
    .place-panel-close:hover {
        background: #e5e7eb;
        color: #374151;
    }
    
    .place-panel-scroll {
        height: 100%;
        overflow-y: auto;
        padding: 2rem !important;
        flex: 1;
    }
    
    /* Bottom navigation hidden on desktop */
    .bottom-nav {
        display: none;
    }
    
    /* Hide card and qibla sections on desktop, but allow saved section */
    #cardSection,
    #qiblaSection {
        display: none !important;
    }
    
    /* Saved section on desktop - full screen layout */
    #savedSection {
        height: 100vh;
        width: 100vw;
        overflow-y: auto;
        padding: 0;
        background: #f9fafb;
    }
    
    #savedSection .section-inner {
        display: block;
        max-width: 1400px;
        margin: 0 auto;
        padding: 8rem 3rem 3rem 12rem;
    }
    
    #savedSection .section-header {
        display: block;
        margin-bottom: 2rem;
    }
    
    /* Target both the container and the list */
    #savedSection .saved-places-container {
        max-width: 100%;
    }
    
    #savedSection .saved-places-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 1.5rem;
    }
    
    /* Empty state styling for desktop */
    #savedSection .empty-state {
        grid-column: 1 / -1;
        text-align: center;
        padding: 4rem 2rem;
    }
}

@media (min-width: 1200px) {
    .section-inner {
        max-width: 1400px;
        margin: 0 auto;
        padding: 3rem 3rem 4rem 3rem;
    }
}

/* Enhanced tablet view */
@media (min-width: 768px) and (max-width: 1023px) {
    .app-main {
        padding-top: 0;
    }
    
    .section-inner {
        max-width: 100%;
        padding: 2.5rem 2rem;
    }
}

/* ===== Hide old header styles ===== */
@media (max-width: 1023px) {
    .header {
        display: none !important;
    }
    
    .nav {
        display: none !important;
    }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    .city-modal-content,
    .place-details-panel,
    .city-fab,
    .nav-btn {
        transition: none !important;
    }
}
