/* ========================================
   Responsive CSS for Al Nisf Equipment
   ======================================== */

/* Prevent horizontal scrolling */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

* {
    box-sizing: border-box;
}

/* Base Styles */
:root {
    --primary-color: #ffb12b;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

/* Typography */
html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Header Styles */
.main-header {
    z-index: 1000;
    width: 100%;
    max-width: 100vw;
}

/* Fix top bar layout */
.top-bar {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.top-bar .container {
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
}

.top-bar small {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
}

.top-bar form {
    display: inline-block;
    vertical-align: middle;
}

.top-bar button[type="submit"] {
    white-space: nowrap;
}

/* Navbar styles - DISABLED to use brand-design-system.css styles */
/* .navbar-brand img {
    max-height: 50px;
    width: auto;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
}

.dropdown-menu {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border: none;
    border-radius: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 1.5rem;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
} */

/* Hero Section */
.hero-section {
    min-height: 500px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.hero-overlay {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.4) 100%);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
}

.min-vh-75 {
    min-height: 75vh;
}

/* Product Cards */
.product-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}

.product-image {
    position: relative;
    overflow: hidden;
}

.product-image img {
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.1);
}

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover .product-overlay {
    opacity: 1;
}

.product-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Statistics Section */
.stat-item {
    padding: 1rem;
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
}

/* Newsletter Section */
.newsletter-form .input-group {
    max-width: 500px;
    margin: 0 auto;
}

/* Footer */
footer {
    background: linear-gradient(180deg, #2c3e50 0%, #1a1a1a 100%);
}

.social-links a {
    display: inline-block;
    width: 35px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
}

/* Mobile Menu */
.offcanvas {
    width: 300px !important;
}

/* Utility Classes */
.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-shadow {
    transition: box-shadow 0.3s ease;
}

.hover-shadow:hover {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}

.transition-all {
    transition: all 0.3s ease;
}

.transition-transform {
    transition: transform 0.3s ease;
}

.object-fit-cover {
    object-fit: cover;
}

.btn-white {
    background: white;
    color: var(--dark-color);
}

.btn-white:hover {
    background: var(--light-color);
    color: var(--primary-color);
}

/* Responsive Breakpoints */

/* Container fixes */
.container, .container-fluid {
    padding-left: 15px;
    padding-right: 15px;
    width: 100%;
    max-width: 100%;
}

/* Prevent any element from causing horizontal scroll */
img, iframe, video, embed, object {
    max-width: 100%;
    height: auto;
}

/* Fix for wide tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    max-width: 100%;
}

/* Fix for pre and code blocks */
pre, code {
    max-width: 100%;
    overflow-x: auto;
    word-wrap: break-word;
}

/* Extra Large Devices (≥1200px) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Large Devices (992px - 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    /* Removed conflicting nav-link styles */
    
    .hero-title {
        font-size: 3rem;
    }
}

/* Fix sticky header z-index */
.sticky-top {
    z-index: 1020;
}

/* Navbar fixes for medium screens - DISABLED to use brand-design-system.css */
/* @media (max-width: 1199px) {
    .navbar-brand small {
        font-size: 0.7rem;
    }
}

@media (max-width: 991px) {
    .navbar-collapse {
        background: white;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 1000;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
    
    .navbar-nav {
        padding: 1rem;
    }
    
    .top-bar small {
        font-size: 0.75rem;
    }
} */

