/* ===== GLOBAL RESPONSIVE STYLES FOR CRANE INTELLIGENCE ===== */
/* Comprehensive mobile-first responsive design for all pages */

/* ===== BASE MOBILE STYLES (320px+) ===== */
* {
    box-sizing: border-box;
}

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

body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* ===== CONTAINER UTILITIES ===== */
.container,
.content-container,
.page-container {
    width: 100%;
    max-width: 100%;
    padding-left: 16px;
    padding-right: 16px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== HEADER RESPONSIVE FIXES ===== */
.header,
.uniform-header {
    width: 100% !important;
    max-width: 100vw !important;
    position: relative !important;
    overflow-x: hidden !important;
}

.header-container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    flex-wrap: wrap !important;
}

.logo {
    flex-shrink: 0 !important;
    max-width: 100% !important;
}

.logo-svg,
.logo img {
    max-width: 100% !important;
    height: auto !important;
}

.nav-menu {
    flex-wrap: wrap !important;
    gap: 12px !important;
}

.header-right {
    flex-wrap: wrap !important;
    gap: 8px !important;
}

/* ===== DASHBOARD RESPONSIVE ===== */
/* Only apply mobile styles on small screens */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .sidebar {
        width: 100% !important;
        max-width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid #333333 !important;
        padding: 16px !important;
    }

    .sidebar-section {
        margin-bottom: 16px !important;
    }

    .main-content,
    .main-content-area {
        width: 100% !important;
        max-width: 100% !important;
        padding: 16px !important;
        overflow-x: hidden !important;
    }
    
    .right-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        border-left: none !important;
        border-top: 1px solid #333333 !important;
        padding: 16px !important;
    }
}

/* ===== GRID RESPONSIVE ===== */
.grid,
.grid-2,
.grid-3,
.grid-4 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* ===== CARDS RESPONSIVE ===== */
.card,
.feature-card,
.pricing-card,
.metric-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px !important;
    margin-bottom: 16px !important;
}

/* ===== TABLES RESPONSIVE ===== */
.table-container {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

table {
    width: 100% !important;
    min-width: 600px !important;
    font-size: 14px !important;
}

table th,
table td {
    padding: 8px 12px !important;
    white-space: nowrap !important;
}

/* ===== FORMS RESPONSIVE ===== */
form,
.form-container {
    width: 100% !important;
    max-width: 100% !important;
}

.form-group {
    width: 100% !important;
    margin-bottom: 16px !important;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px 16px !important;
    font-size: 16px !important; /* Prevents zoom on iOS */
    box-sizing: border-box !important;
}

/* ===== BUTTONS RESPONSIVE ===== */
.btn,
.button,
button {
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px 24px !important;
    font-size: 16px !important;
    min-height: 44px !important; /* Touch target size */
    box-sizing: border-box !important;
    white-space: normal !important;
    word-wrap: break-word !important;
}

.btn-group,
.button-group {
    flex-direction: column !important;
    width: 100% !important;
}

.btn-group .btn,
.button-group .button {
    width: 100% !important;
    margin-bottom: 8px !important;
}

/* ===== MODALS RESPONSIVE ===== */
.modal,
.modal-dialog {
    width: 100% !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 16px !important;
    box-sizing: border-box !important;
}

.modal-content {
    width: 90% !important;
    max-width: 450px !important;
    padding: 0 !important;
    margin: 2% auto !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
}

.modal-header,
.modal-body,
.modal-footer {
    width: 100% !important;
    padding: 16px !important;
    box-sizing: border-box !important;
}

/* ===== FOOTER RESPONSIVE ===== */
.footer,
.footer-main {
    width: 100% !important;
    max-width: 100vw !important;
    padding: 32px 16px !important;
    flex-direction: column !important;
    gap: 24px !important;
}

.footer-section {
    width: 100% !important;
    text-align: center !important;
    margin-bottom: 24px !important;
}

/* ===== TEXT RESPONSIVE ===== */
h1 {
    font-size: 1.75rem !important;
    line-height: 1.2 !important;
    word-wrap: break-word !important;
}

h2 {
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
    word-wrap: break-word !important;
}

h3 {
    font-size: 1.25rem !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
}

h4 {
    font-size: 1.125rem !important;
    line-height: 1.4 !important;
    word-wrap: break-word !important;
}

p {
    font-size: 1rem !important;
    line-height: 1.6 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* ===== HERO SECTIONS RESPONSIVE ===== */
.hero,
.hero-section {
    width: 100% !important;
    max-width: 100vw !important;
    padding: 40px 16px !important;
    text-align: center !important;
}

.hero-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
}

.hero-content h1 {
    font-size: 1.75rem !important;
    margin-bottom: 16px !important;
}

.hero-content p {
    font-size: 1rem !important;
    margin-bottom: 24px !important;
}

.hero-stats {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    margin-top: 24px !important;
}

/* ===== STATS/STATS GRID RESPONSIVE ===== */
.stats-grid,
.stat-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 16px !important;
    width: 100% !important;
}

