/* ========================================
   DEVCO Engineers - Global Responsive Styles
   ======================================== */

/* Base Responsive Utilities */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    padding-top: 0;
    margin: 0;
}

/* Fix for content going under fixed header */
.page {
    padding-top: 0;
    margin-top: 0;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Container Responsive */
.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

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

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* Typography Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem !important;
    }
    
    h2 {
        font-size: 1.75rem !important;
    }
    
    h3 {
        font-size: 1.5rem !important;
    }
    
    h4 {
        font-size: 1.25rem !important;
    }
    
    h5 {
        font-size: 1.1rem !important;
    }
    
    p {
        font-size: 0.95rem !important;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.75rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
}

/* Table Responsive */
@media (max-width: 768px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    table th,
    table td {
        padding: 8px !important;
        white-space: nowrap;
    }
}

/* Form Responsive */
@media (max-width: 768px) {
    .form-control,
    .form-select,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 12px !important;
    }
    
    .btn {
        padding: 12px 24px !important;
        font-size: 0.95rem !important;
    }
}

/* Grid Responsive */
@media (max-width: 768px) {
    .row {
        margin-right: -10px;
        margin-left: -10px;
    }
    
    .row > * {
        padding-right: 10px;
        padding-left: 10px;
    }
}

/* Card Responsive */
@media (max-width: 768px) {
    .card {
        margin-bottom: 20px;
    }
    
    .card-body {
        padding: 20px !important;
    }
}

/* Modal Responsive */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: 12px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }
}

/* Navbar Responsive (Additional) */
@media (max-width: 991px) {
    .rd-navbar-panel {
        padding: 15px 20px;
    }
    
    .rd-navbar-brand img {
        max-width: 120px;
        height: auto;
    }
}

/* Hero/Banner Sections - Prevent overlap with header */
.hero-section,
.products-hero,
.contact-hero,
.about-hero,
.page-hero,
.page-header,
[class*="-hero"],
[class*="-header"] {
    margin-top: 0 !important;
}

/* First section after header - Add padding for fixed navbar on mobile only */
@media (max-width: 991px) {
    section:first-of-type,
    .hero-section,
    .contact-hero,
    .products-hero,
    .about-hero,
    .page-header,
    [class*="-hero"]:first-child,
    [class*="-header"]:first-child {
        padding-top: 140px !important;
    }
}

@media (max-width: 768px) {
    section:first-of-type,
    .hero-section,
    .contact-hero,
    .products-hero,
    .about-hero,
    .page-header,
    [class*="-hero"]:first-child,
    [class*="-header"]:first-child {
        padding-top: 120px !important;
    }
}

@media (max-width: 480px) {
    section:first-of-type,
    .hero-section,
    .contact-hero,
    .products-hero,
    .about-hero,
    .page-header,
    [class*="-hero"]:first-child,
    [class*="-header"]:first-child {
        padding-top: 110px !important;
    }
}

/* Section Spacing Responsive */
@media (max-width: 768px) {
    section {
        padding: 40px 0 !important;
    }
    
    .section-header {
        margin-bottom: 30px !important;
    }
}

@media (max-width: 480px) {
    section {
        padding: 30px 0 !important;
    }
}

/* Product/Category Cards Responsive */
@media (max-width: 768px) {
    .product-card,
    .category-card,
    .application-card {
        margin-bottom: 20px;
    }
    
    .product-image,
    .category-image {
        height: 220px !important;
    }
}

@media (max-width: 480px) {
    .product-image,
    .category-image {
        height: 180px !important;
    }
}

/* Sidebar Responsive */
@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        top: 0;
        right: -100%;
        width: 320px;
        max-width: 85%;
        height: 100vh;
        background: white;
        z-index: 9999;
        transition: right 0.3s ease;
        overflow-y: auto;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.active {
        right: 0;
    }
}

/* Breadcrumb Responsive */
@media (max-width: 768px) {
    .breadcrumb {
        font-size: 0.85rem;
        padding: 10px 0;
    }
    
    .breadcrumb-item + .breadcrumb-item::before {
        padding: 0 5px;
    }
}

/* Pagination Responsive */
@media (max-width: 768px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-link {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

/* Video/Iframe Responsive */
.video-responsive {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
}

.video-responsive iframe,
.video-responsive object,
.video-responsive embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Image Gallery Responsive */
@media (max-width: 768px) {
    .gallery-item {
        width: 50% !important;
        padding: 5px;
    }
}

@media (max-width: 480px) {
    .gallery-item {
        width: 100% !important;
    }
}

/* Contact Page Responsive */
@media (max-width: 768px) {
    .contact-info-item {
        margin-bottom: 25px;
        text-align: center;
    }
    
    .contact-form {
        padding: 25px 20px;
    }
}

/* Product Detail Page Responsive */
@media (max-width: 991px) {
    .product-detail-image {
        margin-bottom: 30px;
    }
    
    .product-detail-content {
        padding: 0 15px;
    }
}

@media (max-width: 768px) {
    .product-specifications table {
        font-size: 0.85rem;
    }
    
    .product-tabs .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .product-tabs .nav-link {
        white-space: nowrap;
        font-size: 0.9rem;
        padding: 10px 15px;
    }
}

/* About Page Responsive */
@media (max-width: 768px) {
    .about-image {
        margin-bottom: 30px;
    }
    
    .timeline-item {
        padding-left: 40px;
    }
    
    .team-member {
        margin-bottom: 30px;
    }
}

/* Applications Page Responsive */
@media (max-width: 768px) {
    .application-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
}

/* Catalog Page Responsive */
@media (max-width: 768px) {
    .catalog-item {
        margin-bottom: 20px;
    }
    
    .catalog-preview {
        height: 250px !important;
    }
}

/* Videos Page Responsive */
@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    
    .video-card {
        margin-bottom: 20px;
    }
}

/* Floating Action Buttons Responsive */
@media (max-width: 768px) {
    .floating-actions,
    .floating-icons {
        bottom: 20px;
        right: 15px;
    }
    
    .floating-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

/* Utility Classes */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
}

/* Text Alignment Responsive */
@media (max-width: 768px) {
    .text-md-center {
        text-align: center !important;
    }
    
    .text-md-left {
        text-align: left !important;
    }
    
    .text-md-right {
        text-align: right !important;
    }
}

/* Spacing Utilities Responsive */
@media (max-width: 768px) {
    .mb-md-3 {
        margin-bottom: 1rem !important;
    }
    
    .mb-md-4 {
        margin-bottom: 1.5rem !important;
    }
    
    .mb-md-5 {
        margin-bottom: 3rem !important;
    }
    
    .mt-md-3 {
        margin-top: 1rem !important;
    }
    
    .mt-md-4 {
        margin-top: 1.5rem !important;
    }
    
    .mt-md-5 {
        margin-top: 3rem !important;
    }
    
    .p-md-3 {
        padding: 1rem !important;
    }
    
    .p-md-4 {
        padding: 1.5rem !important;
    }
}

/* Prevent Horizontal Scroll */
body {
    overflow-x: hidden;
}

.page {
    overflow-x: hidden;
    width: 100%;
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Print Styles */
@media print {
    .no-print,
    .navbar,
    .footer,
    .floating-actions,
    .floating-icons,
    .sidebar {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }
    
    a {
        text-decoration: underline;
    }
    
    .container {
        max-width: 100%;
    }
}
