/* Markzy - Responsive CSS for Mobile & Tablet */

/* Base Responsive Settings */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

/* Mobile-First Typography */
body {
    font-size: 16px;
    line-height: 1.6;
}

/* Ensure all buttons have proper sizing */
.btn {
    min-height: 44px; /* Touch-friendly size */
    padding: 10px 20px !important;
    font-size: 16px !important;
    white-space: nowrap;
    border-radius: 8px;
}

.btn-lg {
    min-height: 50px;
    padding: 12px 24px !important;
    font-size: 18px !important;
}

.btn-sm {
    min-height: 38px;
    padding: 8px 16px !important;
    font-size: 14px !important;
}

/* Table Responsive Fixes */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.table {
    min-width: 800px; /* Prevents squishing on mobile */
    margin-bottom: 0;
}

.table td, .table th {
    padding: 12px;
    font-size: 16px;
    vertical-align: middle;
}

/* Card Responsive */
.card {
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
}

.card-body {
    padding: 20px;
}

/* Form Controls - Touch Friendly */
.form-control,
.form-select,
select.form-control,
input.form-control,
textarea.form-control {
    min-height: 48px;
    padding: 12px;
    font-size: 16px !important;
    border-radius: 8px;
}

textarea.form-control {
    min-height: 100px;
}

.form-label {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Mobile Navigation Improvements */
@media (max-width: 768px) {
    /* Typography */
    h1 {
        font-size: 24px !important;
    }
    
    h2 {
        font-size: 20px !important;
    }
    
    h3 {
        font-size: 18px !important;
    }
    
    /* Spacing */
    .mb-4 {
        margin-bottom: 1.5rem !important;
    }
    
    /* Buttons on Mobile */
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .btn-group .btn,
    .d-flex .btn,
    .flex-wrap .btn {
        width: auto;
        margin: 5px;
    }
    
    /* Dashboard Stats Grid */
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Cards */
    .card-body {
        padding: 15px;
    }
    
    /* Table Actions */
    .table td .d-flex,
    .table td .flex {
        flex-direction: column;
        gap: 8px;
    }
    
    .table td .d-flex .btn,
    .table td .flex .btn {
        width: 100%;
    }
    
    /* Search/Filter Forms */
    .row > [class*="col-"] {
        margin-bottom: 15px;
    }
    
    /* Work Order Create - Step Guide */
    .alert {
        padding: 15px;
        font-size: 14px;
    }
    
    /* Navigation */
    .navbar {
        padding: 10px 15px;
    }
    
    .navbar-brand {
        font-size: 18px !important;
    }
    
    /* Modal */
    .modal-dialog {
        margin: 10px;
    }
    
    /* Invoice/PDF */
    .invoice-container {
        padding: 15px;
    }
}

/* Tablet Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .table {
        min-width: 700px;
    }
    
    /* Two columns for stats */
    [style*="grid-template-columns: repeat(auto-fit"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn,
    .form-control,
    .form-select,
    a {
        min-height: 44px; /* Apple's recommendation */
    }
    
    /* Larger tap areas for links */
    a {
        padding: 8px;
        display: inline-block;
    }
    
    /* Remove hover effects on touch */
    .btn:hover {
        transform: none;
    }
}

/* Landscape Phone Optimization */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        font-size: 14px;
    }
    
    .btn {
        min-height: 38px;
        padding: 8px 16px !important;
    }
    
    .form-control {
        min-height: 42px;
    }
}

/* Print Styles */
@media print {
    .btn,
    .navbar,
    .sidebar,
    form button[type="submit"] {
        display: none !important;
    }
    
    .table {
        font-size: 12px;
    }
    
    .card {
        page-break-inside: avoid;
    }
}

/* Accessibility */
.btn:focus,
.form-control:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* Loading States */
.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Badge Sizing */
.badge {
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
}

/* Alert Responsiveness */
.alert {
    border-radius: 10px;
    padding: 16px;
    font-size: 16px;
}

@media (max-width: 576px) {
    .alert {
        font-size: 14px;
        padding: 12px;
    }
}

/* Flex Utilities */
.gap-2 {
    gap: 0.5rem;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* Ensure images are responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Stats Cards Mobile */
@media (max-width: 576px) {
    .card h2 {
        font-size: 32px !important;
    }
    
    .card p {
        font-size: 14px !important;
    }
}

/* Action Button Container */
.table td .d-flex,
.table td .flex {
    min-width: 200px;
}

/* Pagination */
.pagination {
    flex-wrap: wrap;
    justify-content: center;
}

.pagination .page-link {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* Work Order Show Page - Mobile */
@media (max-width: 768px) {
    .work-order-details .row > div {
        margin-bottom: 15px;
    }
}

/* Customer Details - Mobile */
@media (max-width: 768px) {
    .customer-info .col-md-6 {
        width: 100%;
    }
}

/* Improved Spacing on Small Screens */
@media (max-width: 576px) {
    .container,
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .card {
        border-radius: 8px;
    }
    
    .card-body {
        padding: 12px;
    }
}

/* Quick Actions Dashboard */
@media (max-width: 768px) {
    .dashboard .quick-actions a {
        font-size: 16px;
        padding: 15px !important;
    }
}

/* Safe Area Insets for Notched Devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
}

/* Dark Mode Support (Future) */
@media (prefers-color-scheme: dark) {
    /* Placeholder for dark mode styles */
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

