/* Responsive Design - Mobile Adaptation */

/* Force hide any back-to-top buttons on all devices */
.back-to-top,
.back-to-top-btn,
button[class*="back-to-top"],
button[class*="arrow-up"],
*[class*="back-to-top"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .container {
        max-width: 960px;
        padding: 0 15px;
    }
    
    .hero-title {
        font-size: 2.2rem;
    }
    
    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .container {
        max-width: 720px;
        padding: 0 15px;
    }
    
    body {
        padding-top: 70px; /* Adjust padding for smaller header on mobile */
        overflow-x: hidden; /* Prevent horizontal scroll */
    }
    
    /* Fix any layout issues */
    * {
        box-sizing: border-box;
    }
    
    .container {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Header */
    .header-content {
        flex-wrap: nowrap;
        gap: 10px;
        align-items: flex-start;
        padding: 0.75rem 0;
    }
    
    .logo {
        flex-shrink: 0;
    }
    
    .logo img {
        width: 120px;
        height: auto;
    }
    
    .header-contacts {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
        flex: 1;
        margin-left: auto;
    }
    
    .phone {
        font-size: 0.85rem;
        gap: 0.4rem;
    }
    
    .phone-numbers {
        display: flex;
        flex-direction: column;
        gap: 0.2rem;
        align-items: flex-end;
    }
    
    .phone-numbers a {
        font-size: 0.85rem;
        line-height: 1.2;
    }
    
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        gap: 4px;
        cursor: pointer;
        padding: 4px;
        align-self: flex-start;
        margin-top: 0;
    }
    
    .nav {
        order: 3;
        width: 100%;
        display: none;
        margin-top: 10px;
    }
    
    .nav.active {
        display: block;
    }
    
    .nav-list {
        flex-direction: column;
        background: white;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        border-radius: 8px;
        padding: 20px;
        margin-top: 10px;
    }
    
    .nav-list li {
        margin: 0;
        border-bottom: 1px solid #eee;
    }
    
    .nav-list li:last-child {
        border-bottom: none;
    }
    
    .nav-list a {
        padding: 12px 0;
        display: block;
    }
    
    .mobile-menu-toggle span {
        width: 25px;
        height: 3px;
        background: #333;
        transition: 0.3s;
    }
    
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    /* Hero Section */
    .hero-bg::before {
        background: linear-gradient(135deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.6) 100%);
    }
    
    .hero-title {
        font-size: 1.8rem;
        text-align: center;
    }
    
    .hero-description {
        text-align: center;
        font-size: 1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .hero-buttons .btn {
        width: 100%;
        max-width: 300px;
    }
    
    /* Features Section */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    /* Catalog Section */
    .catalog-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .catalog-card {
        flex-direction: column;
    }
    
    .card-image {
        height: 200px;
    }
    
    /* Compact sections for tablets */
    .features {
        padding: 1.5rem 0;
    }
    
    .catalog {
        padding: 1.5rem 0;
    }
    
    .section-title {
        margin-bottom: 0.75rem;
        font-size: 2rem;
    }
    
    /* Services Section */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .services {
        padding: 1.5rem 0;
    }
    
    .service-card {
        padding: 0.5rem;
    }
    
    /* Delivery Section */
    .delivery-section {
        padding: 1.5rem 0;
    }
    
    .delivery-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Services Page Specific Mobile Styles */
    .services-section {
        padding: 40px 0;
    }
    
    .services-section h2 {
        font-size: 2rem;
        margin-bottom: 30px;
    }
    
    .services-section .service-card {
        padding: 25px 20px;
        text-align: center;
        margin-bottom: 20px;
    }
    
    .services-section .service-icon {
        width: 60px;
        height: 60px;
        margin: 0 auto 20px;
        font-size: 1.5rem;
    }
    
    .services-section .service-card h3 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    .services-section .service-card p {
        font-size: 0.95rem;
        margin-bottom: 20px;
    }
    
    .services-section .service-details {
        padding: 15px;
        margin: 20px 0;
        text-align: left;
    }
    
    .services-section .service-details h4 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    .services-section .service-details ul {
        margin-bottom: 15px;
    }
    
    .services-section .service-details li {
        font-size: 0.9rem;
        padding: 6px 0;
        padding-left: 18px;
    }
    
    .services-section .service-details p {
        font-size: 0.9rem;
        margin: 8px 0;
    }
    
    /* About Section Mobile - Services Page */
    .about-section {
        padding: 40px 0;
    }
    
    .about-section h2 {
        font-size: 1.8rem;
        margin-bottom: 25px;
    }
    
    .about-section h3 {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }
    
    .about-section p {
        font-size: 0.95rem;
        line-height: 1.6;
        margin-bottom: 20px;
    }
    
    .about-section ul {
        margin-bottom: 20px;
    }
    
    .about-section li {
        font-size: 0.9rem;
        margin-bottom: 8px;
        padding-left: 20px;
        position: relative;
    }
    
    .about-section li::before {
        content: '•';
        position: absolute;
        left: 0;
        color: #2563eb;
        font-weight: bold;
    }
    
    .about-section .about-image {
        margin-top: 25px;
    }
    
    .about-section .about-image img {
        width: 100%;
        height: auto;
        border-radius: 12px;
    }
    
    /* Calculator Section Mobile */
    .calculator-section {
        padding: 40px 0;
    }
    
    .calculator-section h2 {
        font-size: 1.8rem;
        margin-bottom: 30px;
    }
    
    .calculator {
        flex-direction: column;
        gap: 30px;
    }
    
    .calculator-form {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .calculator-result {
        text-align: center;
        padding: 20px;
    }
    
    .calculator-result h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .result-price {
        font-size: 1.8rem;
    }
    
    /* Process Section Mobile */
    .process-section {
        padding: 40px 0;
    }
    
    .process-section h2 {
        font-size: 1.8rem;
        margin-bottom: 30px;
    }
    
    .process-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .process-step {
        text-align: center;
        padding: 20px;
    }
    
    .step-number {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
        margin: 0 auto 15px;
    }
    
    .process-step h3 {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
    
    .process-step p {
        font-size: 0.9rem;
    }
    
    /* Contact Section */
    .contact-content {
        flex-direction: column;
        gap: 30px;
    }
    
    .contact-methods {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .contact-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .contact-buttons .btn {
        width: 100%;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
    
    /* Product Pages */
    .about-content {
        flex-direction: column;
        gap: 30px;
    }
    
    .about-image img {
        width: 100%;
        height: auto;
    }
    
    .types-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .fractions-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .applications-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .delivery-content {
        flex-direction: column;
        gap: 30px;
    }
    
    .delivery-features {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Contact Form */
    .contact-form-content {
        flex-direction: column;
        gap: 30px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    /* Map Section */
    .map-content {
        flex-direction: column;
        gap: 20px;
    }
    
    /* FAQ Section */
    .faq-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Floating Buttons */
    .floating-buttons {
        bottom: 20px;
        right: 20px;
        gap: 10px;
    }
    
    .floating-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    body {
        padding-top: 80px; /* Adjust padding for mobile header with 2 rows */
        overflow-x: hidden; /* Prevent horizontal scroll */
    }
    
    /* Ensure proper layout */
    html, body {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .container {
        max-width: 100%;
        padding: 0 10px;
        margin: 0 auto;
    }
    
    /* Typography */
    .hero-title {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.3rem; }
    h4 { font-size: 1.1rem; }
    
    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    /* Header */
    .logo img {
        width: 100px;
        height: auto;
    }
    
    .header-contacts {
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
    }
    
    .phone {
        font-size: 0.8rem;
    }
    
    .phone-numbers {
        flex-direction: column;
        gap: 0.15rem;
        align-items: flex-end;
    }
    
    .phone-numbers a {
        font-size: 0.8rem;
    }
    
    .mobile-menu-toggle {
        padding: 2px;
    }
    
    .mobile-menu-toggle span {
        width: 20px;
        height: 2px;
    }
    
    /* Hero Section */
    .hero {
        height: 500px;
        padding: 40px 0;
    }
    
    .hero-bg::before {
        background: linear-gradient(135deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.7) 100%);
    }
    
    .hero-content {
        text-align: center;
    }
    
    /* Features */
    .feature-card {
        padding: 10px;
        text-align: center;
    }
    
    .feature-icon {
        width: 60px;
        height: 60px;
        margin: 0 auto 15px;
    }
    
    /* Catalog Cards */
    .catalog-card {
        padding: 8px;
    }
    
    .card-actions {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    /* Ultra compact sections for mobile */
    .features {
        padding: 1rem 0;
    }
    
    .catalog {
        padding: 1rem 0;
    }
    
    .services {
        padding: 1rem 0;
    }
    
    .delivery-section {
        padding: 1rem 0;
    }
    
    .section-title {
        margin-bottom: 0.5rem;
        font-size: 1.75rem;
    }
    
    .service-card {
        padding: 8px;
    }
    
    .services-grid {
        gap: 8px;
    }
    
    .card-actions .btn {
        width: 100%;
    }
    
    /* Service Cards */
    .service-card {
        padding: 20px;
        text-align: center;
    }
    
    .service-icon {
        width: 60px;
        height: 60px;
        margin: 0 auto 15px;
    }
    
    /* Services Page Specific Mobile Styles - Small Screens */
    .services-section {
        padding: 30px 0;
    }
    
    .services-section h2 {
        font-size: 1.6rem;
        margin-bottom: 25px;
    }
    
    .services-section .service-card {
        padding: 20px 15px;
        margin-bottom: 15px;
    }
    
    .services-section .service-icon {
        width: 50px;
        height: 50px;
        margin: 0 auto 15px;
        font-size: 1.3rem;
    }
    
    .services-section .service-card h3 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    
    .services-section .service-card p {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }
    
    .services-section .service-details {
        padding: 12px;
        margin: 15px 0;
    }
    
    .services-section .service-details h4 {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }
    
    .services-section .service-details li {
        font-size: 0.85rem;
        padding: 5px 0;
        padding-left: 16px;
    }
    
    .services-section .service-details p {
        font-size: 0.85rem;
        margin: 6px 0;
    }
    
    /* About Section Mobile - Small Screens */
    .about-section {
        padding: 30px 0;
    }
    
    .about-section h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .about-section h3 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    
    .about-section p {
        font-size: 0.9rem;
        line-height: 1.5;
        margin-bottom: 15px;
    }
    
    .about-section ul {
        margin-bottom: 15px;
    }
    
    .about-section li {
        font-size: 0.85rem;
        margin-bottom: 6px;
        padding-left: 18px;
    }
    
    .about-section .about-image {
        margin-top: 20px;
    }
    
    /* Calculator Section Mobile - Small Screens */
    .calculator-section {
        padding: 30px 0;
    }
    
    .calculator-section h2 {
        font-size: 1.5rem;
        margin-bottom: 25px;
    }
    
    .calculator {
        gap: 25px;
    }
    
    .calculator-form {
        gap: 12px;
    }
    
    .calculator-result {
        padding: 15px;
    }
    
    .calculator-result h3 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    .result-price {
        font-size: 1.5rem;
    }
    
    /* Process Section Mobile - Small Screens */
    .process-section {
        padding: 30px 0;
    }
    
    .process-section h2 {
        font-size: 1.5rem;
        margin-bottom: 25px;
    }
    
    .process-step {
        padding: 15px;
    }
    
    .step-number {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
        margin: 0 auto 12px;
    }
    
    .process-step h3 {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }
    
    .process-step p {
        font-size: 0.85rem;
    }
    
    /* Contact Form */
    .contact-form {
        padding: 20px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px;
        font-size: 0.9rem;
    }
    
    /* Footer */
    .footer {
        padding: 2rem 0 1rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
        margin-bottom: 1.5rem;
    }
    
    .footer-section {
        padding: 0 10px;
    }
    
    .footer-section h3,
    .footer-section h4 {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }
    
    .footer-section p {
        font-size: 0.9rem;
        line-height: 1.5;
        margin-bottom: 10px;
    }
    
    .footer-section ul {
        text-align: center;
        margin: 0;
        padding: 0;
    }
    
    .footer-section ul li {
        margin-bottom: 8px;
    }
    
    .footer-section ul li a {
        font-size: 0.9rem;
        display: inline-block;
        padding: 5px 0;
    }
    
    .footer-bottom {
        padding-top: 15px;
        margin-top: 20px;
    }
    
    .footer-bottom p {
        font-size: 0.85rem;
        margin: 0;
    }
    
    /* Product Pages */
    .type-actions {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .type-actions .btn {
        width: 100%;
    }
    
    .fractions-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .product-price {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .product-price .btn {
        width: 100%;
    }
    
    /* Calculator */
    .calculator-form {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .calculator-result {
        text-align: center;
    }
    
    /* Floating Buttons */
    .floating-buttons {
        bottom: 15px;
        right: 15px;
        gap: 8px;
        z-index: 9999;
    }
    
    .floating-btn {
        width: 45px;
        height: 45px;
        font-size: 1rem;
        box-shadow: 0 3px 15px rgba(0, 0, 0, 0.3);
    }
    
    .floating-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .container {
        padding: 0 8px;
    }
    
    .hero {
        height: 450px;
        padding: 30px 0;
    }
    
    .hero-bg::before {
        background: linear-gradient(135deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.7) 100%);
    }
    
    .hero-title {
        font-size: 1.3rem;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    /* Services Page Specific Mobile Styles - Extra Small Screens */
    .services-section {
        padding: 25px 0;
    }
    
    .services-section h2 {
        font-size: 1.4rem;
        margin-bottom: 20px;
    }
    
    .services-section .service-card {
        padding: 15px 12px;
        margin-bottom: 12px;
    }
    
    .services-section .service-icon {
        width: 45px;
        height: 45px;
        margin: 0 auto 12px;
        font-size: 1.2rem;
    }
    
    .services-section .service-card h3 {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    .services-section .service-card p {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }
    
    .services-section .service-details {
        padding: 10px;
        margin: 12px 0;
    }
    
    .services-section .service-details h4 {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }
    
    .services-section .service-details li {
        font-size: 0.8rem;
        padding: 4px 0;
        padding-left: 14px;
    }
    
    .services-section .service-details p {
        font-size: 0.8rem;
        margin: 5px 0;
    }
    
    /* About Section Mobile - Extra Small Screens */
    .about-section {
        padding: 25px 0;
    }
    
    .about-section h2 {
        font-size: 1.3rem;
        margin-bottom: 18px;
    }
    
    .about-section h3 {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    .about-section p {
        font-size: 0.85rem;
        line-height: 1.4;
        margin-bottom: 12px;
    }
    
    .about-section ul {
        margin-bottom: 12px;
    }
    
    .about-section li {
        font-size: 0.8rem;
        margin-bottom: 5px;
        padding-left: 16px;
    }
    
    .about-section .about-image {
        margin-top: 18px;
    }
    
    /* Footer Extra Small */
    .footer {
        padding: 1.5rem 0 1rem;
    }
    
    .footer-content {
        gap: 15px;
        margin-bottom: 1rem;
    }
    
    .footer-section {
        padding: 0 5px;
    }
    
    .footer-section h3,
    .footer-section h4 {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    .footer-section p {
        font-size: 0.85rem;
        line-height: 1.4;
        margin-bottom: 8px;
    }
    
    .footer-section ul li {
        margin-bottom: 6px;
    }
    
    .footer-section ul li a {
        font-size: 0.85rem;
        padding: 3px 0;
    }
    
    .footer-bottom {
        padding-top: 12px;
        margin-top: 15px;
    }
    
    .footer-bottom p {
        font-size: 0.8rem;
    }
    
    .floating-btn {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    }
}

/* Landscape orientation for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        height: 400px;
        padding: 30px 0;
    }
    
    .hero-bg::before {
        background: linear-gradient(135deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.6) 100%);
    }
    
    .hero-title {
        font-size: 1.6rem;
    }
    
    .nav-list {
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-bg {
        background-size: cover;
    }
    
    .hero-bg::before {
        background: linear-gradient(135deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.6) 100%);
    }
    
    .card-image img,
    .about-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print styles */
@media print {
    .header,
    .floating-buttons,
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .hero {
        background: none !important;
        color: black !important;
    }
    
    .btn {
        border: 1px solid #000 !important;
        background: none !important;
        color: black !important;
    }
    
    .container {
        max-width: none !important;
        padding: 0 !important;
    }
} 