/**
 * Yamaha Warranty Cases Plugin Styles
 *
 * @package Yamaha_Warranty_Cases
 */

.yamaha-warranty-cases-container,
.yamaha-dealer-dashboard-container {
    max-width: 1200px;
    margin: 20px 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* Header Section */
.yamaha-warranty-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.yamaha-warranty-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.75rem;
    font-weight: 600;
}

.yamaha-warranty-header #create-case-btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Filters Section */
.yamaha-warranty-filters {
    background: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
}

.yamaha-warranty-filters .form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 8px;
}

.yamaha-warranty-filters .form-select,
.yamaha-warranty-filters .form-control {
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.yamaha-warranty-filters .form-select:focus,
.yamaha-warranty-filters .form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* DataTable Content Section */
.yamaha-warranty-content,
.yamaha-dealer-content {
    overflow-x: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* DataTable Customization */
#warranty-cases-table,
#dealer-cases-table {
    width: 100% !important;
}

#warranty-cases-table thead th,
#dealer-cases-table thead th {
    background-color: #495057;
    color: #fff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    padding: 12px 8px;
    border-bottom: 2px solid #dee2e6;
}

#warranty-cases-table tbody td,
#dealer-cases-table tbody td {
    padding: 12px 8px;
    vertical-align: middle;
}

#warranty-cases-table tbody tr:hover,
#dealer-cases-table tbody tr:hover {
    background-color: #f1f3f5;
}

/* Status Badges */
.badge {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
}

.badge.bg-warning {
    background-color: #ffc107 !important;
    color: #000;
}

.badge.bg-success {
    background-color: #28a745 !important;
}

.badge.bg-danger {
    background-color: #dc3545 !important;
}

.badge.bg-info {
    background-color: #17a2b8 !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

/* Action Buttons */
.btn-group-sm .btn {
    padding: 4px 8px;
    font-size: 0.875rem;
}

.btn-info {
    background-color: #17a2b8;
    border-color: #17a2b8;
}

.btn-info:hover {
    background-color: #138496;
    border-color: #117a8b;
}

.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #000;
}

.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
    color: #000;
}

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

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* DataTables Controls */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 15px;
}

.dataTables_wrapper .dataTables_length select {
    padding: 4px 8px;
    margin: 0 5px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 6px 12px;
    margin-left: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.dataTables_wrapper .dataTables_info {
    padding-top: 15px;
    font-size: 0.875rem;
    color: #6c757d;
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 15px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 5px 10px;
    margin: 0 2px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #0d6efd;
    color: #fff !important;
    border-color: #0d6efd;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #6c757d !important;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .yamaha-warranty-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .yamaha-warranty-header #create-case-btn {
        width: 100%;
        justify-content: center;
    }

    .yamaha-warranty-filters .row {
        gap: 15px 0;
    }

    #warranty-cases-table {
        font-size: 0.875rem;
        /* Force table to auto-distribute column widths on mobile */
        table-layout: auto !important;
        width: 100% !important;
    }

    /* Override DataTables fixed column widths - let columns auto-size on mobile */
    #warranty-cases-table thead th,
    #warranty-cases-table tbody td {
        padding: 8px 4px;
        width: auto !important;
    }

    /* Give title column more space since it has the most content */
    #warranty-cases-table thead th:nth-child(2),
    #warranty-cases-table tbody td:nth-child(2) {
        width: 50% !important;
    }

    /* Customer name gets moderate space */
    #warranty-cases-table thead th:nth-child(3),
    #warranty-cases-table tbody td:nth-child(3) {
        width: 35% !important;
    }

    /* Actions column - compact, just Open button now */
    #warranty-cases-table thead th:nth-child(6),
    #warranty-cases-table tbody td:nth-child(6) {
        width: 15% !important;
        text-align: center;
    }

    /* Hide Case ID and Created Date columns on mobile - keep Actions visible! */
    #warranty-cases-table thead th:nth-child(1),
    #warranty-cases-table tbody td:nth-child(1),
    #warranty-cases-table thead th:nth-child(5),
    #warranty-cases-table tbody td:nth-child(5) {
        display: none;
    }

    /* Compact action button on mobile */
    #warranty-cases-table .btn-sm {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
}

/* Extra mobile optimizations for small phones */
@media (max-width: 480px) {
    /* Reduce container padding on very small screens */
    .yamaha-warranty-cases-container,
    .yamaha-dealer-dashboard-container {
        margin: 10px 0;
    }

    /* Smaller table text */
    #warranty-cases-table {
        font-size: 0.8rem;
    }

    #warranty-cases-table thead th,
    #warranty-cases-table tbody td {
        padding: 6px 3px;
    }

    /* Also hide Service Dealer column on very small screens */
    #warranty-cases-table thead th:nth-child(4),
    #warranty-cases-table tbody td:nth-child(4) {
        display: none;
    }

    /* More compact action button */
    #warranty-cases-table .btn-sm {
        padding: 3px 6px;
        font-size: 0.7rem;
    }
}

