/**
 * DiamondTire - Responsive Stylesheet (Mobile-First)
 * Diamond Tire - استایل‌های ریسپانسیو (موبایل اول)
 *
 * Breakpoints:
 *   Base  = 0px+      (small phones, default/mobile)
 *   sm    = 480px+     (standard phones)
 *   md    = 640px+     (large phones)
 *   lg    = 768px+     (small tablets)
 *   xl    = 1024px+    (large tablets)
 *   2xl   = 1280px+    (desktop)
 *   3xl   = 1440px+    (large desktop)
 */

/* ============================================
   Base / Mobile (0px – 479px)
   ============================================ */

html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* Container - mobile: small padding */
.container {
    padding-left: 12px;
    padding-right: 12px;
}

/* Typography - fluid clamp for headings */
h1 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
h2 { font-size: clamp(1.25rem, 3.5vw, 1.875rem); }
h3 { font-size: clamp(1.1rem, 3vw, 1.5rem); }
h4 { font-size: clamp(1rem, 2.5vw, 1.25rem); }

/* Buttons - touch-friendly minimum 44px */
.btn {
    min-height: 44px;
    padding: 10px 20px;
    font-size: 14px;
}

.btn-lg {
    min-height: 48px;
    padding: 12px 24px;
    font-size: 15px;
    width: 100%;
}

.btn-sm {
    min-height: 36px;
    padding: 8px 14px;
    font-size: 12px;
}

.btn-icon {
    width: 44px;
    height: 44px;
}

/* Forms - touch-friendly */
.form-input,
.form-select {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    min-height: 48px;
    border-radius: var(--radius);
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    font-size: 13px;
    margin-bottom: 6px;
}

.form-row {
    grid-template-columns: 1fr !important;
}

.form-row-3 {
    grid-template-columns: 1fr !important;
}

/* ============================================
   Header - Mobile
   ============================================ */

.header {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-main {
    padding: 8px 0;
}

.header-main .container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.logo {
    flex-shrink: 0;
}

.logo img {
    height: 36px;
    width: auto;
}

.logo-text {
    display: none;
}

/* Search bar - mobile: expandable */
.search-bar {
    flex: 1;
    min-width: 0;
    max-width: none;
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.search-bar input {
    width: 100%;
    padding: 8px 40px 8px 14px;
    font-size: 13px;
}

.search-bar .search-filter-btn {
    display: none;
}

.search-bar .search-submit-btn {
    width: 34px;
    height: 34px;
    margin: 2px;
}

/* Header actions */
.header-actions {
    gap: 4px;
    flex-shrink: 0;
}

.header-btn {
    padding: 8px;
    gap: 0;
}

.header-btn span,
.header-btn-text {
    display: none;
}

.header-btn i {
    font-size: 1.1rem;
}

/* Navigation - hidden on mobile, use mobile nav */
.nav {
    display: none;
}

/* Mobile menu button - visible on mobile */
.mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

/* Cart count */
.cart-count {
    min-width: 16px;
    height: 16px;
    font-size: 10px;
    top: -2px;
    right: -2px;
}

/* ============================================
   Banner Slider - Mobile
   ============================================ */

.banner-slider {
    margin: 12px 0;
    border-radius: var(--radius);
}

.banner-slide {
    height: 180px;
}

.banner-slide img {
    height: 180px;
}

.banner-content {
    padding: 12px;
}

.banner-title {
    font-size: 1.1rem;
}

.banner-subtitle,
.banner-content p {
    display: none;
}

@media (min-width: 768px) {
    .banner-subtitle,
    .banner-content p {
        display: block;
    }
}

.banner-arrows {
    display: none;
}

.banner-controls {
    bottom: 8px;
}

.banner-dot {
    width: 8px;
    height: 8px;
}

.banner-dot.active {
    width: 20px;
}

/* ============================================
   Products - Mobile
   ============================================ */

.products-slider {
    margin: 0 -12px;
    padding: 0 12px;
}

.products-track {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    overflow-x: visible !important;
    padding: 4px 0;
}

.products-track .product-card {
    min-width: unset !important;
}

.product-card {
    border-radius: var(--radius);
}

.product-card:hover {
    transform: none;
}

.product-image {
    height: 130px;
}

.product-brand-logo-badge {
    width: 80px;
    height: 55px;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
}

.product-info {
    padding: 10px;
}

.product-name {
    font-size: 12px;
    -webkit-line-clamp: 2;
}

.product-tags {
    display: none;
}

.product-brand {
    display: none;
}

.product-rating-inline {
    display: none;
}

.price-current {
    font-size: 13px;
}

.price-old {
    font-size: 11px;
}

.add-to-cart-btn {
    padding: 6px 10px;
    font-size: 11px;
}

.add-to-cart-btn i {
    display: none;
}

.product-footer {
    margin-top: 6px;
    padding-top: 6px;
}

.product-actions {
    opacity: 1;
    transform: none;
}

.stock-badge {
    opacity: 1;
    transform: none;
    font-size: 10px;
    padding: 2px 6px;
}

/* ============================================
   Sections - Mobile
   ============================================ */

.section {
    padding: 20px 0;
}

.section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
}

.section-title {
    font-size: 1.1rem;
    padding-right: 12px;
}

.section-title::before {
    width: 3px;
}

.section-link {
    font-size: 13px;
}

/* ============================================
   Article Grid - Mobile
   ============================================ */

.article-grid {
    grid-template-columns: 1fr !important;
}

.article-card {
    border-radius: var(--radius);
}

.article-image {
    height: 160px;
}

.article-content {
    padding: 12px;
}

.article-title {
    font-size: 14px;
}

.article-meta {
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
}

/* ============================================
   Footer - Mobile
   ============================================ */

.footer {
    margin-top: 32px;
}

.footer-main {
    padding: 24px 0;
}

.footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
}

