/* 
 * IBCT Certification Calculator - Responsive Styles
 * This file adds responsive behavior to all templates
 */

/* Base responsive rules */
* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

/* Force some classes to respect responsiveness */
.ibct-certification-form-wrapper,
.ibct-certification-results-wrapper,
.ibct-centers-directory-wrapper,
.ibct-modal-content,
.ibct-card,
.ibct-form {
    max-width: 100% !important;
}

/* Global responsive containers */
.ibct-certification-form-wrapper,
.ibct-certification-results-wrapper,
.ibct-centers-directory-wrapper {
    width: 100%;
    padding: 0 15px;
    overflow-x: hidden;
}

/* Modal responsiveness */
@media screen and (max-width: 768px) {
    .ibct-modal-content {
        width: 95%;
        max-width: 95%;
        margin: 10px auto;
        padding: 15px;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
        border-radius: 8px;
    }

    .ibct-modal-header {
        padding-bottom: 12px;
        border-bottom: 2px solid #007cba;
        margin-bottom: 15px;
    }

    .ibct-modal-header h2,
    .ibct-modal-header h3 {
        font-size: 18px;
        margin: 0;
        color: #007cba;
    }

    .ibct-modal-close {
        position: absolute !important;
        top: 10px !important;
        right: 15px !important;
        font-size: 24px !important;
        width: 32px !important;
        height: 32px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        background: rgba(0, 0, 0, 0.1) !important;
        color: #666 !important;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .ibct-modal-close:hover {
        background: rgba(0, 0, 0, 0.2) !important;
        color: #333 !important;
    }

    .ibct-modal-body {
        padding: 0;
        font-size: 14px;
        line-height: 1.5;
    }

    .ibct-modal-buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        margin-top: 20px !important;
        padding-top: 15px !important;
        border-top: 1px solid #eee;
    }

    .ibct-modal-buttons .ibct-btn {
        width: 100% !important;
        margin: 0 !important;
        padding: 12px !important;
        font-size: 16px !important;
        border-radius: 6px !important;
    }

    /* Import/Export modal specific styling */
    .ibct-import-area {
        margin: 15px 0 !important;
    }

    .ibct-import-area textarea {
        width: 100% !important;
        min-height: 120px !important;
        font-size: 14px !important;
        padding: 10px !important;
        border-radius: 4px !important;
        resize: vertical;
    }

    .ibct-import-area input[type="file"] {
        width: 100% !important;
        padding: 10px !important;
        border: 2px dashed #007cba !important;
        border-radius: 6px !important;
        background: rgba(0, 124, 186, 0.05) !important;
        text-align: center;
        cursor: pointer;
    }

    /* Progress indicators on mobile */
    .ibct-progress-container {
        margin: 15px 0;
    }

    .ibct-progress-bar {
        width: 100%;
        height: 8px;
        background: #e9ecef;
        border-radius: 4px;
        overflow: hidden;
    }

    .ibct-progress-fill {
        height: 100%;
        background: linear-gradient(90deg, #007cba 0%, #005177 100%);
        transition: width 0.3s ease;
        border-radius: 4px;
    }
}
}

.ibct-file-upload-container {
    padding: 15px;
}

/* Center cards responsive layout */
.ibct-centers-grid {
    grid-template-columns: 1fr;
}

.ibct-center-card {
    padding: 15px;
}

.ibct-center-actions {
    flex-direction: column;
    gap: 10px;
}

.ibct-center-actions .ibct-btn {
    width: 100%;
    margin-right: 0;
}
}