/* Loading State */
.rlm-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-style: italic;
}

/* Empty State */
.dataTables_empty {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-style: italic;
}

/* Success Alert */
.yamaha-success-alert {
    margin: 20px 0;
    border-radius: 6px;
}

/* Toast Notification Styles */
.toast {
    min-width: 250px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.text-bg-success {
    background-color: #28a745 !important;
    color: #fff !important;
}

.toast.text-bg-danger {
    background-color: #dc3545 !important;
    color: #fff !important;
}

.toast.text-bg-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
}

.toast.text-bg-info {
    background-color: #17a2b8 !important;
    color: #fff !important;
}

.toast-body {
    padding: 12px 16px;
    font-size: 0.9375rem;
    font-weight: 500;
}

.toast .btn-close {
    opacity: 0.7;
}

.toast .btn-close:hover {
    opacity: 1;
}

/* Create/Edit Form Styles */
.yamaha-warranty-form-container {
    max-width: 1200px;
    margin: 20px 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.yamaha-warranty-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.yamaha-warranty-form-header .header-title-group {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    min-width: 0;
}

.yamaha-warranty-form-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.75rem;
    font-weight: 600;
}

/* Mobile responsive header */
@media (max-width: 576px) {
    .yamaha-warranty-form-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px;
    }

    .yamaha-warranty-form-header .header-title-group {
        width: 100%;
        gap: 10px;
    }

    .yamaha-warranty-form-header h2 {
        font-size: 1.25rem;
        word-break: break-word;
    }

    /* Hide date on narrow mobile */
    .yamaha-warranty-form-header #caseCreatedDate {
        display: none;
    }

    /* Stack flag/region on its own line */
    .yamaha-warranty-form-header .submission-region-flag {
        margin-left: 0 !important;
        width: 100%;
    }

    .yamaha-warranty-form-header .btn {
        width: 100%;
        justify-content: center;
    }
}

.yamaha-warranty-form-content {
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.section-heading {
    color: #495057;
    font-weight: 600;
    margin-top: 25px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.section-heading:first-of-type {
    margin-top: 15px;
}

.form-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

/* Form Validation Styles */
.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 6px;
}

.form-label .text-danger {
    margin-left: 2px;
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: #28a745;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.invalid-feedback {
    display: none;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #dc3545;
}

.form-control.is-invalid ~ .invalid-feedback,
.form-select.is-invalid ~ .invalid-feedback {
    display: block;
}

/* Form Input Focus Styles */
.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Textarea Resize */
textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Issue Description Textarea - Enhanced visibility */
.issue-description-textarea {
    background-color: #fffbf0 !important; /* Light cream/yellow - industry standard for notes */
    transition: background-color 0.2s ease;
}

.issue-description-textarea:focus {
    background-color: #fffaeb !important; /* Slightly more saturated on focus */
}

/* Loading Spinner on Submit Button */
#submitCaseBtn .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
    margin-left: 8px;
}

#submitCaseBtn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Loading Overlay */
.yamaha-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.yamaha-loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Service Dealer Enhanced Dropdown Styles */
.service-dealer-dropdown {
    position: relative;
}

.service-dealer-dropdown .dropdown-toggle {
    cursor: pointer;
}

.service-dealer-dropdown .dropdown-menu {
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #dee2e6;
}

.service-dealer-list {
    max-height: 300px;
    overflow-y: auto;
}

.service-dealer-dropdown .dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.service-dealer-dropdown .dropdown-item:hover {
    background-color: #f8f9fa;
}

.service-dealer-dropdown .dropdown-item:active {
    background-color: #e9ecef;
    color: #212529;
}

.service-dealer-dropdown .dropdown-divider {
    margin: 0.25rem 0;
}

/* Dropdown loading state */
#serviceDealerLoading {
    text-align: center;
    color: #6c757d;
}

#serviceDealerNoResults {
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

/* Scrollbar styling for dropdown */
.service-dealer-list::-webkit-scrollbar {
    width: 8px;
}

.service-dealer-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.service-dealer-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.service-dealer-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Form Responsive Design */
@media (max-width: 768px) {
    .yamaha-warranty-form-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .yamaha-warranty-form-content {
        padding: 10px;
    }

    .form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .form-actions .btn {
        width: 100%;
    }

    .service-dealer-dropdown .dropdown-menu {
        max-height: 300px;
    }

    .service-dealer-list {
        max-height: 200px;
    }
}


/* ==========================================
   FILE UPLOAD INTERFACE STYLES - STAGE 1
   ========================================== */

/* File input styling */
#warrantyFiles {
    cursor: pointer;
}

