/**
 * PWA Interface - Styles pour Progressive Web App
 * Interface non-zoomable, native-like experience
 */

/* === DÉSACTIVER ZOOM POUR PWA === */
/* Prevent zoom on PWA */
html, body {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    /* Prevent zoom */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    
    /* Prevent pinch zoom */
    touch-action: pan-x pan-y;
    overscroll-behavior: none;
    overscroll-behavior-x: none;
    overscroll-behavior-y: none;
    
    /* Prevent double-tap zoom */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Allow text selection for inputs and content areas */
input, textarea, [contenteditable="true"] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* === INTERFACE PWA NATIVE === */
/* Viewport settings for PWA */
@viewport {
    width: device-width;
    initial-scale: 1.0;
    maximum-scale: 1.0;
    user-scalable: no;
}

/* === STATUS BAR ADAPTATION === */
/* Safe area for notched phones */
.pwa-safe-area {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* === PWA NAVIGATION === */
.pwa-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pwa-header h1 {
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.pwa-menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.pwa-menu-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* === PWA CONTENT AREA === */
.pwa-content {
    margin-top: 60px;
    margin-bottom: 70px; /* Space for bottom navigation */
    padding: 1rem;
    min-height: calc(100vh - 130px);
}

/* === PWA CARDS === */
.pwa-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    margin-bottom: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pwa-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

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

.pwa-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.pwa-card-subtitle {
    font-size: 0.875rem;
    color: #666;
    margin: 0.25rem 0 0 0;
}

/* === PWA BUTTONS === */
.pwa-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.pwa-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.pwa-btn:active {
    transform: translateY(0);
}

.pwa-btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #e9ecef;
}

.pwa-btn-secondary:hover {
    background: #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* === PWA FORMS === */
.pwa-form-group {
    margin-bottom: 1.5rem;
}

.pwa-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 0.5rem;
}

.pwa-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.pwa-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.pwa-input::placeholder {
    color: #999;
}

/* === PWA LISTS === */
.pwa-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pwa-list-item {
    background: white;
    border-bottom: 1px solid #f0f0f0;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background-color 0.2s ease;
}

.pwa-list-item:hover {
    background-color: #f8f9fa;
}

.pwa-list-item:last-child {
    border-bottom: none;
}

.pwa-list-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.pwa-list-item-content {
    flex: 1;
}

.pwa-list-item-title {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    margin: 0 0 0.25rem 0;
}

.pwa-list-item-subtitle {
    font-size: 0.875rem;
    color: #666;
    margin: 0;
}

.pwa-list-item-action {
    flex-shrink: 0;
}

/* === PWA BADGES === */
.pwa-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
}

.pwa-badge-primary {
    background: #667eea;
    color: white;
}

.pwa-badge-success {
    background: #28a745;
    color: white;
}

.pwa-badge-warning {
    background: #ffc107;
    color: #333;
}

.pwa-badge-danger {
    background: #dc3545;
    color: white;
}

/* === PWA MODALS === */
.pwa-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.pwa-modal {
    background: white;
    border-radius: 12px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.pwa-modal-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.pwa-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.pwa-modal-body {
    padding: 1.5rem;
}

.pwa-modal-footer {
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* === PWA LOADING === */
.pwa-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.pwa-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: pwa-spin 1s linear infinite;
}

@keyframes pwa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === PWA EMPTY STATES === */
.pwa-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.pwa-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.pwa-empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 0.5rem 0;
}

.pwa-empty-text {
    font-size: 1rem;
    color: #666;
    margin: 0 0 1.5rem 0;
}

/* === PWA RESPONSIVE === */
@media (max-width: 480px) {
    .pwa-header {
        height: 56px;
    }
    
    .pwa-header h1 {
        font-size: 1.125rem;
    }
    
    .pwa-content {
        margin-top: 56px;
        padding: 0.75rem;
    }
    
    .pwa-card {
        padding: 0.75rem;
    }
    
    .pwa-btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .pwa-modal {
        margin: 1rem;
    }
}

/* === PWA LANDSCAPE === */
@media (max-height: 500px) and (orientation: landscape) {
    .pwa-header {
        height: 50px;
    }
    
    .pwa-content {
        margin-top: 50px;
        margin-bottom: 60px;
    }
    
    .pwa-card {
        padding: 0.5rem;
    }
}

/* === PWA DARK MODE === */
@media (prefers-color-scheme: dark) {
    .pwa-card {
        background: #2d3748;
        color: white;
    }
    
    .pwa-card-title {
        color: white;
    }
    
    .pwa-card-subtitle {
        color: #a0aec0;
    }
    
    .pwa-input {
        background: #2d3748;
        border-color: #4a5568;
        color: white;
    }
    
    .pwa-list-item {
        background: #2d3748;
        border-bottom-color: #4a5568;
    }
    
    .pwa-list-item:hover {
        background: #4a5568;
    }
    
    .pwa-modal {
        background: #2d3748;
        color: white;
    }
    
    .pwa-empty-title {
        color: white;
    }
    
    .pwa-empty-text {
        color: #a0aec0;
    }
}

/* === PWA ANIMATIONS === */
.pwa-fade-in {
    animation: pwa-fadeIn 0.3s ease;
}

@keyframes pwa-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.pwa-slide-up {
    animation: pwa-slideUp 0.3s ease;
}

@keyframes pwa-slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* === PWA ACCESSIBILITY === */
.pwa-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for accessibility */
.pwa-btn:focus,
.pwa-input:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* === PWA SPECIFIC OVERRIDES === */
/* Override default zoom behaviors */
.pwa-container {
    width: 100vw;
    height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Prevent horizontal scroll */
.pwa-scroll-container {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Fix iOS viewport issues */
@supports (-webkit-touch-callout: none) {
    .pwa-container {
        height: -webkit-fill-available;
    }
}

/* Android PWA fixes */
@media (display-mode: standalone) {
    .pwa-header {
        padding-top: env(safe-area-inset-top);
    }
    
    .pwa-content {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
