/* Mobile First CSS - Ocleiria */

/* Base mobile styles */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

/* Smooth scrolling with momentum */
html {
    /* scroll-behavior: smooth; Removed to prevent scroll issues */
    -webkit-overflow-scrolling: touch;
}

body {
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
}

/* Prevent bounce effect on iOS */
html,
body {
    position: relative;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Mobile Navigation Bar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(5, 5, 16, 0.95);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 2px solid var(--accent-violet);
    z-index: 1000;
}

/* Main content spacing on mobile */
@media (max-width: 768px) {
    main {
        padding-top: 60px;
        padding-bottom: 100px;
        /* Pour la bottom nav */
        min-height: 100vh;
    }

    .page-header {
        padding-top: 40px !important;
    }
}

.navbar .container {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

/* Logo mobile optimized */
.logo {
    font-size: 1.5rem;
    font-weight: 700;
    z-index: 1001;
}

/* Bottom Navigation (Mobile Only) */
.bottom-nav {
    position: fixed !important;
    bottom: 25px !important;
    left: 10px !important;
    right: 10px !important;
    width: calc(100% - 20px) !important;
    height: 55px;
    background: var(--card-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 27.5px;
    display: none;
    justify-content: space-around;
    align-items: center;
    padding: 0;
    margin-bottom: 10px;
    z-index: 99999 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 45px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
    position: relative;
    padding: 0.25rem 0;
}

.bottom-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.1rem;
}

.bottom-nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
}

.bottom-nav-item.active {
    color: var(--accent-violet);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: var(--accent-violet);
    border-radius: 0 0 3px 3px;
}

/* Content spacing for fixed navs */
main {
    padding-top: calc(60px + env(safe-area-inset-top));
    padding-bottom: 90px;
    min-height: 100vh;
}

/* Ensure sections have proper spacing */
section:last-child {
    padding-bottom: 2rem;
}

/* Mobile Cards */
.mobile-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
    transition: all 0.3s ease;
}

.mobile-card:active {
    transform: scale(0.98);
}

/* Pull to refresh indicator */
.pull-to-refresh {
    position: fixed;
    top: calc(60px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    width: 40px;
    height: 40px;
    background: var(--accent-violet);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    z-index: 900;
}

.pull-to-refresh.visible {
    transform: translateX(-50%) translateY(20px);
}

.pull-to-refresh i {
    color: white;
    font-size: 1.25rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Swipeable cards */
.swipe-card {
    position: relative;
    overflow: hidden;
}

.swipe-actions {
    position: absolute;
    top: 0;
    right: -100px;
    bottom: 0;
    width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-violet);
    transition: right 0.3s ease;
}

.swipe-card.swiped .swipe-actions {
    right: 0;
}

/* Mobile buttons */
.btn-mobile {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn-mobile::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn-mobile:active::after {
    width: 300px;
    height: 300px;
}

/* Floating Action Button */
.fab {
    display: none !important;
}

/* Bottom Menu Overlay */
.bottom-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100000;
}

.bottom-menu-overlay.show {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.bottom-menu-content {
    background: var(--card-bg);
    width: 100%;
    max-height: 80vh;
    border-radius: 20px 20px 0 0;
    padding: 2rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    animation: slideUp 0.3s ease;
    overflow-y: auto;
    position: relative;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.bottom-menu-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.bottom-menu-close:hover {
    background: var(--accent-violet);
    color: white;
}

.bottom-menu-links {
    margin-top: 2rem;
}

.bottom-menu-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--secondary-bg);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.bottom-menu-link:hover {
    background: var(--accent-violet);
    color: white;
    transform: translateX(5px);
}

.bottom-menu-link i {
    font-size: 1.25rem;
    color: var(--accent-violet);
}

.bottom-menu-link:hover i {
    color: white;
}

.bottom-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1.5rem 0;
}

.bottom-menu-section {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    padding-left: 1rem;
}

/* Theme toggle item */
.theme-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: default;
}

.theme-toggle-item:hover {
    background: var(--secondary-bg);
    color: var(--text-primary);
    transform: none;
}

/* iOS style toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5e5e7;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 31px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 27px;
    width: 27px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
    background-color: #32d74b;
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

/* Dark mode adjustments */
[data-theme="dark"] .toggle-slider {
    background-color: #39393d;
}

