/**
 * فایل CSS برای بهینه‌سازی‌های مخصوص موبایل
 * شامل استایل‌های پیشرفته برای بهبود تجربه کاربری در دستگاه‌های موبایل
 */

/* بهبودهای کلی موبایل - فقط برای موبایل */
@media (max-width: 991.98px) {
    /* بهبود touch targets */
    .btn, button, a, .clickable {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* بهبود input fields */
    input, textarea, select {
        font-size: 16px; /* جلوگیری از zoom در iOS */
        padding: 12px 16px;
        border-radius: 8px;
        border: 2px solid #e0e0e0;
        -webkit-appearance: none;
        appearance: none;
        background-color: #fff;
        transition: all 0.3s ease;
    }
    
    input:focus, textarea:focus, select:focus {
        border-color: #007bff;
        outline: none;
        box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
        transform: scale(1.02);
    }
    
    /* بهبود فرم‌ها */
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    .form-group label {
        font-weight: 600;
        margin-bottom: 0.5rem;
        display: block;
        color: #333;
    }
    
    /* بهبود کارت‌ها */
    .card, .glass-box-content, .review-card {
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        margin-bottom: 1rem;
        transition: all 0.3s ease;
    }
    
    .card:hover, .glass-box-content:hover, .review-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    /* بهبود تصاویر */
    img {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
        transition: opacity 0.3s ease;
    }
    
    img.lazy {
        opacity: 0;
    }
    
    img.loaded {
        opacity: 1;
    }
    
    /* بهبود اسلایدرها */
    .glass-slider, .live-slider, .reviews-slider {
        touch-action: pan-x;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
    }
    
    .slide, .live-slide, .review-slide {
        scroll-snap-align: start;
    }
    
    /* بهبود منوها */
    .navbar {
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        background: rgba(255, 255, 255, 0.9);
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .navbar.scrolled {
        background: rgba(0, 0, 0, 0.9);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
    
    .navbar-nav {
        text-align: center;
        padding: 1rem 0;
    }
    
    .navbar-nav .nav-link {
        padding: 12px 20px;
        font-size: 18px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        transition: all 0.3s ease;
    }
    
    .navbar-nav .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: 8px;
    }
    
    /* طراحی جدید و بهبود یافته دکمه همبرگری */
    .navbar-toggler {
        padding: 8px;
        border: 2px solid rgba(102, 126, 234, 0.3);
        background: rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        overflow: hidden;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .navbar-toggler:hover {
        background: rgba(102, 126, 234, 0.2);
        border-color: rgba(102, 126, 234, 0.5);
        transform: scale(1.05);
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    }
    
    .navbar-toggler:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
        border-color: rgba(102, 126, 234, 0.6);
    }
    
    .navbar-toggler:active {
        transform: scale(0.95);
    }
    
    /* طراحی آیکون همبرگری سفارشی */
    .navbar-toggler-icon {
        background-image: none;
        width: 24px;
        height: 18px;
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        transition: all 0.3s ease;
    }
    
    .navbar-toggler-icon::before,
    .navbar-toggler-icon::after {
        content: '';
        display: block;
        height: 3px;
        background: linear-gradient(135deg, #667eea, #764ba2);
        border-radius: 2px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        transform-origin: center;
    }
    
    .navbar-toggler-icon::before {
        width: 100%;
    }
    
    .navbar-toggler-icon::after {
        width: 80%;
        margin-left: auto;
    }
    
    /* انیمیشن تبدیل به X */
    .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::before {
        transform: rotate(45deg) translate(6px, 6px);
        width: 100%;
    }
    
    .navbar-toggler[aria-expanded="true"] .navbar-toggler-icon::after {
        transform: rotate(-45deg) translate(6px, -6px);
        width: 100%;
    }
    
    /* حالت scrolled */
    .navbar.scrolled .navbar-toggler {
        border-color: rgba(255, 255, 255, 0.3);
        background: rgba(255, 255, 255, 0.1);
    }
    
    .navbar.scrolled .navbar-toggler:hover {
        background: rgba(255, 255, 255, 0.2);
        border-color: rgba(255, 255, 255, 0.5);
    }
    
    .navbar.scrolled .navbar-toggler-icon::before,
    .navbar.scrolled .navbar-toggler-icon::after {
        background: linear-gradient(135deg, #ffffff, #f0f0f0);
    }
    
    /* بهبود نمایش منوی موبایل */
    .navbar-collapse {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-radius: 15px;
        margin-top: 1rem;
        padding: 1rem;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .navbar.scrolled .navbar-collapse {
        background: rgba(0, 0, 0, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    /* بهبود فوتر */
    .footer-content {
        text-align: center;
        padding: 2rem 1rem;
    }
    
    .footer-content .row > div {
        margin-bottom: 2rem;
    }
    
    /* بهبود دکمه‌ها */
    .btn, .glass-box-btn {
        border-radius: 8px;
        font-weight: 600;
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
    }
    
    .btn:active, .glass-box-btn:active {
        transform: scale(0.95);
    }
    
    .btn::before, .glass-box-btn::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        transform: translate(-50%, -50%);
        transition: width 0.3s ease, height 0.3s ease;
    }
    
    .btn:active::before, .glass-box-btn:active::before {
        width: 100px;
        height: 100px;
    }
    
    /* بهبود انیمیشن‌ها */
    .animated {
        will-change: transform;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }
    
    /* بهبود scroll */
    .scroll-container {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* بهبود pull-to-refresh */
    .pull-to-refresh-indicator {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.8);
        color: white;
        text-align: center;
        padding: 10px;
        z-index: 9999;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        font-size: 14px;
    }
    
    /* بهبود error states */
    .error {
        border-color: #dc3545 !important;
        box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
        animation: shake 0.5s ease-in-out;
    }
    
    .success {
        border-color: #28a745 !important;
        box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1) !important;
    }
    
    @keyframes shake {
        0%, 100% { transform: translateX(0); }
        25% { transform: translateX(-5px); }
        75% { transform: translateX(5px); }
    }
    
    /* بهبود loading states */
    .loading {
        opacity: 0.6;
        pointer-events: none;
        position: relative;
    }
    
    .loading::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 20px;
        height: 20px;
        margin: -10px 0 0 -10px;
        border: 2px solid #f3f3f3;
        border-top: 2px solid #007bff;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    
    /* بهبود accessibility */
    .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 states */
    .btn:focus, .glass-box-btn:focus, input:focus, textarea:focus, select:focus {
        outline: 2px solid #007bff;
        outline-offset: 2px;
    }
    
    /* بهبود text selection */
    p, span, div {
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
    }
    
    /* بهبود scroll indicators */
    .scroll-indicator {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        background: rgba(0, 123, 255, 0.8);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 20px;
        cursor: pointer;
        transition: all 0.3s ease;
        z-index: 1000;
    }
    
    .scroll-indicator:hover {
        background: rgba(0, 123, 255, 1);
        transform: scale(1.1);
    }
    
    /* بهبود modal ها */
    .modal {
        padding: 1rem;
    }
    
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .modal-content {
        border-radius: 12px;
        border: none;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }
    
    .modal-header {
        border-bottom: 1px solid #e9ecef;
        padding: 1rem 1.5rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .modal-footer {
        border-top: 1px solid #e9ecef;
        padding: 1rem 1.5rem;
    }
    
    /* بهبود tooltip ها */
    .tooltip {
        font-size: 14px;
    }
    
    .tooltip-inner {
        background-color: rgba(0, 0, 0, 0.9);
        border-radius: 6px;
        padding: 8px 12px;
    }
    
    /* بهبود popover ها */
    .popover {
        border-radius: 8px;
        border: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .popover-header {
        background-color: #f8f9fa;
        border-bottom: 1px solid #e9ecef;
        border-radius: 8px 8px 0 0;
    }
    
    /* بهبود alert ها */
    .alert {
        border-radius: 8px;
        border: none;
        padding: 1rem 1.5rem;
        margin-bottom: 1rem;
    }
    
    .alert-dismissible .btn-close {
        padding: 0.5rem 1rem;
    }
    
    /* بهبود progress bars */
    .progress {
        height: 8px;
        border-radius: 4px;
        background-color: #e9ecef;
    }
    
    .progress-bar {
        border-radius: 4px;
        transition: width 0.3s ease;
    }
    
    /* بهبود badges */
    .badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
        border-radius: 6px;
    }
    
    /* بهبود list groups */
    .list-group-item {
        border-radius: 8px;
        margin-bottom: 0.5rem;
        border: 1px solid #e9ecef;
        transition: all 0.3s ease;
    }
    
    .list-group-item:hover {
        background-color: #f8f9fa;
        transform: translateX(5px);
    }
    
    /* بهبود pagination */
    .pagination {
        justify-content: center;
        margin: 2rem 0;
    }
    
    .page-link {
        border-radius: 6px;
        margin: 0 2px;
        border: 1px solid #dee2e6;
        color: #007bff;
        transition: all 0.3s ease;
    }
    
    .page-link:hover {
        background-color: #e9ecef;
        border-color: #adb5bd;
    }
    
    .page-item.active .page-link {
        background-color: #007bff;
        border-color: #007bff;
    }
}

/* بهبودهای خاص برای iOS */
@supports (-webkit-touch-callout: none) {
    .mobile input, .mobile textarea, .mobile select {
        font-size: 16px;
        -webkit-appearance: none;
        border-radius: 8px;
    }
    
    .mobile .btn, .mobile button {
        -webkit-appearance: none;
        border-radius: 8px;
    }
    
    .mobile .navbar {
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
    }
}

/* بهبودهای خاص برای Android */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .mobile input, .mobile textarea, .mobile select {
        font-size: 16px;
    }
    
    .mobile .btn, .mobile button {
        -webkit-tap-highlight-color: transparent;
    }
}

/* بهبودهای landscape orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .main-header {
        min-height: 100vh;
    }
    
    .glass-slider-container {
        padding: 0.5rem;
    }
    
    .glass-box-content {
        padding: 1rem;
    }
    
    .glass-box-title {
        font-size: 1.5rem;
    }
    
    .glass-box-description {
        font-size: 0.9rem;
    }
    
    .navbar {
        padding: 0.5rem 1rem;
    }
}

/* بهبودهای low power mode */
.low-power * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

.low-power .animated {
    animation: none !important;
}

/* بهبودهای reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animated {
        animation: none !important;
    }
}

/* بهبودهای high contrast */
@media (prefers-contrast: high) {
    .btn, .glass-box-btn {
        border: 2px solid currentColor;
    }
    
    input, textarea, select {
        border: 2px solid currentColor;
    }
    
    .card, .glass-box-content {
        border: 1px solid currentColor;
    }
}

/* بهبودهای dark mode */
@media (prefers-color-scheme: dark) {
    .mobile {
        --text-color: #ffffff;
        --bg-color: #1a1a1a;
        --card-bg: #2d2d2d;
        --border-color: #404040;
    }
    
    .mobile body {
        background-color: var(--bg-color);
        color: var(--text-color);
    }
    
    .mobile .card, .mobile .glass-box-content, .mobile .review-card {
        background-color: var(--card-bg);
        border-color: var(--border-color);
    }
    
    .mobile input, .mobile textarea, .mobile select {
        background-color: var(--card-bg);
        border-color: var(--border-color);
        color: var(--text-color);
    }
    
    .mobile .navbar {
        background: rgba(26, 26, 26, 0.9);
        border-bottom-color: var(--border-color);
    }
    
    .mobile .navbar.scrolled {
        background: rgba(0, 0, 0, 0.9);
    }
}