.footer-col h4 {
    font-size: 14px;
    margin-bottom: 10px;
}

.footer-col ul li a {
    padding: 5px 0;
    font-size: 13px;
}

.footer-contact p {
    font-size: 13px;
}

.social-links {
    justify-content: flex-start;
}

.footer-bottom {
    text-align: center;
}

.footer-bottom p {
    font-size: 12px;
}

/* ============================================
   Modals - Mobile
   ============================================ */

.modal {
    width: 95% !important;
    margin: 12px;
    max-height: 85vh;
}

.modal-header {
    padding: 12px 16px;
}

.modal-body {
    padding: 16px;
}

.modal-footer {
    padding: 12px 16px;
}

.modal-content {
    width: 95%;
    max-width: none;
}

/* ============================================
   Chatbot - Mobile
   ============================================ */

.chatbot-panel {
    width: auto;
    left: 12px;
    right: 12px;
    bottom: 80px;
    max-height: 65vh;
}

.chatbot-btn,
.chatbot-toggle {
    width: 52px;
    height: 52px;
    bottom: 16px;
    left: 16px;
}

.chatbot-btn i {
    font-size: 1.3rem;
}

/* ============================================
   Floating Buttons - Mobile
   ============================================ */

.floating-buttons {
    left: 12px;
    bottom: 16px;
}

.floating-btn {
    width: 44px;
    height: 44px;
    font-size: 16px;
}

.floating-contact-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

.developer-credit {
    left: 12px;
    bottom: 120px;
}

.dev-credit-btn {
    width: 44px;
    height: 44px;
    font-size: 16px;
}

.dev-credit-popup {
    min-width: 180px;
    padding: 12px 16px;
    font-size: 12px;
}

/* ============================================
   Cart Page - Mobile
   ============================================ */

.cart-layout {
    grid-template-columns: 1fr !important;
}

.cart-item {
    grid-template-columns: 80px 1fr !important;
    gap: 10px !important;
    padding: 12px !important;
}

.cart-item-image {
    width: 80px;
    height: 60px;
}

.cart-summary {
    position: static !important;
    border-top: 2px solid var(--gray-200);
    padding-top: 16px;
}

/* ============================================
   Checkout - Mobile
   ============================================ */

.checkout-layout {
    grid-template-columns: 1fr !important;
}

.checkout-section {
    padding: 16px !important;
}

.order-summary {
    position: static !important;
}

/* ============================================
   Product Detail - Mobile
   ============================================ */