.stat-item {
    width: 100% !important;
    padding: 16px !important;
}

/* ===== PRICING SECTION RESPONSIVE ===== */
.pricing-section {
    width: 100% !important;
    padding: 40px 16px !important;
}

.pricing-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 24px !important;
    width: 100% !important;
}

.pricing-card {
    width: 100% !important;
    max-width: 100% !important;
}

/* ===== FEATURES SECTION RESPONSIVE ===== */
.features-section {
    width: 100% !important;
    padding: 40px 16px !important;
}

.features-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 24px !important;
    width: 100% !important;
}

/* ===== ADMIN PAGES RESPONSIVE ===== */
.admin-container,
.admin-dashboard {
    width: 100% !important;
    max-width: 100vw !important;
    padding: 16px !important;
    overflow-x: hidden !important;
}

.admin-header {
    width: 100% !important;
    padding: 12px 16px !important;
    flex-wrap: wrap !important;
    height: auto !important;
    min-height: 70px !important;
}

.admin-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    transform: none !important;
    height: auto !important;
    border-right: none !important;
    border-bottom: 1px solid #333333 !important;
}

.admin-main-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px !important;
    margin-left: 0 !important;
}

.admin-card,
.admin-panel {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px !important;
    margin-bottom: 16px !important;
}

/* ===== MOBILE MENU ===== */
.mobile-menu-toggle {
    display: block !important;
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 8px !important;
    background: transparent !important;
    border: 1px solid #404040 !important;
    border-radius: 4px !important;
    color: #FFFFFF !important;
    cursor: pointer !important;
}

.mobile-menu {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: 100vh !important;
    background: #1A1A1A !important;
    z-index: 10000 !important;
    padding: 80px 24px 24px !important;
    overflow-y: auto !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s ease !important;
}

.mobile-menu.active {
    transform: translateX(0) !important;
}

.mobile-menu-close {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    background: transparent !important;
    border: none !important;
    color: #FFFFFF !important;
    font-size: 24px !important;
    cursor: pointer !important;
}

/* ===== UTILITY CLASSES ===== */
.hide-mobile {
    display: none !important;
}

.show-mobile {
    display: block !important;
}

.full-width {
    width: 100% !important;
    max-width: 100% !important;
}

.no-overflow {
    overflow: hidden !important;
    max-width: 100vw !important;
}