[data-theme="dark"] .toggle-switch input:checked+.toggle-slider {
    background-color: #32d74b;
}


/* Hide top navbar on mobile */
@media (max-width: 768px) {
    .navbar {
        display: none !important;
    }

    main {
        padding-top: 1rem;
    }
}

/* Mobile menu fullscreen */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-bg);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1002;
    display: flex;
    flex-direction: column;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.mobile-menu.active {
    transform: translateY(0);
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.mobile-menu-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 1.5rem;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 15px;
    background: var(--card-bg);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.mobile-menu-item:active {
    background: var(--accent-violet);
    color: white;
}

.mobile-menu-item i {
    font-size: 1.5rem;
    margin-right: 1rem;
    width: 30px;
}

/* Touch-friendly form elements */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 1rem;
    font-size: 16px;
    /* Prevents zoom on iOS */
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--secondary-bg);
    transition: all 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-violet);
    transform: scale(1.02);
}

/* Mobile-optimized sections */
.hero-mobile {
    padding: 7rem 1rem 3rem;
    text-align: center;
}

/* Mobile-optimized form inputs */
@media (max-width: 768px) {

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important;
        /* Prevent zoom on iOS */
        padding: 1rem !important;
        height: auto !important;
        min-height: 50px;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }

    .form-group label {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    button[type="submit"],
    .btn {
        min-height: 50px;
        font-size: 1.1rem;
        padding: 1rem 2rem;
    }
}