.product-detail-layout {
    grid-template-columns: 1fr !important;
}

.product-gallery-main img {
    height: 250px !important;
}

.product-gallery-thumbs {
    gap: 6px !important;
}

.product-gallery-thumbs img {
    width: 50px !important;
    height: 50px !important;
}

/* ============================================
   Tables - Mobile: horizontal scroll
   ============================================ */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}

.data-table {
    min-width: 500px;
}

/* ============================================
   Toast - Mobile
   ============================================ */

.toast {
    min-width: auto;
}

/* ============================================
   Auth Pages - Mobile
   ============================================ */

.auth-container {
    margin: 12px;
    width: auto;
    max-width: none;
}

.auth-body {
    padding: 20px;
}

.otp-input {
    width: 42px;
    height: 48px;
    font-size: 18px;
}

/* ============================================
   Pagination - Mobile
   ============================================ */

.pagination {
    flex-wrap: wrap;
    gap: 6px;
}

.pagination button {
    min-width: 36px;
    min-height: 36px;
}

/* ============================================
   Search Page - Mobile
   ============================================ */

.search-layout {
    display: flex;
    flex-direction: column;
}

.search-filters {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-primary);
    border-top: 1px solid var(--gray-200);
    padding: 16px;
    transform: translateY(100%);
    transition: transform 0.3s ease, visibility 0.3s ease;
    max-height: 70vh;
    overflow-y: auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    visibility: hidden;
    pointer-events: none;
}

.search-filters.active {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}

.search-results {
    flex: 1;
    width: 100%;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

/* Mobile filter toggle button */
.filter-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
}

.filter-toggle-btn i {
    font-size: 16px;
}

/* ============================================
   Dashboard - Mobile
   ============================================ */

.dashboard {
    padding: 16px;
}

.page-title {
    font-size: 1.3rem;
}

/* ============================================
   Touch Device Optimizations
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    .product-card:hover {
        transform: none;
        box-shadow: var(--shadow);
    }

    .btn-primary:hover,
    .btn-accent:hover {
        transform: none;
    }

    .floating-btn:hover {
        transform: none;
    }

    .card:hover {
        transform: none;
    }

    .article-card:hover {
        transform: none;
    }
}

/* ============================================
   Small Phones (480px+)
   ============================================ */

@media (min-width: 480px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .logo-text {
        display: block;
        font-size: var(--font-size-lg);
    }

    .product-image {
        height: 150px;
    }

    .banner-slide {
        height: 200px;
    }

    .banner-slide img {
        height: 200px;
    }
}

/* ============================================
   Large Phones (640px+)
   ============================================ */