/* ===== SMALL MOBILE (320px - 479px) ===== */
@media (max-width: 479px) {
    html {
        font-size: 14px;
    }
    
    .container,
    .content-container {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .header-container {
        padding-left: 12px !important;
        padding-right: 12px !important;
        height: auto !important;
        min-height: 70px !important;
    }
    
    .logo-svg,
    .logo img {
        max-width: 120px !important;
        height: auto !important;
    }
    
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    h3 {
        font-size: 1.125rem !important;
    }
    
    .btn,
    .button {
        padding: 12px 20px !important;
        font-size: 14px !important;
    }
    
    .modal-content {
        width: 95% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 5% auto !important;
        max-height: 90vh !important;
    }
    
    .modal-header,
    .modal-body {
        padding: 20px !important;
    }
}

/* ===== MOBILE PORTRAIT (480px - 575px) ===== */
@media (min-width: 480px) and (max-width: 575px) {
    .container,
    .content-container {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .header-container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}

/* ===== MOBILE LANDSCAPE / SMALL TABLET (576px - 767px) ===== */
@media (min-width: 576px) and (max-width: 767px) {
    .container,
    .content-container {
        padding-left: 24px;
        padding-right: 24px;
    }
    
    .grid-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .pricing-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .features-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .btn-group,
    .button-group {
        flex-direction: row !important;
    }
    
    .btn-group .btn,
    .button-group .button {
        width: auto !important;
        margin-right: 8px !important;
        margin-bottom: 0 !important;
    }
}

/* ===== TABLET PORTRAIT (768px - 991px) ===== */
@media (min-width: 768px) and (max-width: 991px) {
    .container,
    .content-container {
        padding-left: 32px;
        padding-right: 32px;
        max-width: 768px;
    }
    
    .dashboard-container {
        flex-direction: row !important;
    }
    
    .sidebar {
        width: 250px !important;
        min-width: 250px !important;
        border-right: 1px solid #333333 !important;
        border-bottom: none !important;
    }
    
    .main-content,
    .main-content-area {
        flex: 1 !important;
        min-width: 0 !important;
    }
    
    .right-sidebar {
        width: 250px !important;
        min-width: 250px !important;
        border-left: 1px solid #333333 !important;
        border-top: none !important;
    }
    
    .grid-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .pricing-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .features-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .stats-grid,
    .stat-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    .hero-stats {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .admin-sidebar {
        width: 200px !important;
        position: fixed !important;
        height: calc(100vh - 70px) !important;
        border-right: 1px solid #333333 !important;
        border-bottom: none !important;
    }
    
    .admin-main-content {
        margin-left: 200px !important;
        width: calc(100% - 200px) !important;
    }
    
    .hide-mobile {
        display: block !important;
    }
    
    .show-mobile {
        display: none !important;
    }
}

/* ===== TABLET LANDSCAPE / SMALL DESKTOP (992px - 1199px) ===== */
@media (min-width: 992px) and (max-width: 1199px) {
    .container,
    .content-container {
        max-width: 992px;
        padding-left: 32px;
        padding-right: 32px;
    }
    
    .grid-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .grid-4 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .pricing-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .features-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .stats-grid,
    .stat-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    .hero-stats {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ===== DESKTOP (1200px - 1399px) ===== */
@media (min-width: 1200px) and (max-width: 1399px) {
    .container,
    .content-container {
        max-width: 1200px;
        padding-left: 40px;
        padding-right: 40px;
    }
    
    .grid-4 {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    .pricing-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .features-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ===== LARGE DESKTOP (1400px+) ===== */
@media (min-width: 1400px) {
    .container,
    .content-container {
        max-width: 1400px;
        padding-left: 40px;
        padding-right: 40px;
    }
}

/* ===== LANDSCAPE ORIENTATION ===== */
@media (orientation: landscape) and (max-height: 500px) {
    .header-container {
        height: 60px !important;
        min-height: 60px !important;
    }
    
    .hero,
    .hero-section {
        padding: 20px 16px !important;
    }
    
    .modal-content {
        width: 90% !important;
        max-width: 450px !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
        margin: 2% auto !important;
    }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .button,
    button,
    a {
        min-height: 44px !important;
        min-width: 44px !important;
        padding: 12px 20px !important;
    }
    
    .nav-link,
    .menu-item {
        padding: 12px 16px !important;
        min-height: 44px !important;
    }
    
    input,
    select,
    textarea {
        min-height: 44px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .header,
    .footer,
    .mobile-menu-toggle,
    .mobile-menu,
    .admin-sidebar,
    .sidebar {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .page-break {
        page-break-after: always;
    }
}

