/*
 * Mobile-First Responsive CSS for Property Management App
 * Optimized for iPhone and Android devices
 * Breakpoints: Mobile (320px+), Tablet (768px+), Desktop (1024px+)
 */

/* ====================================
   BASE & RESET
   ==================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    transition: background-color 0.3s ease;
    /* Prevent horizontal scroll on mobile */
    overflow-x: hidden;
    width: 100%;
}

/* ====================================
   MOBILE-FIRST LAYOUT (320px+)
   ==================================== */

.container {
    width: 100%;
    padding: 6px;
    margin: 0 auto;
    background-color: white;
    min-height: 100vh;
}

/* Content wrapper */
.content-wrapper {
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
}

/* ====================================
   TYPOGRAPHY - MOBILE OPTIMIZED
   ==================================== */

h1 {
    font-size: 1.75rem; /* 28px */
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
    color: #333;
    padding: 0 4px;
}

h2 {
    font-size: 1.5rem; /* 24px */
    font-weight: 600;
    margin-bottom: 0.875rem;
    line-height: 1.3;
}

h3 {
    font-size: 1.25rem; /* 20px */
    font-weight: 600;
    margin-bottom: 0.75rem;
}

p {
    font-size: 1rem; /* 16px */
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* ====================================
   LINKS - PREVENT OVERFLOW
   ==================================== */

a {
    /* Prevent long URLs from overflowing containers */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    /* Ensure links don't expand beyond their container */
    max-width: 100%;
    display: inline-block;
}

/* Subtitle badge */
.subtitle {
    display: inline-block;
    background: linear-gradient(135deg, #4a4a4a 0%, #6b6b6b 100%);
    color: white;
    font-size: 0.75rem; /* 12px on mobile */
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 20px;
    letter-spacing: 2px;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(74, 74, 74, 0.3);
}

/* ====================================
   BUTTONS - TOUCH OPTIMIZED
   ==================================== */

.btn, button, input[type="submit"], a.button {
    display: inline-block;
    padding: 14px 24px; /* Increased for easier touch */
    min-height: 44px; /* iOS minimum touch target */
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    width: 100%; /* Full width on mobile */
    margin-bottom: 10px;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover, .btn-primary:active {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid #007bff;
    color: #007bff;
}

/* Button group */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* Header section buttons - global mobile fix */
@media (max-width: 768px) {
    .header-section {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 8px !important;
    }
    
    .header-section .btn {
        flex: 1 1 auto !important;
        padding: 10px 16px !important;
        font-size: 0.8rem !important;
        min-width: 70px !important;
        white-space: nowrap !important;
    }
}

@media (max-width: 400px) {
    .header-section .btn {
        padding: 10px 12px !important;
        font-size: 0.75rem !important;
    }
}

/* ====================================
   FORMS - MOBILE OPTIMIZED
   ==================================== */

form {
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
    width: 100%;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #333;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 14px;
    font-size: 16px; /* Prevents iOS zoom on focus */
    border: 2px solid #ddd;
    border-radius: 8px;
    background-color: white;
    transition: border-color 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

/* Select dropdown arrow */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* ====================================
   NAVIGATION - MOBILE MENU
   ==================================== */

nav {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    flex-wrap: wrap;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #333;
    text-decoration: none;
}

.nav-links {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 10px;
}

.nav-links a {
    display: block;
    padding: 12px 0;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    border-bottom: 1px solid #f0f0f0;
    transition: color 0.3s ease;
}

.nav-links a:hover,
.nav-links a:active {
    color: #007bff;
    background-color: #f8f9fa;
    padding-left: 10px;
}

/* ====================================
   CARDS & LISTS
   ==================================== */

.card {
    background-color: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: box-shadow 0.3s ease;
}

.card:active {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.card-header {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.card-body {
    font-size: 1rem;
    line-height: 1.6;
}

/* List items */
.list-item {
    padding: 16px;
    background-color: white;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
}

.list-item:active {
    background-color: #f8f9fa;
}

/* ====================================
   TABLES - RESPONSIVE
   ==================================== */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    font-weight: 600;
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
}

/* Stack table on very small screens (EXCEPT markdown-table) */
@media (max-width: 600px) {
    table:not(.markdown-table), 
    table:not(.markdown-table) thead, 
    table:not(.markdown-table) tbody, 
    table:not(.markdown-table) th, 
    table:not(.markdown-table) td, 
    table:not(.markdown-table) tr {
        display: block;
    }
    
    /* Keep markdown-table as actual table - DO NOT stack on mobile */
    .markdown-table {
        display: table !important;
        width: 100%;
        max-width: 100%;
        font-size: 0.75rem;
        table-layout: fixed !important;
    }
    
    .markdown-table thead {
        display: table-header-group !important;
    }
    
    .markdown-table tbody {
        display: table-row-group !important;
    }
    
    .markdown-table tr {
        display: table-row !important;
    }
    
    .markdown-table th,
    .markdown-table td {
        display: table-cell !important;
        padding: 8px 6px !important;
        font-size: 0.7rem !important;
        line-height: 1.3 !important;
        white-space: normal !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
        hyphens: auto !important;
    }
    
    /* Force table to use fixed layout and stay within viewport */
    .markdown-table {
        table-layout: fixed !important;
    }
    
    /* First column (fee names) - ensure they can break at slashes */
    .markdown-table th:first-child,
    .markdown-table td:first-child {
        max-width: 35%;
        overflow-wrap: anywhere !important;
    }
    
    /* Wrap notes content in scrollable container for tables */
    .notes-content {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table:not(.markdown-table) thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    table:not(.markdown-table) tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 10px;
    }
    
    table:not(.markdown-table) td {
        border: none;
        position: relative;
        padding-left: 50%;
    }
    
    td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        font-weight: 600;
        color: #666;
    }
    
    /* Premium Table - Card Style on Mobile */
    .premium-table {
        display: block;
        width: 100%;
        margin: 0 -4px;
        width: calc(100% + 8px);
    }
    
    .premium-table thead {
        display: none;
    }
    
    .premium-table tbody {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .premium-table tr {
        display: flex;
        flex-direction: column;
        background: white;
        border-radius: 10px;
        padding: 14px 16px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
        border: 1px solid #E2E8F0;
        margin: 0;
    }
    
    .premium-table td {
        display: block;
        padding: 0 !important;
        padding-left: 0 !important;
        border: none;
    }
    
    .premium-table td:first-child {
        font-weight: 700;
        font-size: 0.95rem;
        color: #1E3A8A;
        margin-bottom: 6px;
        padding-bottom: 6px;
        border-bottom: 1px solid #E2E8F0;
    }
    
    .premium-table td:last-child {
        font-size: 0.875rem;
        color: #475569;
        line-height: 1.45;
    }
    
    .premium-table td strong {
        color: #1E3A8A;
    }
    
    /* Fee Table, Factors Table, Breed Table, Obligations Table - Card Style on Mobile */
    .fee-table,
    .factors-table,
    .breed-table,
    .obligations-table {
        display: block;
        width: 100%;
    }
    
    .fee-table thead,
    .factors-table thead,
    .breed-table thead,
    .obligations-table thead {
        display: none;
    }
    
    .fee-table tbody,
    .factors-table tbody,
    .breed-table tbody,
    .obligations-table tbody {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .fee-table tr,
    .factors-table tr,
    .breed-table tr,
    .obligations-table tr {
        display: flex;
        flex-direction: column;
        background: white;
        border-radius: 10px;
        padding: 14px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
        border: 1px solid #E2E8F0;
        margin-bottom: 0;
    }
    
    .fee-table td,
    .factors-table td,
    .breed-table td,
    .obligations-table td {
        display: block;
        padding: 0 !important;
        padding-left: 0 !important;
        border: none !important;
        background: transparent !important;
    }
    
    .fee-table td:first-child,
    .factors-table td:first-child,
    .breed-table td:first-child,
    .obligations-table td:first-child {
        font-weight: 700;
        font-size: 0.95rem;
        color: #1E3A8A;
        margin-bottom: 6px;
        padding-bottom: 6px !important;
        border-bottom: 1px solid #E2E8F0 !important;
    }
    
    .fee-table td:last-child,
    .factors-table td:last-child,
    .breed-table td:last-child,
    .obligations-table td:last-child {
        font-size: 0.85rem;
        color: #475569;
        line-height: 1.45;
    }
    
    /* Fee table color variants - accent on first td */
    .fee-table.green td:first-child { color: #065F46; }
    .fee-table.amber td:first-child { color: #92400E; }
    .fee-table.red td:first-child { color: #991B1B; }
    .fee-table.purple td:first-child { color: #5B21B6; }
}

/* ====================================
   ALERTS & MESSAGES
   ==================================== */

.alert {
    padding: 14px 16px;
    margin-bottom: 15px;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-error,
.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

/* ====================================
   CHECKLISTS - TOUCH OPTIMIZED
   ==================================== */

.checklist-item {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    margin-bottom: 12px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    min-height: 60px;
}

.checklist-item:active {
    background-color: #f8f9fa;
}

/* Checklist rows (property_detail.html specific) */
.checklist-row {
    display: flex;
    align-items: flex-start;
    padding: 10px 8px;
    margin-bottom: 6px;
    background-color: #f8f9fa;
    border-radius: 0;
    border-left: 3px solid #2196F3;
    border-right: none;
    border-top: none;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

/* Phase cards - mobile optimized */
.phase-card,
.card {
    margin-bottom: 12px;
    padding: 12px 8px;
    border-radius: 0;
    border: none;
    border-bottom: 2px solid #e0e0e0;
    box-shadow: none;
}

.phase-header {
    padding: 0 0 10px 0;
    margin-bottom: 10px;
}

/* Property Detail Page - Mobile Edge-to-Edge Overrides */
@media (max-width: 767px) {
    /* Main phases section */
    .phases-section {
        padding: 8px 0 !important;
        border-radius: 0 !important;
        margin-top: 12px !important;
        background-color: transparent !important;
        border: none !important;
    }
    
    /* Phase containers */
    .phase-container {
        border-radius: 0 !important;
        margin-bottom: 12px !important;
        box-shadow: none !important;
        border: none !important;
        border-bottom: 2px solid #e0e0e0 !important;
        padding: 0 !important;
    }
    
    /* Info cards - clean and full width */
    .info-card {
        border-radius: 8px !important;
        padding: 12px !important;
        margin-bottom: 6px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        border: none !important;
        border-bottom: 1px solid #e0e0e0 !important;
        box-sizing: border-box !important;
    }
    
    .info-card.collapsed {
        padding: 10px 12px !important;
    }
    
    /* Checklist container */
    .checklist-container {
        padding: 8px 0 !important;
    }
    
    /* Phase header */
    .phase-header-content {
        padding: 12px 8px !important;
    }
    
    /* Phase selector box */
    .phase-selector-box {
        padding: 12px 8px !important;
        border-radius: 0 !important;
        margin-bottom: 12px !important;
    }
    
    /* Hide "View Sub-Tasks" button on mobile */
    .sub-tasks-btn {
        display: none !important;
    }
    
    /* Make the entire row clickable on mobile */
    .checklist-row .item-description-link {
        display: block;
        flex: 1;
        /* Add subtle indication it's tappable */
        padding: 8px;
        margin: -8px;
        border-radius: 4px;
        transition: background-color 0.2s;
    }
    
    .checklist-row .item-description-link:active {
        background-color: rgba(33, 150, 243, 0.1);
    }
    
    /* Reposition Q&A badge to bottom right on mobile */
    .qa-badge {
        position: absolute;
        bottom: 8px;
        right: 8px;
        top: auto;
        font-size: 10px;
        padding: 3px 8px;
        margin-left: 0;
    }
    
    /* ============================================
       CHECKLIST MOBILE OPTIMIZATION
       More horizontal, less vertical stacking
       ============================================ */
    
    /* All checklist rows - wider but not cutting off content */
    .checklist-row {
        padding: 12px 10px 12px 12px !important;
        margin-bottom: 3px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        border-radius: 6px !important;
        border-left: 3px solid #3B82F6 !important;
        box-sizing: border-box !important;
    }
    
    /* Remove the decorative ::before border on mobile */
    .checklist-row::before {
        display: none !important;
    }
    
    /* Ensure checkbox and badges don't get cut off */
    .checklist-row .checkbox-container,
    .checklist-row input[type="checkbox"] {
        flex-shrink: 0 !important;
    }
    
    .checklist-row .qa-badge {
        position: relative !important;
        bottom: auto !important;
        right: auto !important;
        margin-left: auto !important;
        flex-shrink: 0 !important;
    }
    
    /* Checklist item text - tighter line height */
    .checklist-row .item-description,
    .checklist-row .item-description-link,
    .checklist-text {
        font-size: 0.9rem !important;
        line-height: 1.35 !important;
    }
    
    /* Sub-tasks counter - more compact */
    .checklist-row .sub-tasks-count,
    .sub-item-progress {
        font-size: 0.75rem !important;
        margin-top: 2px !important;
    }
    
    /* Checklist section container - full width */
    .checklist-section {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 0 !important;
    }
    
    /* Sub-item detail page checklist items - same treatment */
    .checklist-section .checklist-row {
        padding: 12px 10px 12px 12px !important;
        margin-bottom: 3px !important;
        border-radius: 6px !important;
        border-left: 3px solid #3B82F6 !important;
    }
    
    .checklist-section .checklist-row::before {
        display: none !important;
    }
    
    /* Checkbox sizing on mobile */
    .checklist-checkbox,
    .checklist-row input[type="checkbox"] {
        width: 22px !important;
        height: 22px !important;
        min-width: 22px !important;
        margin-right: 12px !important;
    }
    
    /* Expanded checklist page - sub items list */
    .sub-items-list,
    .checklist-container {
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* No subtasks card - full width */
    .no-subtasks-card {
        margin-left: 0 !important;
        margin-right: 0 !important;
        border-radius: 8px !important;
    }
    
    /* Phase 1 templates checklist items */
    .phase-checklist-item,
    .inventory-item,
    .task-item {
        padding: 10px 12px !important;
        margin-bottom: 4px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        border-radius: 6px !important;
        box-sizing: border-box !important;
    }
    
    /* Feature cards in sub-item detail pages */
    .pro-feature-card,
    .feature-card {
        margin-left: 0 !important;
        margin-right: 0 !important;
        border-radius: 8px !important;
        padding: 14px 12px !important;
        box-sizing: border-box !important;
    }
    
    /* Edge-to-edge optimizations for mobile */
    h2 {
        padding: 0 4px;
        font-size: 1.35rem;
    }
    
    h3 {
        padding: 0 4px;
        font-size: 1.15rem;
    }
    
    /* Remove extra spacing from sections */
    .section {
        margin-bottom: 16px;
        padding: 0;
    }
    
    /* Progress bars edge-to-edge */
    .progress-bar,
    .progress-container {
        margin: 8px 0;
        border-radius: 0;
    }
}

input[type="checkbox"] {
    width: 24px;
    height: 24px;
    margin-right: 15px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #1E3A8A; /* Modern browser checkbox color */
}

/* Custom styled checkboxes */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    user-select: none;
    margin-right: 15px;
    padding-top: 2px;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 24px;
    width: 24px;
    background-color: white;
    border: 2px solid #999;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-block;
    position: relative;
}

.checkbox-container:hover .checkmark {
    border-color: #1E3A8A;
}

.checkbox-container input:checked ~ .checkmark {
    background-color: #1E3A8A;
    border-color: #1E3A8A;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checklist-content {
    flex: 1;
    font-size: 1rem;
    line-height: 1.5;
}

/* ====================================
   DARK MODE SUPPORT
   ==================================== */

body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode .container,
body.dark-mode .card,
body.dark-mode .list-item {
    background-color: #2d2d2d;
    color: #e0e0e0;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
    color: #fff;
}

body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
    background-color: #3a3a3a;
    border-color: #4a4a4a;
    color: #e0e0e0;
}

/* ====================================
   UTILITIES
   ==================================== */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.hidden {
    display: none;
}

/* Hide standalone dark mode toggle on mobile (but keep hamburger menu toggle visible) */
@media (max-width: 767px) {
    .dark-mode-toggle,
    #theme-toggle-container,
    .theme-toggle-container,
    .theme-toggle-wrapper,
    .theme-toggle-label {
        display: none !important;
    }
    
    /* Keep the theme switch visible in hamburger menu */
    .settings-dropdown .theme-switch {
        display: inline-block !important;
    }
}

/* ====================================
   GLOBAL MOBILE FIXES FOR HERO/BANNER SECTIONS
   ==================================== */

@media (max-width: 640px) {
    /* Hero banners with flex layout - stack on mobile */
    .pro-portal-banner,
    .pro-hero,
    .cta-box,
    .pro-portal-highlight {
        flex-direction: column !important;
        text-align: center !important;
        gap: 16px !important;
        padding: 16px !important;
    }
    
    /* Hero banner flex children */
    .pro-portal-banner > div,
    .pro-hero > div,
    .cta-box > div {
        flex-direction: column !important;
        text-align: center !important;
        align-items: center !important;
    }
    
    /* Images in hero sections */
    .pro-portal-banner img,
    .pro-hero img,
    .cta-box img {
        height: 60px !important;
        max-width: 200px !important;
        margin: 0 auto !important;
    }
    
    /* Headings in hero sections */
    .pro-portal-banner h3,
    .pro-hero h3,
    .cta-box h3,
    .pro-hero-title {
        font-size: 1.25rem !important;
        line-height: 1.3 !important;
    }
    
    /* Paragraphs/subtitles in hero sections */
    .pro-portal-banner p,
    .pro-hero p,
    .cta-box p,
    .pro-hero-subtitle {
        font-size: 0.875rem !important;
        line-height: 1.5 !important;
    }
    
    /* Badges that have white-space: nowrap - allow wrapping on mobile */
    .info-card span[style*="white-space: nowrap"],
    .pro-portal-badge,
    [style*="white-space: nowrap"] {
        white-space: normal !important;
        word-wrap: break-word !important;
    }
    
    /* PRO Portal CTA buttons */
    .pro-hero-cta,
    .premium-cta-button {
        padding: 14px 20px !important;
        font-size: 0.9rem !important;
        flex-direction: column !important;
        gap: 4px !important;
    }
    
    .pro-hero-cta span,
    .premium-cta-button span {
        font-size: 0.85rem !important;
    }
    
    /* Pricing sections */
    .pro-pricing {
        flex-direction: column !important;
        align-items: center !important;
        gap: 12px !important;
    }
    
    .pro-price-tag {
        margin-bottom: 8px !important;
    }
    
    /* Info card headers with badges */
    .info-card-header,
    .toggle-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
        flex-wrap: wrap !important;
    }
    
    .info-card-header h3,
    .toggle-header h3 {
        font-size: 0.95rem !important;
        line-height: 1.3 !important;
    }
    
    .info-card-header span,
    .toggle-header span {
        font-size: 0.65rem !important;
        margin-left: 0 !important;
        white-space: normal !important;
        padding: 3px 8px !important;
    }
    
    /* Service grids - single column on mobile */
    .services-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Request form container */
    .request-form-container {
        padding: 16px !important;
        margin-top: 16px !important;
    }
    
    /* Form sections */
    .form-section-header {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .form-section-title {
        font-size: 1rem !important;
    }
    
    /* Video backgrounds in hero sections - reduce on mobile for performance */
    .pro-portal-banner video,
    .pro-hero video,
    .cta-box video {
        opacity: 0.15 !important;
    }
    /* Page header videos keep higher opacity for flag visibility */
    .page-header video {
        opacity: 0.4 !important;
    }
}

/* ====================================
   TABLET (768px+)
   ==================================== */

@media (min-width: 768px) {
    .container {
        padding: 30px;
        border-radius: 12px;
        margin: 20px auto;
        max-width: 95%;
    }
    
    .content-wrapper {
        padding: 20px;
    }
    
    h1 {
        font-size: 2.25rem; /* 36px */
    }
    
    h2 {
        font-size: 1.875rem; /* 30px */
    }
    
    .subtitle {
        font-size: 0.875rem; /* 14px */
        padding: 8px 24px;
    }
    
    .btn {
        width: auto;
        min-width: 140px;
    }
    
    .button-group {
        flex-direction: row;
        justify-content: center;
    }
    
    .nav-links {
        flex-direction: row;
        width: auto;
        margin-top: 0;
        gap: 20px;
    }
    
    .nav-links a {
        padding: 8px 16px;
        border-bottom: none;
        border-radius: 6px;
    }
    
    .nav-links a:hover {
        padding-left: 16px;
    }
}

/* ====================================
   DESKTOP (1024px+)
   ==================================== */

@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
        padding: 40px;
    }
    
    .content-wrapper {
        padding: 30px;
    }
    
    h1 {
        font-size: 2.5rem; /* 40px */
    }
    
    .subtitle {
        font-size: 1rem; /* 16px */
        padding: 8px 28px;
    }
    
    /* Two-column layout for forms */
    .form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    
    .form-row-3 {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 20px;
    }
}

/* ====================================
   PRINT STYLES
   ==================================== */

@media print {
    .no-print,
    nav,
    button,
    .btn {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .container {
        box-shadow: none;
        max-width: 100%;
    }
}

/* ====================================
   ACCESSIBILITY
   ==================================== */

/* Focus visible for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid #007bff;
    outline-offset: 2px;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