@media (min-width: 640px) {
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }

    .products-track {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .product-image {
        height: 170px;
    }

    .banner-slide {
        height: 240px;
    }

    .banner-slide img {
        height: 240px;
    }

    .banner-content {
        padding: 16px;
    }

    .banner-title {
        font-size: 1.3rem;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .section {
        padding: 28px 0;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ============================================
   Small Tablets (768px+)
   ============================================ */

@media (min-width: 768px) {
    html {
        font-size: 15px;
    }

    .container {
        max-width: 720px;
        padding-left: 24px;
        padding-right: 24px;
    }

    /* Header - show desktop nav, hide mobile menu */
    .nav {
        display: block;
    }

    .mobile-menu-btn {
        display: none;
    }

    .header-main .container {
        flex-wrap: nowrap;
    }

    .search-bar {
        max-width: 400px;
    }

    .search-bar .search-filter-btn {
        display: flex;
    }

    /* Products: 2 columns in grid */
    .products-track {
        display: flex !important;
        gap: 16px;
        overflow-x: auto;
    }

    .products-track .product-card {
        min-width: 260px;
    }

    .product-image {
        height: 190px;
    }

    .product-info {
        padding: var(--space-4);
    }

    .product-name {
        font-size: var(--font-size-sm);
    }

    .product-tags {
        display: flex;
    }

    .product-brand {
        display: flex;
    }

    .product-rating-inline {
        display: inline-flex;
    }

    .price-current {
        font-size: var(--font-size-base);
    }

    .add-to-cart-btn {
        padding: var(--space-2) var(--space-4);
        font-size: var(--font-size-sm);
    }

    .add-to-cart-btn i {
        display: inline;
    }

    /* Banner */
    .banner-slide {
        height: 300px;
    }

    .banner-slide img {
        height: 300px;
    }

    .banner-arrows {
        display: flex;
    }

    /* Sections */
    .section {
        padding: 40px 0;
    }

    .section-header {
        flex-direction: row;
        align-items: center;
    }

    .section-title {
        font-size: 1.5rem;
    }

    /* Articles */
    .article-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Search: sidebar filters */
    .search-layout {
        display: grid;
        grid-template-columns: 260px 1fr;
        gap: 24px;
    }

    .search-filters {
        position: static;
        transform: none;
        max-height: none;
        overflow-y: visible;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--gray-200);
        visibility: visible;
        pointer-events: auto;
    }

    .filter-toggle-btn {
        display: none;
    }

    /* Cart */
    .cart-layout {
        grid-template-columns: 1fr 320px !important;
        gap: 24px;
    }

    .cart-item {
        grid-template-columns: 100px 1fr !important;
    }

    .cart-item-image {
        width: 100px;
        height: 80px;
    }

    .cart-summary {
        position: sticky !important;
        top: 100px;
    }

    /* Checkout */
    .checkout-layout {
        grid-template-columns: 1fr 350px !important;
        gap: 24px;
    }

    .order-summary {
        position: sticky !important;
        top: 100px;
    }

    .form-row {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Product detail */
    .product-detail-layout {
        grid-template-columns: 1fr 1fr !important;
        gap: 32px;
    }

    .product-gallery-main img {
        height: 350px !important;
    }

    /* Chatbot */
    .chatbot-panel {
        width: 380px;
        left: 24px;
        right: auto;
        bottom: 100px;
    }

    /* Footer - handled in components2.css */

    /* Dashboard */
    .dashboard {
        padding: var(--space-6);
    }

    /* Auth */
    .auth-container {
        margin: 24px;
    }

    .auth-body {
        padding: 32px;
    }

    .otp-input {
        width: 48px;
        height: 52px;
        font-size: 20px;
    }
}

/* ============================================
   Large Tablets (1024px+)
   ============================================ */

@media (min-width: 1024px) {
    .container {
        max-width: 960px;
    }

    .search-bar {
        max-width: 500px;
    }

    .header-actions {
        gap: var(--space-3);
    }

    .header-btn {
        padding: var(--space-2) var(--space-4);
        gap: var(--space-2);
    }

    .header-btn span,
    .header-btn-text {
        display: inline;
    }

    .products-track .product-card {
        min-width: 280px;
    }

    .product-image {
        height: 200px;
    }

    .banner-slide {
        height: 340px;
    }

    .banner-slide img {
        height: 340px;
    }

    .footer-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .article-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    /* Admin */
    .admin-main {
        margin-right: 0;
    }
}

/* ============================================
   Desktop (1280px+)
   ============================================ */

@media (min-width: 1280px) {
    html {
        font-size: 16px;
    }

    .container {
        max-width: 1200px;
    }

    .logo img {
        height: 50px;
    }

    .logo-text {
        font-size: var(--font-size-2xl);
    }

    .search-bar {
        max-width: 600px;
    }

    .banner-slide {
        height: 400px;
    }

    .banner-slide img {
        height: 400px;
    }

    .banner-title {
        font-size: var(--font-size-3xl);
    }

    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .article-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .article-image {
        height: 200px;
    }

    /* Admin */
    .admin-main {
        margin-right: var(--sidebar-width);
    }
}

/* ============================================
   Large Desktop (1440px+)
   ============================================ */

@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
        padding-left: 32px;
        padding-right: 32px;
    }

    .banner-slider {
        max-width: 1290px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ============================================
   Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .header,
    .nav,
    .footer,
    .chatbot-btn,
    .chatbot-panel,
    .toast-container,
    .floating-buttons,
    .developer-credit,
    .mobile-menu-btn,
    .mobile-nav,
    .mobile-nav-overlay {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .container {
        max-width: 100%;
    }

    a {
        color: black;
        text-decoration: underline;
    }
}
