/* Mobile-specific styles for App-like experience */

/* Fixed Tab Bar (Bottom Navigation) */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--card-background);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: var(--transition);
    flex: 1;
    padding: 8px;
}

.tab-item.active {
    color: var(--primary-color);
}

.tab-item-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.tab-item-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.tab-item-icon .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff3b30;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

/* Add padding to body to account for fixed tab bar */
body.has-tab-bar {
    padding-bottom: 70px;
}

/* Page wrapper for smooth transitions */
.page-wrapper {
    min-height: calc(100vh - 70px);
    padding-bottom: 20px;
}

/* Header for mobile pages */
.mobile-header {
    background: var(--card-background);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-header-title {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    flex: 1;
}

.back-btn {
    font-size: 24px;
    color: var(--primary-color);
    text-decoration: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.back-btn:hover {
    background: rgba(0, 122, 255, 0.1);
}

.back-btn:active {
    transform: scale(0.9);
}

.export-btn {
    font-size: 24px;
    text-decoration: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.export-btn:hover {
    background: rgba(0, 122, 255, 0.1);
}

.export-btn:active {
    transform: scale(0.9);
}

/* Action buttons for mobile */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 16px 0;
}

.action-btn {
    background: var(--card-background);
    border: none;
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
}

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

.action-btn-icon {
    font-size: 32px;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.action-btn-label {
    font-size: 14px;
    font-weight: 500;
}

/* Pull to refresh indicator (visual only) */
.ptr-indicator {
    text-align: center;
    padding: 12px;
    color: var(--text-tertiary);
    font-size: 14px;
}

/* Swipe gestures support */
.swipeable {
    touch-action: pan-y;
}

/* Bottom sheet for confirmations */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-background);
    border-radius: 20px 20px 0 0;
    padding: 24px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1001;
}

.bottom-sheet.active {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin: 0 auto 16px;
}

/* Overlay for modals */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Safe area padding for notched devices */
@supports (padding: env(safe-area-inset-top)) {
    body.has-tab-bar {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }

    .tab-bar {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(60px + env(safe-area-inset-bottom));
    }
}

/* Hide tab bar on larger screens */
@media (min-width: 768px) {
    .tab-bar {
        display: none;
    }

    body.has-tab-bar {
        padding-bottom: 0;
    }

    .page-wrapper {
        min-height: 100vh;
    }
}

/* Prevent double-tap zoom (but allow pinch zoom) */
* {
    touch-action: manipulation;
}

/* Improve tap highlight */
a,
button,
.btn,
.card {
    -webkit-tap-highlight-color: rgba(0, 122, 255, 0.1);
}

/* Large touch targets for interactive elements */
.touch-target {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}