#warrantyFiles:hover {
    border-color: #0d6efd;
}

/* File preview container */
.file-preview-container {
    margin-top: 20px;
}

.file-preview-container .card {
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.file-preview-container .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 12px 16px;
}

.file-preview-container .card-header h6 {
    color: #495057;
    font-weight: 600;
    margin: 0;
}

.file-preview-container .card-body {
    padding: 16px;
}

/* File preview list */
.file-preview-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Individual file preview item */
.file-preview-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.file-preview-item:hover {
    background: #e9ecef;
    border-color: #cbd3da;
}

.file-preview-icon {
    flex-shrink: 0;
    margin-right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview-info {
    flex-grow: 1;
    min-width: 0; /* Enables text truncation */
}

.file-preview-name {
    font-weight: 500;
    color: #212529;
    word-break: break-word;
    margin-bottom: 4px;
}

.file-preview-size {
    font-size: 0.875rem;
    color: #6c757d;
}

.file-preview-actions {
    flex-shrink: 0;
    margin-left: 12px;
}

/* Remove file button */
.remove-file-btn {
    padding: 4px 8px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-file-btn i {
    font-size: 1.25rem;
}

/* Upload progress container */
.upload-progress-container {
    margin-top: 20px;
}

.upload-progress-container .card {
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.upload-progress-container .card-header {
    background-color: #e3f2fd;
    border-bottom: 1px solid #90caf9;
    padding: 12px 16px;
}

.upload-progress-container .card-header h6 {
    color: #1976d2;
    font-weight: 600;
    margin: 0;
}

.upload-progress-container .card-body {
    padding: 16px;
}

/* Upload progress items */
.upload-progress-item {
    margin-bottom: 16px;
}

.upload-progress-item:last-child {
    margin-bottom: 0;
}

.upload-progress-filename {
    font-weight: 500;
    color: #212529;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upload-progress-status {
    font-size: 0.875rem;
    color: #6c757d;
}

.upload-progress-status.success {
    color: #28a745;
}

.upload-progress-status.error {
    color: #dc3545;
}

/* Upload Progress Bar Styling */
#uploadProgressContainer .progress {
    height: 25px;
    border-radius: 6px;
    background-color: #e9ecef;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

#uploadProgressBar {
    font-size: 14px;
    font-weight: 500;
    transition: width 0.3s ease;
}

#uploadProgressText {
    font-size: 15px;
    font-weight: 500;
}

/* Progress bar styling */
.progress {
    height: 8px;
    border-radius: 4px;
    background-color: #e9ecef;
}

.progress-bar {
    background-color: #0d6efd;
    transition: width 0.3s ease;
}

.progress-bar.bg-success {
    background-color: #28a745 !important;
}

.progress-bar.bg-danger {
    background-color: #dc3545 !important;
}

/* File type icons colors */
.file-preview-icon .bi-file-image {
    color: #17a2b8 !important;
}

.file-preview-icon .bi-file-pdf {
    color: #dc3545 !important;
}

.file-preview-icon .bi-file-word {
    color: #2b579a !important;
}

.file-preview-icon .bi-file-excel {
    color: #217346 !important;
}

/* Responsive design for file uploads */
@media (max-width: 768px) {
    .file-preview-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .file-preview-icon {
        margin-right: 0;
        margin-bottom: 8px;
    }

    .file-preview-actions {
        margin-left: 0;
        width: 100%;
    }

    .remove-file-btn {
        width: 100%;
        justify-content: center;
    }

    .file-preview-name {
        font-size: 0.9375rem;
    }
}

/* Animation for file preview appearing */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-preview-item {
    animation: fadeInUp 0.3s ease;
}

/* Clear all files button */
#clearAllFiles {
    font-size: 0.875rem;
    padding: 4px 12px;
}

#clearAllFiles:hover {
    background-color: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

/* Existing Files Display - Card Grid Layout */
.existing-files-container {
    margin-bottom: 1.5rem;
}

.existing-files-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    max-width: 100%;
}

.existing-file-item {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    background-color: #f8f9fa;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 0; /* Prevent grid items from overflowing */
}

.existing-file-item:hover {
    background-color: #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.existing-file-icon {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
    background-color: #fff;
    border-radius: 0.375rem;
    overflow: hidden;
}

/* Thumbnail image styling */
.existing-file-icon .file-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.existing-file-icon .file-thumbnail:hover {
    transform: scale(1.05);
    cursor: pointer;
}

.existing-file-icon .bi-file-pdf {
    color: #dc3545;
}

.existing-file-icon .bi-file-image,
.existing-file-icon .bi-image {
    color: #0d6efd;
}

.existing-file-icon .bi-file-word,
.existing-file-icon .bi-file-text {
    color: #2b579a;
}