.hero-mobile h1 {
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.hero-mobile p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Skeleton loading for mobile */
.skeleton {
    background: linear-gradient(90deg, var(--card-bg) 25%, var(--secondary-bg) 50%, var(--card-bg) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Haptic feedback simulation */
.haptic {
    transition: all 0.1s ease;
}

.haptic:active {
    transform: scale(0.95);
}

/* But not for bottom nav */
.bottom-nav-item.haptic:active {
    transform: none !important;
}

/* iOS-style toggle */
.toggle-ios {
    width: 51px;
    height: 31px;
    background: var(--border-color);
    border-radius: 31px;
    position: relative;
    transition: all 0.3s ease;
}

.toggle-ios.active {
    background: var(--accent-violet);
}

.toggle-ios::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-ios.active::after {
    transform: translateX(20px);
}

/* Profile page mobile optimization */
.profile-mobile {
    padding: 1rem;
}

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

.profile-avatar-mobile {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    position: relative;
    overflow: hidden;
}

.profile-avatar-mobile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-mobile .edit-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.profile-section-mobile {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.profile-section-mobile h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-section-mobile h3 i {
    color: var(--accent-violet);
}

/* Show bottom nav only on mobile */
@media (max-width: 768px) {
    .bottom-nav {
        display: flex !important;
        bottom: 0 !important;
        position: fixed !important;
    }

    /* Move user menu to the right on mobile */
    .nav-actions {
        margin-left: auto;
        padding-right: 0;
        margin-right: -0.5rem;
    }

    .user-menu {
        margin-left: auto;
        margin-right: 0;
    }

    /* Hide desktop user menu button text on mobile */
    .user-menu-toggle .username,
    .user-menu-toggle .bi-chevron-down {
        display: none;
    }

    /* Make avatar bigger and more to the right */
    .user-menu-toggle {
        padding: 0.25rem;
    }

    .user-avatar {
        width: 35px;
        height: 35px;
    }

    /* Fix huge checkbox on mobile */
    .form-checkbox label {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.9rem;
    }

    .form-checkbox input[type="checkbox"] {
        width: 18px !important;
        height: 18px !important;
        min-width: 18px !important;
        min-height: 18px !important;
        margin: 0;
        flex-shrink: 0;
    }
}

/* Desktop styles (min-width: 769px) */
@media (min-width: 769px) {
    .bottom-nav {
        display: none !important;
    }

    .mobile-menu {
        display: none !important;
    }

    .fab {
        display: none !important;
    }

    main {
        padding-bottom: 5rem;
    }

    .pull-to-refresh {
        display: none !important;
    }

    .hero-mobile br {
        display: none;
    }

    .mobile-only {
        display: none !important;
    }

    /* Forcer l'affichage du navbar sur desktop */
    .navbar {
        display: block !important;
    }

    .navbar .container {
        justify-content: center !important;
        gap: 3rem;
    }

    /* Forcer l'affichage du menu desktop */
    .nav-menu {
        visibility: visible !important;
        opacity: 1 !important;
        transform: none !important;
        pointer-events: auto !important;
    }

    /* Réinitialiser les styles mobile du header */
    .navbar .container {
        padding: 1.2rem 20px !important;
    }

    .nav-actions {
        display: flex !important;
        margin-left: 2rem !important;
        margin-right: 0 !important;
        padding-right: 0 !important;
    }
}

/* Mobile only styles */
@media (max-width: 768px) {
    .desktop-only {
        display: none;
    }

    /* Adjust footer on mobile to not overlap bottom nav */
    .footer {
        margin-bottom: 90px;
        padding-bottom: 2rem;
    }

    /* Force bottom nav to always be visible */
    body {
        padding-bottom: 0 !important;
    }
}

/* Mobile Enhancements - Additional styles for native experience */

/* App container wrapper - only on mobile */
@media (max-width: 768px) {
    body.mobile-view {
        position: relative;
        width: 100%;
        min-height: 100vh;
    }

    .app-wrapper {
        position: relative;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
}

/* Pull to refresh indicator */
.pull-indicator {
    position: fixed;
    top: calc(60px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%) translateY(0);
    width: 40px;
    height: 40px;
    background: var(--accent-violet);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 999;
    pointer-events: none;
}

.pull-indicator.refreshing i {
    animation: spin 1s linear infinite;
}

/* Action sheet backdrop */
.action-sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Ripple effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Page transitions */
body.page-transition {
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
}

/* Orientation change animation */
body.orientation-change * {
    transition: none !important;
}

/* Touch states */
[data-touch="true"] {
    opacity: 0.8;
    transform: scale(0.98);
}

/* Swipe card actions */
.swipe-card {
    position: relative;
    transition: transform 0.3s ease;
}

.swipe-card-actions {
    position: absolute;
    top: 0;
    right: -100px;
    bottom: 0;
    width: 100px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
}

.swipe-card.show-actions .swipe-card-actions {
    right: 10px;
}

.swipe-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.swipe-action-btn.delete {
    background: #ff3b30;
}

.swipe-action-btn.edit {
    background: var(--accent-violet);
}

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

/* Native-style alerts */
.native-alert {
    position: fixed;
    top: calc(70px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--card-bg);
    border-radius: 15px;
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: calc(100% - 2rem);
    z-index: 10001;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.native-alert.show {
    transform: translateX(-50%) translateY(0);
}

.native-alert i {
    font-size: 1.5rem;
}

.native-alert.success i {
    color: #34c759;
}

.native-alert.error i {
    color: #ff3b30;
}

.native-alert.warning i {
    color: #ff9500;
}

.native-alert.info i {
    color: var(--accent-blue);
}

/* Bottom sheet variant */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.bottom-sheet-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bottom-sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    -webkit-overflow-scrolling: touch;
}

/* Floating elements shadow on scroll */
.float-on-scroll {
    transition: box-shadow 0.3s ease;
}

.scrolled .float-on-scroll {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Loading states */
.loading-dots {
    display: inline-flex;
    gap: 0.25rem;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--accent-violet);
    border-radius: 50%;
    animation: pulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {

    0%,
    60%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    30% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

/* iOS-style navigation bar blur on mobile */
@supports (backdrop-filter: blur(20px)) or (-webkit-backdrop-filter: blur(20px)) {
    .navbar {
        background: rgba(var(--card-bg-rgb), 0.8) !important;
        backdrop-filter: blur(20px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    }

    .bottom-nav {
        background: rgba(var(--card-bg-rgb), 0.95) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
    }
}

/* CSS variables for dynamic values */
:root {
    --card-bg-rgb: 26, 26, 26;
}

[data-theme="light"] {
    --card-bg-rgb: 255, 255, 255;
}

/* Stories update indicator */
.story-avatar.has-update {
    animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7);
    }

    50% {
        box-shadow: 0 0 0 4px rgba(139, 92, 246, 0);
    }
}

/* Mobile-optimized scrollbar */
@media (max-width: 768px) {

    /* Custom scrollbar for webkit browsers */
    ::-webkit-scrollbar {
        width: 4px;
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 2px;
    }

    /* Hide scrollbar for Firefox */
    * {
        scrollbar-width: none;
    }
}

/* Safe area adjustments for modern devices */
.safe-area-top {
    padding-top: env(safe-area-inset-top);
}

.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
}

.safe-area-left {
    padding-left: env(safe-area-inset-left);
}

.safe-area-right {
    padding-right: env(safe-area-inset-right);
}

/* Fixes pour les problèmes de scroll et compatibilité PC/Mobile */

/* Hide FAB on mobile devices */
@media (max-width: 768px) {
    .fab {
        display: none !important;
    }
}

/* Reset complet pour un scroll normal */
* {
    /* Désactiver toutes les animations de scroll */
    scroll-behavior: auto !important;
}

/* Assurer que le scroll fonctionne partout */
html {
    overflow-x: hidden;
    overflow-y: visible !important;
    position: static !important;
    height: auto !important;
}

body {
    overflow-x: hidden;
    overflow-y: visible !important;
    position: static !important;
    min-height: 100vh;
    height: auto !important;
    /* Scroll natif sans effets */
    -webkit-overflow-scrolling: auto !important;
    overscroll-behavior: auto !important;
    /* Désactiver les transformations qui peuvent affecter le scroll */
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
}

/* Fix pour le main content */
main {
    position: relative;
    z-index: 1;
}

/* S'assurer que les sections sont visibles */
section {
    position: relative;
    z-index: 1;
}

/* Fix pour les éléments mobile sur desktop */
@media (min-width: 769px) {

    /* Cacher les éléments purement mobile sur desktop */
    .pull-to-refresh,
    .fab,
    .swipe-actions {
        display: none !important;
    }

    /* Rendre les cards normales sur desktop */
    .mobile-card {
        transform: none !important;
    }

    /* Désactiver les classes mobile sur desktop */
    .haptic,
    .swipe-card {
        pointer-events: auto !important;
        user-select: auto !important;
    }
}

/* Fix pour mobile */
@media (max-width: 768px) {

    /* S'assurer que le contenu reste accessible */
    .container {
        position: relative;
        z-index: 1;
    }

    /* Ajouter plus d'espace en bas pour éviter que le contenu soit coupé */
    main {
        padding-bottom: calc(120px + env(safe-area-inset-bottom)) !important;
    }

    section:last-child {
        margin-bottom: 3rem;
    }

    /* Disable transform effects on bottom nav to prevent bounce */
    .bottom-nav-item {
        transform: none !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    .bottom-nav-item:active,
    .bottom-nav-item:focus,
    .bottom-nav-item.haptic {
        transform: none !important;
    }

    /* Disable any animation on bottom nav icons */
    .bottom-nav-item i {
        transform: none !important;
        transition: none !important;
    }

    .bottom-nav-item.active i {
        transform: none !important;
    }
}

/* Mobile Native Experience - Ocleiria */
/* Designed for 90% mobile users */

:root {
    /* Mobile-optimized spacing */
    --mobile-padding: 1rem;
    --mobile-radius: 20px;
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
    --safe-left: env(safe-area-inset-left);
    --safe-right: env(safe-area-inset-right);
}

/* Prevent overscroll bounce on iOS - mais permettre le scroll */
html {
    overscroll-behavior: contain;
}

body {
    overscroll-behavior: contain;
    min-height: 100vh;
}

/* Main scrollable container */
.app-container {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: y proximity;
}

/* Mobile-first typography */
body {
    font-size: 16px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

/* Touch-optimized tap targets (min 44px) */
a,
button,
input,
select,
textarea {
    min-height: 44px;
    min-width: 44px;
}

/* Native app header */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(56px + var(--safe-top));
    background: rgba(var(--card-bg-rgb), 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    z-index: 1000;
    padding-top: var(--safe-top);
    transition: transform 0.3s ease;
}

.mobile-header.hidden {
    transform: translateY(-100%);
}

.mobile-header-content {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--mobile-padding);
}

/* Smooth page transitions */
.page-container {
    min-height: 100vh;
    padding-top: calc(56px + var(--safe-top));
    padding-bottom: calc(80px + var(--safe-bottom));
    /* Suppression de l'animation qui peut causer des problèmes de scroll */
    opacity: 1;
}

/* Native-style cards */
.native-card {
    background: var(--card-bg);
    border-radius: var(--mobile-radius);
    margin: 0 var(--mobile-padding) 1rem;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transform: scale(1);
    transition: all 0.2s ease;
}

.native-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.native-card:active {
    transform: scale(0.98);
}

.native-card:active::before {
    opacity: 1;
}

/* Swipeable cards container */
.swipe-container {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    display: flex;
    gap: 1rem;
    padding: 0 var(--mobile-padding);
    margin: 0 calc(var(--mobile-padding) * -1);
    scrollbar-width: none;
}

.swipe-container::-webkit-scrollbar {
    display: none;
}

.swipe-card {
    flex: 0 0 280px;
    scroll-snap-align: start;
    background: var(--card-bg);
    border-radius: var(--mobile-radius);
    padding: 1.5rem;
}

/* iOS-style segmented control */
.segment-control {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 4px;
    margin: 1rem var(--mobile-padding);
}

.segment-item {
    flex: 1;
    padding: 0.75rem;
    text-align: center;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    color: var(--text-secondary);
}

.segment-item.active {
    background: var(--accent-violet);
    color: white;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

/* Native action sheet */
.action-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-radius: var(--mobile-radius) var(--mobile-radius) 0 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    padding-bottom: var(--safe-bottom);
}

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

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

.action-sheet-content {
    padding: 0 var(--mobile-padding) 2rem;
}

/* Pull down to close */
.pull-to-close {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: var(--accent-violet);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
}

.pull-to-close.visible {
    opacity: 1;
    top: -80px;
}

/* Floating labels for inputs */
.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group input {
    width: 100%;
    padding: 1.25rem 1rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.2s ease;
}

.input-group label {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    transition: all 0.2s ease;
    color: var(--text-secondary);
    pointer-events: none;
}

.input-group input:focus,
.input-group input:not(:placeholder-shown) {
    border-color: var(--accent-violet);
}

.input-group input:focus+label,
.input-group input:not(:placeholder-shown)+label {
    top: 0.75rem;
    font-size: 0.75rem;
    color: var(--accent-violet);
    transform: translateY(0);
}

/* Native loading states */
.skeleton-loader {
    position: relative;
    overflow: hidden;
    background: var(--card-bg);
}

.skeleton-loader::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.05),
            transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}

/* Haptic button */
.haptic-button {
    position: relative;
    overflow: hidden;
    background: var(--accent-violet);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    transition: all 0.2s ease;
}

.haptic-button:active {
    transform: scale(0.95);
}

.haptic-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.haptic-button:active::after {
    width: 300px;
    height: 300px;
}

/* Tab bar with notification badge */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(65px + var(--safe-bottom));
    background: rgba(var(--card-bg-rgb), 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    padding-bottom: var(--safe-bottom);
    z-index: 1000;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

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

.tab-item i {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    transition: transform 0.2s ease;
}

.tab-item.active i {
    transform: scale(1.1);
}

.tab-item span {
    font-size: 0.75rem;
    font-weight: 500;
}

.tab-badge {
    position: absolute;
    top: 8px;
    right: calc(50% - 20px);
    background: #ff3b30;
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Gesture hints */
.gesture-hint {
    position: fixed;
    bottom: calc(80px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gesture-hint.show {
    opacity: 1;
}

/* Stories-style avatar list */
.stories-container {
    display: flex;
    gap: 1rem;
    padding: 1rem var(--mobile-padding);
    overflow-x: auto;
    scrollbar-width: none;
}

.stories-container::-webkit-scrollbar {
    display: none;
}

.story-item {
    flex: 0 0 auto;
    text-align: center;
}

.story-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--accent-violet), var(--accent-blue));
    padding: 3px;
    margin-bottom: 0.5rem;
    position: relative;
}

.story-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--card-bg);
}

.story-avatar.has-story::after {
    content: '+';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 24px;
    height: 24px;
    background: var(--accent-violet);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 3px solid var(--card-bg);
}

.story-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Mobile-only utilities */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    /* Hide scrollbars but keep functionality */
    * {
        scrollbar-width: none;
    }

    *::-webkit-scrollbar {
        display: none;
    }
}

/* Desktop message for mobile-first design */
@media (min-width: 769px) {

    /* Les éléments mobile-native sont optionnels sur desktop */
    .mobile-only {
        display: none;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}