/**
 * UrbanIT Mobile-First UX Styles
 * App-like experience for mobile devices
 */

/* Base Mobile Optimizations */
* {
    -webkit-tap-highlight-color: rgba(139, 2, 48, 0.1);
    -webkit-touch-callout: none;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Touch-Friendly Buttons */
.touch-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.touch-btn:active {
    transform: scale(0.96);
}

/* Bottom Navigation (Mobile App Style) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #E5E7EB;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    z-index: 1000;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    color: #6B7280;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    min-width: 64px;
}

.bottom-nav-item.active {
    color: #8B0230;
}

.bottom-nav-item i {
    font-size: 20px;
}

/* Safe Area Support (iPhone notch, etc) */
.safe-area-top {
    padding-top: env(safe-area-inset-top);
}

.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
}

/* Pull to Refresh Indicator */
.pull-refresh {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: top 0.3s ease;
}

.pull-refresh.active {
    top: 20px;
}

/* Swipeable Cards */
.swipeable-card {
    touch-action: pan-y;
    transition: transform 0.3s ease;
}

.swipeable-card.swiping {
    transition: none;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #F3F4F6 25%, #E5E7EB 50%, #F3F4F6 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Floating Action Button (FAB) */
.fab {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    right: 20px;
    width: 56px;
    height: 56px;
    background: #8B0230;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(139, 2, 48, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 999;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(139, 2, 48, 0.4);
}

.fab:active {
    transform: scale(0.95);
}

/* Bottom Sheet */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 24px 24px 0 0;
    padding: 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1001;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
}

.bottom-sheet.open {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #D1D5DB;
    border-radius: 2px;
    margin: 0 auto 20px;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Sticky Header */
.sticky-header {
    position: sticky;
    top: 0;
    background: white;
    z-index: 100;
    padding: 16px;
    border-bottom: 1px solid #E5E7EB;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.95);
}

/* Horizontal Scroll Container */
.horizontal-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 16px 0;
}

.horizontal-scroll::-webkit-scrollbar {
    display: none;
}

.horizontal-scroll > * {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* Status Bar Spacer */
.status-bar-spacer {
    height: env(safe-area-inset-top);
    background: white;
}

/* Input Focus Styles (Mobile Optimized) */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #8B0230;
    box-shadow: 0 0 0 3px rgba(139, 2, 48, 0.1);
}

/* Prevent Zoom on Input Focus (iOS) */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
textarea,
select {
    font-size: 16px;
}

/* Touch Feedback */
.touch-feedback {
    position: relative;
    overflow: hidden;
}

.touch-feedback::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(139, 2, 48, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.touch-feedback:active::after {
    width: 200px;
    height: 200px;
}

/* List Items (Touch Optimized) */
.list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: white;
    border-radius: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    min-height: 64px;
}

.list-item:active {
    background: #F9FAFB;
    transform: scale(0.98);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: #6B7280;
}

.empty-state i {
    font-size: 64px;
    color: #D1D5DB;
    margin-bottom: 16px;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: #E5E7EB;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: #8B0230;
    transition: width 0.3s ease;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    left: 16px;
    right: 16px;
    background: #111827;
    color: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(200%);
    transition: transform 0.3s ease;
    z-index: 1002;
}

.toast.show {
    transform: translateY(0);
}

/* Responsive Breakpoints */
@media (max-width: 640px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    h1 { font-size: 28px; }
    h2 { font-size: 24px; }
    h3 { font-size: 20px; }
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }
    
    .fab {
        bottom: 24px;
    }
}

/* Smooth Scrolling */
.smooth-scroll {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Disable Text Selection on UI Elements */
button,
.btn,
.touch-btn,
.list-item {
    user-select: none;
    -webkit-user-select: none;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #E5E7EB;
    border-top-color: #8B0230;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Haptic Feedback Classes (for JS integration) */
/* These classes are used as hooks for JavaScript to trigger device haptic feedback */
/* Example: element.classList.add('haptic-light') triggers vibration via JS */