/* Medium Devices (768px - 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    .hero-section {
        min-height: 400px;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-description {
        font-size: 1rem !important;
    }
    
    .stat-item h3 {
        font-size: 2rem !important;
    }
    
    .product-card {
        margin-bottom: 1.5rem;
    }
}

/* Small Devices (576px - 767px) */
@media (max-width: 767px) and (min-width: 576px) {
    .hero-section {
        min-height: 350px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
    
    .hero-description {
        font-size: 0.9rem !important;
    }
    
    .section-title {
        font-size: 2rem !important;
    }
    
    .stat-item h3 {
        font-size: 1.5rem !important;
    }
    
    .stat-item p {
        font-size: 0.875rem;
    }
}

/* Small screens - Hide top bar text, show only icons */
@media (max-width: 767px) {
    /* Shopping Cart Icon on tablets */
    .cart-icon-wrapper {
        font-size: 1.1rem;
    }
    
    .cart-count {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.5rem !important;
    }
    
    .top-bar {
        font-size: 0.875rem;
    }
    
    .top-bar .col-md-6:first-child {
        display: none !important;
    }
    
    .top-bar .col-md-6:last-child {
        width: 100%;
        text-align: center !important;
    }
    
    .top-bar form button {
        padding: 0 0.5rem !important;
        font-size: 0.875rem;
    }
}

/* Extra Small Devices (<576px) */
@media (max-width: 575px) {
    /* Typography */
    html {
        font-size: 14px;
    }
    
    /* Header - DISABLED to use brand-design-system.css */
    /* .navbar-brand small {
        display: none !important;
    }
    
    .navbar-brand img {
        max-height: 40px;
    } */
    
    /* Shopping Cart Icon Responsive */
    .cart-icon-wrapper {
        font-size: 1rem;
    }
    
    .cart-count {
        font-size: 0.625rem !important;
        padding: 0.2rem 0.4rem !important;
        min-width: 1.2rem;
        height: 1.2rem;
        line-height: 1;
        text-align: center;
    }
    
    /* Hero Section */
    .hero-section {
        min-height: 300px;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 0.875rem;
    }
    
    .hero-description {
        font-size: 0.875rem !important;
    }
    
    .hero-section .btn-lg {
        padding: 0.5rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Sections */
    .section-title {
        font-size: 1.75rem !important;
    }
    
    .section-subtitle {
        font-size: 0.875rem !important;
    }
    
    /* Statistics */
    .statistics-section .col-6 {
        margin-bottom: 1rem;
    }
    
    .stat-item h3 {
        font-size: 1.25rem !important;
    }
    
    .stat-item p {
        font-size: 0.75rem;
    }
    
    /* Product Cards */
    .product-image img {
        height: 200px !important;
    }
    
    .product-name {
        font-size: 0.9rem;
    }
    
    .product-price .h5 {
        font-size: 1.1rem !important;
    }
    
    /* Browse Section */
    .browse-section .col-md-5 {
        margin-bottom: 1rem;
    }
    
    .or-divider {
        margin: 1rem 0;
    }
    
    /* Categories */
    .category-card .row {
        flex-direction: column;
    }
    
    .category-card .col-4,
    .category-card .col-8 {
        width: 100%;
    }
    
    .category-card img {
        height: 150px !important;
    }
    
    /* News Cards */
    .news-card .row {
        flex-direction: column;
    }
    
    .news-card .col-md-5,
    .news-card .col-md-7 {
        width: 100%;
    }
    
    .news-card img {
        height: 200px !important;
    }
    
    /* Join Team Section */
    .join-team-section .col-lg-8,
    .join-team-section .col-lg-4 {
        text-align: center !important;
    }
    
    .join-team-section h2 {
        font-size: 1.5rem !important;
    }
    
    /* Newsletter */
    .newsletter-section .col-lg-6 {
        margin-bottom: 1rem;
    }
    
    .newsletter-section h4 {
        font-size: 1.25rem;
    }
    
    /* Footer */
    footer .col-lg-4,
    footer .col-lg-2,
    footer .col-md-6 {
        text-align: center;
        margin-bottom: 2rem;
    }
    
    footer h5 {
        font-size: 1.25rem;
    }
    
    footer h6 {
        font-size: 1rem;
    }
    
    footer .text-md-end {
        text-align: center !important;
    }
    
    /* Buttons */
    .btn {
        padding: 0.375rem 1rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1.25rem;
        font-size: 1rem;
    }
    
    /* Back to Top Button */
    #backToTop {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* Landscape Mode for Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: 250px;
    }
    
    .min-vh-75 {
        min-height: 50vh;
    }
}

/* Print Styles */
@media print {
    .top-bar,
    .main-header,
    footer,
    #backToTop,
    .offcanvas,
    .modal {
        display: none !important;
    }
    
    main {
        padding: 0 !important;
    }
    
    .container {
        max-width: 100% !important;
    }
}

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles here if needed */
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    a {
        text-decoration: underline;
    }
}

/* ===========================================
   Navigation Responsive Enhancements
   =========================================== */

/* Dropdown styles - DISABLED to use brand-design-system.css */
/* @media (hover: none) {
    .dropdown:hover .dropdown-menu {
        display: none;
    }
    .dropdown.show .dropdown-menu {
        display: block;
    }
}

@media (max-width: 991px) {
    .dropdown-menu {
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
        border-radius: 0.5rem;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .dropdown-item {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .dropdown-item i {
        width: 1.2rem;
    }
} */

/* RTL Support for new navigation elements */
[dir="rtl"] .cart-icon-wrapper {
    margin-right: 0 !important;
    margin-left: 1rem;
}

[dir="rtl"] .cart-count {
    right: auto !important;
    left: -0.5rem;
}

/* RTL dropdown support - Keep this for RTL functionality */
/* [dir="rtl"] .dropdown-item i {
    margin-right: 0;
    margin-left: 0.5rem;
} */

/* Shopping cart badge improvements */
.cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    border-radius: 50%;
    transition: all 0.2s ease-in-out;
}

.cart-count:empty {
    display: none !important;
}