.existing-file-icon .bi-file-excel,
.existing-file-icon .bi-file-spreadsheet {
    color: #217346;
}

.existing-file-icon .bi-file-earmark-text {
    color: #6c757d;
}

.existing-file-info {
    flex: 1;
    min-width: 0;
    margin-bottom: 0.5rem;
}

.existing-file-name {
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


.existing-file-actions {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid #dee2e6;
}

.existing-file-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.no-files-message {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
    grid-column: 1 / -1;
}

.no-files-message .bi {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Responsive: 3 columns for tablets */
@media (max-width: 992px) {
    .existing-files-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Responsive: 2 columns for small tablets */
@media (max-width: 576px) {
    .existing-files-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .existing-file-item {
        padding: 0.5rem;
    }

    .existing-file-icon {
        height: 80px;
        font-size: 2rem;
        margin-bottom: 0.25rem;
    }

    .existing-file-name {
        font-size: 0.75rem;
    }

    .existing-file-actions .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
}

/* Responsive: Compact grid for mobile screens */
@media (max-width: 480px) {
    .existing-files-list {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
        display: grid !important;
    }

    .existing-file-item {
        flex-direction: column;
        padding: 0.25rem;
    }

    .existing-file-icon {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
        margin-bottom: 0;
        font-size: 2rem;
        background-color: #f0f0f0;
    }

    .existing-file-icon .file-thumbnail {
        cursor: pointer;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    /* Hide filename on mobile - user can see it in modal */
    .existing-file-item .existing-file-info {
        display: none !important;
    }

    /* Hide action buttons on mobile - moved to modal */
    .existing-file-item .existing-file-actions {
        display: none !important;
    }
}

/**
 * ==========================================
 * REQUIREMENTS CHECKLIST STYLES
 * ==========================================
 */

/* Requirements Checklist Container */
.requirements-checklist {
    padding: 0.5rem 0;
}

/* Individual Requirement Item */
.requirement-item {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
    transition: background-color 0.2s ease;
}

.requirement-item:hover {
    background-color: #f1f3f5;
}

/* Requirement Label */
.requirement-label {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #495057;
    font-size: 0.95rem;
}

/* Requirement Label with Input (for "Other" section) */
.requirement-label-with-input {
    width: 100%;
    margin-bottom: 0.5rem;
}

.requirement-label-with-input .form-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.95rem;
}

/* Button Group Container */
.requirement-toggles {
    display: inline-flex;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Requirement Toggle Buttons */
.requirement-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
    background-color: #ffffff;
    color: #6c757d;
}

.requirement-btn:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
    z-index: 1;
}

.requirement-btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.25);
    z-index: 2;
}

/* Status Emoji Styling */
.status-emoji {
    font-size: 1rem;
    margin-right: 0.25rem;
    display: inline-block;
}

/* Active Button States */
.requirement-btn.active[data-status="done"] {
    background-color: #28a745;
    border-color: #28a745;
    color: #ffffff;
    font-weight: 600;
}

.requirement-btn.active[data-status="done"]:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.requirement-btn.active[data-status="incomplete"] {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
    font-weight: 600;
}

.requirement-btn.active[data-status="incomplete"]:hover {
    background-color: #e0a800;
    border-color: #d39e00;
}

.requirement-btn.active[data-status="na"] {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #ffffff;
    font-weight: 600;
}

.requirement-btn.active[data-status="na"]:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* Character Counter Styling */
#requirementOtherCounter {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

#requirementOtherCounter.text-warning {
    font-weight: 500;
}

#requirementOtherCounter.text-danger {
    font-weight: 600;
}

/* Responsive Layout */
@media (min-width: 768px) {
    .requirement-item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .requirement-label {
        margin-bottom: 0;
        flex: 1;
    }

    .requirement-label-with-input {
        flex: 1;
        margin-bottom: 0;
        margin-right: 1rem;
    }

    .requirement-toggles {
        flex-shrink: 0;
    }
}

@media (max-width: 767.98px) {
    .requirement-btn {
        flex: 1;
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
    }

    .status-emoji {
        font-size: 0.85rem;
        margin-right: 0.15rem;
    }
}

/* Extra small screens - keep buttons horizontal but make them more compact */
@media (max-width: 400px) {
    .requirement-btn {
        padding: 0.35rem 0.4rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .status-emoji {
        font-size: 0.8rem;
        margin-right: 0.1rem;
    }

    /* Make button text even more compact on very small screens */
    .requirement-toggles {
        width: 100%;
        justify-content: space-between;
    }
}

/* Card Header Styling (consistent with other sections) */
.card-header.bg-info {
    background-color: #0dcaf0 !important;
}

.card-header h5 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Input Field Styling within Checklist */
#requirementOtherText {
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#requirementOtherText:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Accessibility Improvements */
.requirement-btn:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .requirement-btn:not(.active) {
        display: none;
    }

    .requirement-btn.active {
        border: 2px solid currentColor;
    }

    .requirement-item {
        page-break-inside: avoid;
    }
}