/* Responsive navigation breadcrumbs */
@media screen and (max-width: 768px) {
    .ibct-navigation-breadcrumbs {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .ibct-nav-actions {
        width: 100%;
        margin-top: 10px;
        margin-left: 0;
    }

    .ibct-new-assessment-btn {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
        text-align: center;
    }
}

/* Responsive form elements */
@media screen and (max-width: 768px) {
    .ibct-form-header {
        flex-direction: column;
        align-items: stretch;
    }

    .ibct-form-group {
        width: 100%;
        margin-bottom: 15px;
    }

    .ibct-form input[type="text"],
    .ibct-form input[type="date"],
    .ibct-form input[type="email"],
    .ibct-form select,
    .ibct-form textarea {
        width: 100%;
        max-width: 100%;
        padding: 12px;
        font-size: 16px;
        /* Prevent zoom on iOS */
        border-radius: 6px;
    }

    /* Enhanced mobile form layout for assessment criteria */
    .ibct-sub-criterion {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 15px 10px !important;
        border-bottom: 1px solid #e5e5e5 !important;
        background: #fafafa;
        margin-bottom: 8px;
        border-radius: 6px;
        border: 1px solid #e5e5e5 !important;
    }

    .ibct-sub-criterion:last-child {
        border-bottom: 1px solid #e5e5e5 !important;
        margin-bottom: 0;
    }

    .ibct-sub-criterion-info {
        flex: none !important;
        min-width: auto !important;
        width: 100% !important;
        padding-right: 0 !important;
        margin-bottom: 12px;
        order: 1;
    }

    .ibct-sub-criterion-no {
        display: inline-block;
        background: #007cba;
        color: white;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        font-weight: 600;
        margin-right: 8px;
        margin-bottom: 6px;
    }

    .ibct-sub-criterion-name {
        display: block;
        font-weight: 500;
        color: #333;
        line-height: 1.4;
        word-wrap: break-word;
    }

    .ibct-rating-selector {
        flex: none !important;
        min-width: auto !important;
        width: 100% !important;
        order: 2;
    }

    .ibct-rating-select {
        width: 100% !important;
        padding: 12px 10px !important;
        font-size: 16px !important;
        border: 2px solid #ddd !important;
        border-radius: 6px !important;
        background-color: white;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23666' d='M2 0L0 2h4zm0 5L0 3h4z'/></svg>");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 12px;
        padding-right: 40px;
    }

    .ibct-rating-select:focus {
        border-color: #007cba !important;
        box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2) !important;
        outline: none !important;
    }

    /* Criterion sections mobile optimization */
    .ibct-criterion-section {
        margin-bottom: 25px !important;
        border-radius: 8px !important;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .ibct-criterion-header {
        padding: 15px !important;
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
        border-bottom: 2px solid #007cba;
    }

    .ibct-criterion-header h3 {
        font-size: 16px !important;
        margin: 0 0 5px 0 !important;
        color: #333 !important;
        line-height: 1.3;
    }

    .ibct-criterion-weight {
        font-size: 13px !important;
        color: #666 !important;
        background: #007cba;
        color: white !important;
        padding: 3px 8px;
        border-radius: 12px;
        display: inline-block;
        margin-top: 5px;
    }

    .ibct-criterion-items {
        padding: 8px !important;
        background: white;
    }

    /* Essential criteria highlighting for mobile */
    .essential-marker {
        background: #d32f2f !important;
        color: white !important;
        padding: 2px 6px !important;
        border-radius: 3px !important;
        font-size: 11px !important;
        font-weight: bold !important;
        margin-left: 6px;
        display: inline-block;
    }

    /* Form instructions mobile optimization */
    .ibct-form-instructions {
        padding: 12px !important;
        font-size: 14px !important;
        border-radius: 6px !important;
        border-left: 4px solid #007cba;
    }

    .ibct-form-instructions h3 {
        font-size: 16px !important;
        margin-bottom: 8px !important;
    }

    .ibct-form-instructions ul {
        margin-left: 16px !important;
        padding-left: 0 !important;
    }

    .ibct-form-instructions li {
        margin-bottom: 6px !important;
        line-height: 1.4 !important;
    }
}

/* Extra small devices (phones, 480px and down) */
@media screen and (max-width: 480px) {

    .ibct-certification-form-wrapper,
    .ibct-certification-results-wrapper,
    .ibct-centers-directory-wrapper {
        padding: 0 8px;
    }

    h2, h3 {
        font-size: 1.3em;
    }

    .ibct-form {
        padding: 12px;
        margin: 0;
        border-radius: 8px;
    }

    /* Enhanced mobile form actions */
    .ibct-form-actions {
        flex-direction: column !important;
        gap: 15px !important;
        padding: 15px 0 !important;
        position: sticky;
        bottom: 0;
        background: white;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        margin: 20px -12px -12px -12px;
        padding: 15px 12px !important;
        border-radius: 0 0 8px 8px;
    }

    .ibct-completion-status {
        order: 1;
        width: 100% !important;
        text-align: center;
        margin-bottom: 10px;
    }

    .ibct-completion-label {
        font-size: 14px !important;
        font-weight: 600;
        color: #333;
        display: block;
        margin-bottom: 8px;
    }

    .ibct-completion-bar {
        width: 100% !important;
        height: 8px !important;
        background: #e9ecef !important;
        border-radius: 4px !important;
        overflow: hidden;
        margin-bottom: 5px;
    }

    .ibct-completion-progress {
        height: 100% !important;
        background: linear-gradient(90deg, #28a745 0%, #20c997 100%) !important;
        transition: width 0.3s ease !important;
        border-radius: 4px;
    }

    .ibct-completion-percentage {
        font-size: 13px !important;
        font-weight: 600 !important;
        color: #007cba;
    }

    .ibct-btn,
    .ibct-action-btn,
    button.ibct-export-assessment,
    button.ibct-import-assessment,
    button.ibct-export-excel,
    .ibct-submit-btn {
        width: 100% !important;
        padding: 14px 16px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        border-radius: 6px !important;
        margin: 0 !important;
        order: 2;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        transition: all 0.2s ease;
    }

    .ibct-btn-primary {
        background: linear-gradient(135deg, #007cba 0%, #005177 100%) !important;
        border: none !important;
        color: white !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }

    .ibct-btn-primary:hover:not(:disabled) {
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    }

    .ibct-btn-primary:disabled {
        background: #6c757d !important;
        cursor: not-allowed;
        opacity: 0.6;
    }

    /* Navigation breadcrumbs mobile */
    .ibct-navigation-breadcrumbs {
        flex-wrap: wrap !important;
        font-size: 13px !important;
        padding: 8px 0 !important;
        margin-bottom: 15px !important;
    }

    .ibct-breadcrumb-item,
    .ibct-breadcrumb-current {
        word-break: break-word;
    }

    /* Preliminary results mobile */
    .ibct-results-preview {
        background: #f8f9fa !important;
        border: 2px solid #007cba !important;
        border-radius: 8px !important;
        padding: 15px !important;
        margin-top: 20px !important;
    }

    .ibct-results-preview h3 {
        color: #007cba !important;
        margin-bottom: 12px !important;
        text-align: center;
        font-size: 16px !important;
    }

    .ibct-result-item {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 8px 0 !important;
        border-bottom: 1px solid #dee2e6;
        font-size: 14px !important;
    }

    .ibct-result-item:last-child {
        border-bottom: none;
    }

    .ibct-result-label {
        font-weight: 600 !important;
        color: #495057;
    }

    .ibct-result-value {
        font-weight: 700 !important;
        color: #007cba;
    }

    /* Criteria container mobile spacing */
    .ibct-criteria-container {
        margin-bottom: 20px !important;
    }

    /* Sub-criterion enhanced mobile styling */
    .ibct-sub-criterion {
        border-left: 4px solid transparent !important;
        transition: all 0.2s ease;
    }

    .ibct-sub-criterion:hover {
        border-left-color: #007cba !important;
        background: #f8f9fa !important;
    }

    /* Rating visual feedback */
    .ibct-rating-select.rating-exceeds {
        border-color: #28a745 !important;
        background-color: rgba(40, 167, 69, 0.05) !important;
    }

    .ibct-rating-select.rating-meets {
        border-color: #007bff !important;
        background-color: rgba(0, 123, 255, 0.05) !important;
    }

    .ibct-rating-select.rating-developing {
        border-color: #ffc107 !important;
        background-color: rgba(255, 193, 7, 0.05) !important;
    }

    .ibct-rating-select.rating-non-compliant {
        border-color: #dc3545 !important;
        background-color: rgba(220, 53, 69, 0.05) !important;
    }

    /* Essential criteria warning */
    .ibct-sub-criterion.essential-warning {
        border-left-color: #dc3545 !important;
        background: rgba(220, 53, 69, 0.05) !important;
    }

    .ibct-form {
        padding: 15px;
        margin: 0;
        width: 100%;
    }

    .ibct-criterion-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ibct-criterion-stats {
        margin-top: 10px;
        width: 100%;
    }

    .ibct-rating-options {
        flex-direction: column;
        align-items: flex-start;
    }

    .ibct-rating-option {
        margin: 5px 0;
        width: 100%;
    }

    .ibct-action-buttons {
        flex-direction: column;
        width: 100%;
    }

    /* Fix mobile view of sub-criteria */
    .ibct-subcriteria-item {
        padding: 10px;
    }

    .ibct-subcriteria-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Responsive tables */
@media screen and (max-width: 768px) {

    /* General table styles - don't make these scroll horizontally */
    .ibct-table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: visible;
        white-space: normal;
        border: none;
    }

    /* Convert tables to cards on mobile */
    .ibct-summary-table,
    .ibct-centers-table,
    .ibct-results-table,
    .ibct-criterion-table,
    .ibct-eligibility-table {
        border: none;
        margin-bottom: 30px;
    }

    .ibct-summary-table thead,
    .ibct-centers-table thead,
    .ibct-results-table thead,
    .ibct-criterion-table thead,
    .ibct-eligibility-table thead {
        display: none;
        /* Hide table headers on mobile */
    }

    /* Apply to all key tables */
    .ibct-summary-table tbody,
    .ibct-centers-table tbody,
    .ibct-results-table tbody,
    .ibct-criterion-table tbody,
    .ibct-eligibility-table tbody,
    .ibct-summary-table tfoot,
    .ibct-centers-table tfoot,
    .ibct-results-table tfoot,
    .ibct-criterion-table tfoot,
    .ibct-eligibility-table tfoot,
    .ibct-summary-table tr,
    .ibct-centers-table tr,
    .ibct-results-table tr,
    .ibct-criterion-table tr,
    .ibct-eligibility-table tr {
        display: block;
        width: 100%;
    }

    .ibct-summary-table tr,
    .ibct-centers-table tr,
    .ibct-results-table tr,
    .ibct-criterion-table tr,
    .ibct-eligibility-table tr {
        margin-bottom: 15px;
        border: 1px solid #e5e5e5;
        border-radius: 5px;
        padding: 8px;
        background: #f9f9f9;
        width: 100%;
        display: block;
        box-sizing: border-box;
    }

    .ibct-summary-table td,
    .ibct-centers-table td,
    .ibct-results-table td,
    .ibct-criterion-table td,
    .ibct-eligibility-table td {
        display: flex;
        justify-content: space-between;
        text-align: right;
        padding: 10px 8px;
        border-bottom: 1px solid #eee;
        width: 100%;
        box-sizing: border-box;
        align-items: center;
        min-height: 40px;
    }

    /* Handle wrapping of content */
    .ibct-summary-table td>*,
    .ibct-centers-table td>*,
    .ibct-results-table td>*,
    .ibct-criterion-table td>*,
    .ibct-eligibility-table td>* {
        max-width: 60%;
        word-break: break-word;
        white-space: normal;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    /* Make success/danger text more visible */
    .text-success {
        color: #2e7d32 !important;
        font-weight: bold;
    }

    .text-danger {
        color: #d32f2f !important;
        font-weight: bold;
    }

    .ibct-summary-table td:last-child,
    .ibct-centers-table td:last-child,
    .ibct-results-table td:last-child,
    .ibct-criterion-table td:last-child,
    .ibct-eligibility-table td:last-child {
        border-bottom: none;
    }

    .ibct-summary-table td:before,
    .ibct-centers-table td:before,
    .ibct-results-table td:before,
    .ibct-criterion-table td:before,
    .ibct-eligibility-table td:before {
        content: attr(data-label);
        font-weight: bold;
        float: left;
        text-align: left;
        padding-right: 10px;
        max-width: 40%;
        word-break: break-word;
    }

    /* Make footer rows stand out */
    .ibct-summary-table tfoot tr,
    .ibct-centers-table tfoot tr,
    .ibct-results-table tfoot tr,
    .ibct-criterion-table tfoot tr,
    .ibct-eligibility-table tfoot tr {
        background-color: #f0f7ff;
        border: 1px solid #cfe3ff;
        font-weight: bold;
    }

    .ibct-summary-table tfoot td,
    .ibct-centers-table tfoot td,
    .ibct-results-table tfoot td,
    .ibct-criterion-table tfoot td,
    .ibct-eligibility-table tfoot td {
        border-bottom: none;
    }
}

/* Extra small devices - Improve table readability */
@media screen and (max-width: 480px) {

    /* Make table styles more compact */
    .ibct-summary-table td,
    .ibct-centers-table td,
    .ibct-results-table td,
    .ibct-criterion-table td,
    .ibct-eligibility-table td {
        padding: 8px 5px;
        flex-wrap: wrap;
    }

    /* Show data labels on their own line for very small screens */
    .ibct-summary-table td:before,
    .ibct-centers-table td:before,
    .ibct-results-table td:before,
    .ibct-criterion-table td:before,
    .ibct-eligibility-table td:before {
        width: 100%;
        max-width: 100%;
        margin-bottom: 5px;
        display: block;
    }

    .ibct-summary-table td>*,
    .ibct-centers-table td>*,
    .ibct-results-table td>*,
    .ibct-criterion-table td>*,
    .ibct-eligibility-table td>* {
        max-width: 100%;
        width: 100%;
        text-align: left;
    }

    /* Improve spacing in the criterion table */
    .ibct-criterion-table tr {
        margin-bottom: 20px;
    }

    /* Adjust spacing in star rating display */
    .ibct-star-rating-value {
        flex-direction: column;
        gap: 8px;
    }

    /* Improve spacing for table headings */
    .ibct-certification-results-wrapper h3 {
        margin-top: 25px;
        padding-bottom: 10px;
        border-bottom: 1px solid #eee;
    }

    /* Add print button style improvements */
    #ibct-print-results {
        margin-top: 15px;
    }
}

/* Responsive results layout - hide desktop header on mobile, show cards */
@media screen and (max-width: 768px) {
    .ibct-results-header {
        display: none !important;
    }

    .ibct-results-mobile-cards {
        display: block !important;
    }

    .ibct-results-desktop-tables {
        display: none !important;
    }

    .ibct-stars {
        display: flex;
        gap: 3px;
    }

    .ibct-star {
        font-size: 28px;
    }

    .ibct-overall-score,
    .ibct-essential-criteria {
        margin: 5px 0;
        padding: 8px;
        border-radius: 5px;
        width: 100%;
        text-align: center;
    }

    .ibct-essential-criteria.met {
        background-color: rgba(76, 175, 80, 0.1);
        color: #2e7d32;
    }

    .ibct-essential-criteria.not-met {
        background-color: rgba(244, 67, 54, 0.1);
        color: #d32f2f;
    }

    .ibct-results-content {
        flex-direction: column;
        gap: 20px;
    }

    .ibct-criteria-breakdown {
        width: 100%;
    }

    .ibct-results-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
    }

    .ibct-results-actions .ibct-btn {
        margin: 0;
    }
}

/* Desktop view - show desktop elements, hide mobile cards */
@media screen and (min-width: 769px) {
    .ibct-results-header {
        display: flex !important;
    }

    .ibct-results-mobile-cards {
        display: none !important;
    }

    .ibct-results-desktop-tables {
        display: block !important;
    }
}

/* Responsive center cards */
@media screen and (max-width: 992px) {
    .ibct-centers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 576px) {
    .ibct-centers-grid {
        grid-template-columns: 1fr;
    }

    .ibct-center-card {
        display: block;
    }

    .ibct-center-name,
    .ibct-center-meta,
    .ibct-center-rating {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }

    .ibct-filter-row {
        flex-direction: column;
        gap: 10px;
    }

    .ibct-filter-field {
        width: 100%;
    }
}

/* Mobile optimized buttons */
@media screen and (max-width: 768px) {
    .ibct-btn {
        display: block;
        width: 100%;
        text-align: center;
        margin: 5px 0;
    }

    .ibct-btn+.ibct-btn {
        margin-left: 0;
    }
}

/* Responsive completion status */
@media screen and (max-width: 576px) {
    .ibct-completion-status {
        flex-direction: column;
        align-items: flex-start;
    }

    .ibct-completion-percentage {
        margin-bottom: 5px;
    }
}

/* Export/Import buttons container */
.ibct-export-import-container {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

@media screen and (max-width: 768px) {
    .ibct-export-import-container {
        flex-direction: column;
        width: 100%;
        gap: 10px;
        margin: 15px 0;
    }

    .ibct-export-import-container button {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }
}

/* Modal styles for import/export */
.ibct-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.ibct-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 20px;
    border-radius: 6px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
}

.ibct-modal-header {
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}

.ibct-modal-header h3 {
    margin: 0 0 5px 0;
}

.ibct-modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.ibct-modal-close:hover {
    color: #333;
}

/* Modern Card Styles for Results Page Mobile View */
@media screen and (max-width: 768px) {
    .ibct-results-mobile-cards {
        display: block;
    }

    .ibct-results-desktop-tables {
        display: none;
    }

    .ibct-card {
        background: #ffffff;
        border-radius: 12px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        margin-bottom: 16px;
        padding: 20px;
        border: 1px solid #e5e7eb;
        transition: box-shadow 0.3s ease;
    }

    .ibct-card:hover {
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    }

    .ibct-card-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 16px;
        padding-bottom: 12px;
        border-bottom: 2px solid #f3f4f6;
    }

    .ibct-card-title {
        font-size: 18px;
        font-weight: 600;
        color: #1f2937;
        margin: 0;
    }

    .ibct-card-badge {
        background: #3b82f6;
        color: white;
        padding: 4px 12px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 500;
    }

    .ibct-card-badge.success {
        background: linear-gradient(135deg, #10b981, #059669);
        color: white;
    }

    .ibct-card-badge.warning {
        background: linear-gradient(135deg, #f59e0b, #d97706);
        color: white;
    }

    .ibct-card-badge.danger {
        background: #ef4444;
    }

    .ibct-card-content {
        display: grid;
        gap: 12px;
    }

    .ibct-card-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
    }

    .ibct-card-label {
        font-weight: 500;
        color: #6b7280;
        font-size: 14px;
    }

    .ibct-card-value {
        font-weight: 600;
        color: #1f2937;
        font-size: 14px;
        text-align: right;
    }

    .ibct-star-rating-card {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        text-align: center;
    }

    .ibct-star-rating-card .ibct-card-title {
        color: white;
        font-size: 20px;
    }

    .ibct-star-rating-value {
        font-size: 48px;
        font-weight: bold;
        margin: 16px 0;
    }

    .ibct-stars {
        font-size: 24px;
        margin: 8px 0;
        text-align: center;
        justify-content: center;
        display: flex;
    }

    .ibct-overall-score {
        font-size: 18px;
        margin-top: 12px;
        opacity: 0.9;
    }
}

@media screen and (min-width: 769px) {
    .ibct-results-mobile-cards {
        display: none;
    }

    .ibct-results-desktop-tables {
        display: block;
    }
}

/* Breathing space for results sections */
.ibct-certification-results-wrapper {
    margin-bottom: 40px;
}

.ibct-results-header {
    margin-bottom: 40px;
}

.ibct-criterion-performance {
    margin-bottom: 40px;
}

.ibct-star-eligibility {
    margin-bottom: 40px;
}

.ibct-results-actions {
    margin-top: 40px;
    margin-bottom: 60px;
}

/* Desktop breathing space */
@media screen and (min-width: 769px) {
    .ibct-results-desktop-tables {
        margin-bottom: 40px;
    }
}

/* Mobile star rating card improvements */
@media screen and (max-width: 768px) {
    .ibct-star-rating-card {
        text-align: center;
    }

    .ibct-star-rating-card .ibct-card-content,
    .ibct-star-rating-card .ibct-star-rating-value,
    .ibct-star-rating-card .ibct-overall-score,
    .ibct-star-rating-card .ibct-essential-criteria {
        text-align: center;
    }

    .ibct-star-rating-card .ibct-stars .ibct-star.filled {
        color: #ffc107;
    }

    .ibct-star-rating-card .ibct-stars .ibct-star.empty {
        color: rgba(255, 193, 7, 0.3);
    }

    /* Mobile breathing space */
    .ibct-results-mobile-cards {
        margin-bottom: 40px;
    }

    .ibct-results-mobile-cards:last-child {
        margin-bottom: 40px;
    }
}

/* Very small screens (320px and below) */
@media screen and (max-width: 320px) {

    .ibct-certification-form-wrapper,
    .ibct-certification-results-wrapper,
    .ibct-centers-directory-wrapper {
        padding: 0 5px;
    }

    .ibct-form {
        padding: 8px !important;
        margin: 0;
    }

    .ibct-criterion-items {
        padding: 5px !important;
    }

    .ibct-sub-criterion {
        .ibct-sub-criterion {
            padding: 12px 8px !important;
            margin-bottom: 6px;
        }

        .ibct-criterion-header {
            padding: 12px !important;
        }

        .ibct-criterion-header h3 {
            font-size: 14px !important;
            line-height: 1.2;
        }

        .ibct-sub-criterion-name {
            font-size: 13px !important;
        }

        .ibct-rating-select {
            padding: 10px 8px !important;
            font-size: 15px !important;
            padding-right: 35px !important;
        }

        .ibct-form-actions {
            padding: 12px 8px !important;
            margin: 15px -8px -8px -8px !important;
        }
    }

    /* Mobile landscape optimization */
    @media screen and (max-height: 500px) and (orientation: landscape) {
        .ibct-form-actions {
            position: relative !important;
            box-shadow: none !important;
            margin: 15px 0 0 0 !important;
            padding: 10px 0 !important;
        }

        .ibct-criterion-section {
            margin-bottom: 15px !important;
        }

        .ibct-sub-criterion {
            padding: 10px 8px !important;
            margin-bottom: 5px !important;
        }

        .ibct-criterion-header {
            padding: 10px !important;
        }

        .ibct-results-preview {
            margin-top: 10px !important;
            padding: 10px !important;
        }
    }

    /* Touch device improvements */
    @media (hover: none) and (pointer: coarse) {
        .ibct-rating-select {
            min-height: 44px !important;
            /* Apple's recommended touch target size */
            touch-action: manipulation;
        }

        .ibct-btn,
        .ibct-action-btn,
        button {
            min-height: 44px !important;
            touch-action: manipulation;
        }

        .ibct-sub-criterion {
            padding: 16px 10px !important;
            /* Larger touch targets */
        }

        /* Disable hover effects on touch devices */
        .ibct-sub-criterion:hover {
            border-left-color: transparent !important;
            background: #fafafa !important;
        }
    }

    /* High DPI display adjustments */
    @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
        .ibct-rating-select {
            background-size: 14px !important;
        }

        .ibct-completion-bar {
            height: 10px !important;
        }
    }