/* Remove number input spinners/arrows */
input[type="number"].no-spinners::-webkit-outer-spin-button,
input[type="number"].no-spinners::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"].no-spinners {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ==========================================
   THUMBNAIL PREVIEW MODAL STYLES
   ========================================== */

/* Modal overlay */
#thumbnailPreviewModal {
    display: none;
    position: fixed !important;
    z-index: 10000 !important;
    left: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    min-width: 100vw !important;
    max-width: none !important;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
    /* Break out of any parent container */
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
}

/* Modal content container */
.thumbnail-modal-content {
    position: relative;
    margin: auto;
    padding: 0;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 5vh;
}

/* Preview image */
.thumbnail-modal-image {
    width: 100%;
    height: auto;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Close button */
.thumbnail-modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    transition: color 0.3s ease;
    cursor: pointer;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.thumbnail-modal-close:hover,
.thumbnail-modal-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* File name caption */
.thumbnail-modal-caption {
    text-align: center;
    color: #fff;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    margin-top: 15px;
    word-break: break-word;
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Gallery navigation buttons */
.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.gallery-nav-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    transform: translateY(-50%) scale(1.1);
}

.gallery-nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.gallery-prev {
    left: 20px;
}

.gallery-next {
    right: 20px;
}

/* Gallery position indicator */
.gallery-position-indicator {
    text-align: center;
    color: #fff;
    padding: 8px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    margin-top: 10px;
    display: inline-block;
    min-width: 60px;
    backdrop-filter: blur(5px);
}

/* Gallery modal action buttons (for mobile) */
.gallery-modal-actions {
    display: none; /* Hidden on desktop */
    justify-content: center;
    gap: 1rem;
    margin-top: 15px;
    padding: 10px;
}

.gallery-modal-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 1.1rem;
    border-radius: 25px;
    backdrop-filter: blur(5px);
}

.gallery-modal-actions .btn-outline-primary {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(13, 110, 253, 0.3);
}

.gallery-modal-actions .btn-outline-primary:hover {
    background: rgba(13, 110, 253, 0.8);
    border-color: #0d6efd;
}

.gallery-modal-actions .btn-outline-danger {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(220, 53, 69, 0.3);
}

.gallery-modal-actions .btn-outline-danger:hover {
    background: rgba(220, 53, 69, 0.8);
    border-color: #dc3545;
}

/* Show action buttons on mobile */
@media (max-width: 480px) {
    .gallery-modal-actions {
        display: flex;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .thumbnail-modal-close {
        top: 10px;
        right: 15px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }

    .thumbnail-modal-content {
        width: 95%;
        margin-top: 10px;
    }

    .thumbnail-modal-caption {
        font-size: 0.95rem;
        padding: 10px;
    }

    /* Smaller navigation buttons on mobile */
    .gallery-nav-btn {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .gallery-prev {
        left: 10px;
    }

    .gallery-next {
        right: 10px;
    }

    .gallery-position-indicator {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
}

/* ==========================================
   FILE PREVIEW MODAL STYLES (PDF/CSV)
   ========================================== */

/* Modal overlay */
.file-preview-modal {
    display: none;
    position: fixed !important;
    z-index: 10000 !important;
    left: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    min-width: 100vw !important;
    max-width: none !important;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.85);
    animation: fadeIn 0.3s ease;
    /* Break out of any parent container */
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
}

/* Modal content container */
.file-preview-modal-content {
    position: relative;
    margin: 20px auto;
    width: 95%;
    max-width: 1400px;
    height: calc(100vh - 40px);
    background: #fff;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* Modal header */
.file-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.file-preview-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.file-preview-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.file-preview-close:hover {
    background: #e9ecef;
    color: #000;
}

/* Modal body */
.file-preview-body {
    flex: 1;
    overflow: auto;
    padding: 20px;
    position: relative;
}

/* PDF Controls */
.pdf-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

#pdfZoomLevel {
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

/* PDF Canvas */
.pdf-canvas-wrapper {
    display: flex;
    justify-content: center;
    overflow: auto;
    background: #525659;
    border-radius: 4px;
    padding: 20px;
    min-height: 500px;
}

#pdfCanvas {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    background: #fff;
}

/* CSV Controls */
.csv-controls {
    display: flex;
    justify-content: flex-end;
    padding: 10px 0;
    margin-bottom: 15px;
}

/* CSV Table */
.csv-table-wrapper {
    overflow: auto;
    max-height: calc(100vh - 250px);
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

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

.csv-preview-table thead {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 10;
}

.csv-preview-table th {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    white-space: nowrap;
}

.csv-preview-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #dee2e6;
}

.csv-preview-table tbody tr:hover {
    background: #f8f9fa;
}

/* XLSX Controls */
.xlsx-controls {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 10px 0;
    margin-bottom: 15px;
}

/* XLSX Table */
.xlsx-table-wrapper {
    overflow: auto;
    max-height: calc(100vh - 250px);
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

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

.xlsx-preview-table thead {
    position: sticky;
    top: 0;
    background: #e7f3ff;
    z-index: 10;
}

.xlsx-preview-table th {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    white-space: nowrap;
}

.xlsx-preview-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #dee2e6;
}

.xlsx-preview-table tbody tr:hover {
    background: #f8f9fa;
}

/* Text file viewer */
.text-content-wrapper {
    overflow: auto;
    max-height: calc(100vh - 250px);
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #f8f9fa;
}

.text-content {
    margin: 0;
    padding: 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    white-space: pre;
    overflow-x: auto;
    background: #ffffff;
    border-radius: 4px;
}

.text-content.wrap {
    white-space: pre-wrap;
}

.text-controls {
    margin-bottom: 15px;
}

/* Loading spinner */
.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #666;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .file-preview-modal-content {
        width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .pdf-controls {
        flex-direction: column;
        gap: 8px;
    }

    .csv-preview-table {
        font-size: 0.8rem;
    }

    .csv-preview-table th,
    .csv-preview-table td {
        padding: 8px 6px;
    }
}

/* Submission Region Flag Styles */
.submission-region-flag {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.submission-region-flag:hover {
    background: #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.submission-region-flag img {
    display: block;
}

.submission-region-flag .region-label {
    font-size: 0.95rem;
    color: #495057;
}

/* ==========================================
   GLOBAL SEARCH BAR STYLES
   ========================================== */

/* Search bar container */
.yamaha-warranty-search {
    background: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Search input group */
.yamaha-warranty-search .input-group-lg .input-group-text {
    padding-left: 18px;
    padding-right: 18px;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.yamaha-warranty-search .input-group-lg .form-control {
    padding: 12px 16px;
    font-size: 1.1rem;
    border-left: 0;
}

.yamaha-warranty-search .input-group-lg .form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

.yamaha-warranty-search .input-group-lg .form-control::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* Clear search button */
.yamaha-warranty-search #clear-search {
    border-left: 0;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    padding: 0 16px;
    transition: all 0.2s ease;
}

.yamaha-warranty-search #clear-search:hover {
    background-color: #f8f9fa;
    color: #dc3545;
}

/* Search status area */
.yamaha-warranty-search .search-status {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 24px;
}

.yamaha-warranty-search #search-hint {
    font-size: 0.9rem;
}

.yamaha-warranty-search #search-results-count {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 4px 12px;
}

.yamaha-warranty-search #search-loading {
    width: 1rem;
    height: 1rem;
}

/* Responsive search bar */
@media (max-width: 768px) {
    .yamaha-warranty-search {
        padding: 15px;
    }

    .yamaha-warranty-search .input-group-lg .form-control {
        font-size: 1rem;
        padding: 10px 12px;
    }

    .yamaha-warranty-search .input-group-lg .form-control::placeholder {
        font-size: 0.9rem;
    }

    .yamaha-warranty-search .input-group-lg .input-group-text {
        padding-left: 14px;
        padding-right: 14px;
    }
}

/* ==========================================
   MOBILE FULL-WIDTH OVERRIDES
   Reduce WordPress theme padding on mobile to maximize table space
   ========================================== */
@media (max-width: 768px) {
    /* Override WordPress theme container padding on mobile */
    .entry-content,
    .post-content,
    article .entry-content {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* Make warranty containers use full width */
    .yamaha-warranty-cases-container,
    .yamaha-dealer-dashboard-container,
    .yamaha-warranty-header,
    .yamaha-warranty-search,
    .yamaha-warranty-filters,
    .yamaha-warranty-content,
    .yamaha-dealer-content {
        margin-left: -10px;
        margin-right: -10px;
        width: calc(100% + 20px);
        border-radius: 0;
    }

    /* Reduce internal padding on mobile */
    .yamaha-warranty-header,
    .yamaha-warranty-filters {
        padding: 12px;
    }

    .yamaha-warranty-search {
        padding: 12px;
        border-left: none;
        border-right: none;
    }

    .yamaha-warranty-content {
        border-left: none;
        border-right: none;
    }
}

@media (max-width: 480px) {
    /* Even tighter on very small screens */
    .entry-content,
    .post-content,
    article .entry-content {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }

    .yamaha-warranty-cases-container,
    .yamaha-dealer-dashboard-container,
    .yamaha-warranty-header,
    .yamaha-warranty-search,
    .yamaha-warranty-filters,
    .yamaha-warranty-content,
    .yamaha-dealer-content {
        margin-left: -5px;
        margin-right: -5px;
        width: calc(100% + 10px);
    }

    .yamaha-warranty-header,
    .yamaha-warranty-search,
    .yamaha-warranty-filters {
        padding: 10px;
    }
}

/* ==========================================
   BOOTSTRAP MODAL FIXES
   Fix for modals appearing half-screen/left-aligned

   Issue: mailing-list-api plugin has generic .modal CSS:
     .modal { width: 100%; height: 100%; }  <- relative to parent, NOT viewport!
     .modal-content { width: 90%; max-width: 500px; }

   Solution: Use !important with viewport units and ensure
   the modal breaks out of any parent container constraints.
   ========================================== */

/*
 * CRITICAL FIX: Force modals to break out of parent containers
 * The mailing-list-api's "width: 100%" calculates relative to parent,
 * not viewport. We must use fixed positioning with viewport units
 * AND ensure no parent container can constrain the modal.
 */

/* Target our specific modals by ID - highest specificity */
#orphanDirectoriesModal,
#archiveConfirmModal,
#filePreviewModal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    min-width: 100vw !important;
    max-width: none !important;
    z-index: 1055 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    outline: 0 !important;
    background-color: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
    /* Break out of any parent container */
    transform: none !important;
    contain: none !important;
}

/* Hidden state */
#orphanDirectoriesModal:not(.show),
#archiveConfirmModal:not(.show),
#filePreviewModal:not(.show) {
    display: none !important;
}

/* Shown state */
#orphanDirectoriesModal.show,
#archiveConfirmModal.show,
#filePreviewModal.show {
    display: block !important;
}

/* Modal backdrop - ensure full viewport coverage */
.modal-backdrop,
.modal-backdrop.fade,
.modal-backdrop.show {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1050 !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
}

/* Modal dialog - centered container for the content */
#orphanDirectoriesModal .modal-dialog,
#archiveConfirmModal .modal-dialog,
#filePreviewModal .modal-dialog {
    position: relative !important;
    width: auto !important;
    margin: 1.75rem auto !important;
    max-width: 500px !important;
    pointer-events: none !important;
    /* Reset any inherited constraints */
    min-width: 0 !important;
    transform: none !important;
}

/* Modal content box - override mailing-list-api's width: 90%; max-width: 500px; */
#orphanDirectoriesModal .modal-content,
#archiveConfirmModal .modal-content,
#filePreviewModal .modal-content {
    pointer-events: auto !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: none !important;
    background-color: #fff !important;
    background-clip: padding-box !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    border-radius: 0.5rem !important;
    outline: 0 !important;
    margin: 0 !important;
    /* Do NOT set padding to 0 - Bootstrap's modal-header/body/footer have their own padding */
}

/* Orphan directories modal - larger to show table */
#orphanDirectoriesModal .modal-dialog {
    max-width: 900px !important;
}

#orphanDirectoriesModal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

/* Archive confirmation modal - smaller dialog */
#archiveConfirmModal .modal-dialog {
    max-width: 500px !important;
}

/* File preview modal - higher z-index */
#filePreviewModal {
    z-index: 10050 !important;
}

#filePreviewModal .modal-dialog {
    max-width: 90vw !important;
}

/* Generic Bootstrap modal fixes for any other modals in the plugin */
.yamaha-warranty-form-container .modal.fade,
.yamaha-warranty-form-container .modal.show {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1055 !important;
}

/* Responsive modal sizes */
@media (min-width: 992px) {
    #orphanDirectoriesModal .modal-dialog {
        max-width: 900px !important;
    }
}

@media (max-width: 991.98px) {
    #orphanDirectoriesModal .modal-dialog {
        max-width: 95vw !important;
        margin: 0.5rem auto !important;
    }
}

/* ==========================================
   FLOATING SAVE BUTTON (Edit Mode)
   ========================================== */

.floating-save-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.floating-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.5);
    background: linear-gradient(135deg, #218838 0%, #1ba87e 100%);
}

.floating-save-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(40, 167, 69, 0.4);
}

.floating-save-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.floating-save-btn i {
    font-size: 1.1rem;
}

.floating-save-btn .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Hide text when saving, show spinner */
.floating-save-btn.saving .floating-save-text,
.floating-save-btn.saving i {
    display: none;
}

.floating-save-btn.saving .spinner-border {
    display: inline-block !important;
}

/* Success state animation */
.floating-save-btn.saved {
    background: linear-gradient(135deg, #28a745 0%, #28a745 100%);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .floating-save-btn {
        bottom: 20px;
        right: 20px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .floating-save-btn i {
        font-size: 1rem;
    }
}

/* Extra small screens - icon only */
@media (max-width: 480px) {
    .floating-save-btn {
        bottom: 15px;
        right: 15px;
        padding: 14px;
        border-radius: 50%;
    }

    .floating-save-btn .floating-save-text {
        display: none;
    }

    .floating-save-btn i {
        font-size: 1.2rem;
    }
}

/* ==========================================
   LOADING STATE ANIMATIONS
   ========================================== */

/* Spin animation for refresh button and other loading indicators */
.spin-icon {
    animation: spin-animation 1s linear infinite;
}

@keyframes spin-animation {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================
   STAGE TIMELINE VISUALIZATION
   Horizontal timeline showing all workflow stages
   ========================================== */

/* Wrapper for horizontal scroll on mobile */
.stage-timeline-wrapper {
    overflow-x: auto;
    padding: 10px 0;
    -webkit-overflow-scrolling: touch;
}

/* Timeline container - flexbox horizontal layout */
.stage-timeline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    min-width: max-content;
    padding: 0 10px;
    gap: 0;
}

/* Individual stage node */
.stage-timeline-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    min-width: 70px;
    max-width: 100px;
}

/* Circle containing the sort_order number */
.stage-timeline-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    position: relative;
    z-index: 2;
    border: 3px solid;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Completed stages - green */
.stage-timeline-node.completed .stage-timeline-circle {
    background-color: #28a745;
    border-color: #28a745;
    color: #fff;
}

/* Current stage - blue with emphasis */
.stage-timeline-node.current .stage-timeline-circle {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
    transform: scale(1.15);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.25);
}

/* Pending stages - gray */
.stage-timeline-node.pending .stage-timeline-circle {
    background-color: #fff;
    border-color: #6c757d;
    color: #6c757d;
}

/* Stage name label below circle */
.stage-timeline-label {
    margin-top: 8px;
    font-size: 0.65rem;
    text-align: center;
    max-width: 70px;
    line-height: 1.2;
    word-wrap: break-word;
    color: #495057;
}

/* Current stage label emphasis */
.stage-timeline-node.current .stage-timeline-label {
    font-weight: 600;
    color: #0d6efd;
}

/* Completed stage label */
.stage-timeline-node.completed .stage-timeline-label {
    color: #28a745;
}

/* Connector line between nodes */
.stage-timeline-connector {
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 3px;
    z-index: 1;
}

/* Don't show connector on last item */
.stage-timeline-node:last-child .stage-timeline-connector {
    display: none;
}

/* Completed connector - green */
.stage-timeline-node.completed .stage-timeline-connector {
    background-color: #28a745;
}

/* Current node's connector - half green, half gray */
.stage-timeline-node.current .stage-timeline-connector {
    background: linear-gradient(to right, #28a745 0%, #28a745 50%, #dee2e6 50%, #dee2e6 100%);
}

/* Pending connector - gray */
.stage-timeline-node.pending .stage-timeline-connector {
    background-color: #dee2e6;
}

/* Timeline card collapse icon animation */
#stageTimelineCard .collapse-icon {
    transition: transform 0.3s ease;
}

#stageTimelineCard .card-header[aria-expanded="true"] .collapse-icon {
    transform: rotate(180deg);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stage-timeline-node {
        min-width: 55px;
        max-width: 70px;
    }

    .stage-timeline-circle {
        width: 32px;
        height: 32px;
        font-size: 0.65rem;
    }

    .stage-timeline-label {
        font-size: 0.55rem;
        max-width: 55px;
    }

    .stage-timeline-connector {
        top: 16px;
        height: 2px;
    }
}

/* Very small screens - scroll indicator */
@media (max-width: 576px) {
    .stage-timeline-wrapper {
        position: relative;
    }

    .stage-timeline-wrapper::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to right, transparent, rgba(255,255,255,0.9));
        pointer-events: none;
    }
}

/* ==========================================
   COMMUNICATION STATUS COLUMN STYLES
   Dashboard column for per-case notification status
   ========================================== */

/* Communication status icon container */
.comm-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}

.comm-status-icon i {
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

.comm-status-icon:hover i {
    transform: scale(1.15);
}

/* Communication status tooltip - multiline support */
.comm-status-tooltip .tooltip-inner {
    white-space: pre-line;
    text-align: left;
    max-width: 220px;
    font-size: 0.8rem;
    padding: 8px 12px;
}

/* Column header icon styling */
#warranty-cases-table thead th:has(i.bi-bell) {
    text-align: center;
    width: 5%;
}

/* Compact column on table */
#warranty-cases-table td.text-center .comm-status-icon {
    display: flex;
    justify-content: center;
}

/* Mobile: Hide comms column on very small screens */
@media (max-width: 480px) {
    /* Comms column is 7th for admin (index 6) */
    #warranty-cases-table thead th:nth-child(7),
    #warranty-cases-table tbody td:nth-child(7) {
        display: none;
    }
}
