/* Custom Table Widget Styles */

/* Base Table Container */
.custom-table-container {
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

/* STYLE 1: Traditional Table Layout */
/* Desktop Table View */
.table-desktop {
    display: block;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Header Styles */
.custom-table thead {
    position: relative;
}

.custom-table thead th {
    background-color: #1e3a8a;
    color: #ffffff;
    font-weight: 600;
    font-size: 16px;
    padding: 15px 20px;
    text-align: left;
    border: none;
    position: relative;
    white-space: nowrap;
    vertical-align: middle;
}

.custom-table thead th:first-child {
    border-top-left-radius: 8px;
}

.custom-table thead th:last-child {
    border-top-right-radius: 8px;
}

/* Body Styles */
.custom-table tbody {
    background-color: #ffffff;
}

.custom-table tbody td {
    padding: 12px 20px;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
    font-size: 14px;
    line-height: 1.5;
    vertical-align: middle;
    transition: all 0.2s ease;
}

.custom-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

.custom-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

/* Hover Effects */
.custom-table tbody tr {
    transition: all 0.2s ease;
}

.custom-table tbody tr:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.custom-table tbody tr:hover td {
    background-color: #f9fafb;
}

/* Alternating Row Styles */
.custom-table.alternating-rows tbody tr:nth-child(odd) td {
    background-color: #f8f9fa;
}

.custom-table.alternating-rows tbody tr:nth-child(even) td {
    background-color: #ffffff;
}

/* STYLE 2: Vertical Header Layout */
.table-style2 {
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.table-style2 .table-row {
    display: flex;
    transition: all 0.2s ease;
}

.table-style2 .table-row:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-style2 .table-row .row-header {
    background-color: #1e3a8a;
    color: #ffffff;
    font-weight: 600;
    font-size: 16px;
    padding: 15px 20px;
    text-align: left;
    border: none;
    min-width: 200px;
    max-width: 200px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
}

.table-style2 .table-row .row-data {
    display: flex;
    flex: 1;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.table-style2 .table-row .row-data .data-cell {
    flex: 1;
    padding: 15px 20px;
    border-right: 1px solid #e5e7eb;
    color: #374151;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.table-style2 .table-row .row-data .data-cell:last-child {
    border-right: none;
}

.table-style2 .table-row:last-child .row-header,
.table-style2 .table-row:last-child .row-data {
    border-bottom: none;
}

/* Style 2 Alternating Rows */
.table-style2.alternating-rows .table-row:nth-child(odd) .row-data .data-cell {
    background-color: #f8f9fa;
}

.table-style2.alternating-rows .table-row:nth-child(even) .row-data .data-cell {
    background-color: #ffffff;
}

.table-style2 .table-row:hover .row-data .data-cell {
    background-color: #f0f9ff;
}

/* STYLE 1: Mobile/Tablet View */
.table-mobile {
    display: none;
}

.table-mobile .table-card {
    background-color: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.table-mobile .table-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.table-mobile .table-card .card-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 8px;
}

.table-mobile .table-card .card-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.table-mobile .table-card .card-row .card-label {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    min-width: 120px;
    flex-shrink: 0;
}

.table-mobile .table-card .card-row .card-value {
    color: #6b7280;
    font-size: 14px;
    text-align: right;
    flex-grow: 1;
    word-break: break-word;
}

/* STYLE 2: Mobile Layout */
.table-mobile-style2 {
    display: none;
}

.table-mobile-style2 .mobile-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.table-mobile-style2 .mobile-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.table-mobile-style2 .mobile-card .mobile-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: #ffffff;
    padding: 20px;
    font-weight: 600;
    font-size: 18px;
    text-align: center;
    position: relative;
}

/* .table-mobile-style2 .mobile-card .mobile-header::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #1e3a8a;
} */


.table-mobile-style2 .mobile-card .mobile-section {
    border-bottom: 1px solid #e5e7eb;
}

.table-mobile-style2 .mobile-card .mobile-content .content-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
    flex-wrap: wrap;
    gap: 8px;
}

.table-mobile-style2 .mobile-card .mobile-content .content-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.table-mobile-style2 .mobile-card .mobile-content .content-label {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    min-width: 100px;
}

.table-mobile-style2 .mobile-card .mobile-content .content-value {
    color: #6b7280;
    font-size: 14px;
    text-align: right;
    flex-grow: 1;
    word-break: break-word;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    .custom-table thead th,
    .custom-table tbody td {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .table-style2 .table-row .row-header {
        min-width: 150px;
        max-width: 150px;
        padding: 12px 16px;
    }
    
    .table-style2 .table-row .row-data .data-cell {
        padding: 12px 16px;
    }
}

@media (max-width: 768px) {
    .table-desktop {
        display: none;
    }
    
    .table-style1 .table-mobile {
        display: block;
    }
    
    .table-style2 .table-mobile-style2 {
        display: block;
    }
    .table-mobile .table-card .card-row .card-value{
        flex-grow: 0;
    }
    
    .table-mobile .table-card .card-row {
        flex-direction: row;
        align-items: flex-start;
        gap: 4px;
    }
    
    .table-mobile .table-card .card-row .card-label {
        min-width: auto;
        margin-bottom: 4px;
    }
    
    .table-mobile .table-card .card-row .card-value {
        text-align: left;
        font-weight: 500;
    }
    
    .table-mobile-style2 .mobile-card .mobile-content .content-row {
        flex-direction: column;
        gap: 4px;
    }
    
    .table-mobile-style2 .mobile-card .mobile-content .content-label {
        min-width: auto;
    }
    
    .table-mobile-style2 .mobile-card .mobile-content .content-value {
        text-align: left;
        font-weight: 500;
    }
}

@media (max-width: 480px) {
    .table-mobile .table-card {
        margin: 0 10px 16px 10px;
        padding: 16px;
        border-radius: 8px;
    }
    
    .table-mobile .table-card .card-row .card-label {
        font-size: 13px;
    }
    
    .table-mobile .table-card .card-row .card-value {
        font-size: 13px;
    }
    
    .table-mobile-style2 .mobile-card {
        margin: 0 10px 16px 10px;
    }
    
    .table-mobile-style2 .mobile-card .mobile-header {
        padding: 16px;
        font-size: 16px;
    }
    
    .table-mobile-style2 .mobile-card .mobile-content {
        padding: 16px;
    }
    
    .table-mobile-style2 .mobile-card .mobile-content .content-label {
        font-size: 13px;
    }
    
    .table-mobile-style2 .mobile-card .mobile-content .content-value {
        font-size: 13px;
    }
}

/* Custom Scrollbar for Desktop Table */
.table-desktop::-webkit-scrollbar {
    height: 6px;
}

.table-desktop::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.table-desktop::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.table-desktop::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animation Classes */
.custom-table-container.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loading State */
.custom-table-container.loading {
    position: relative;
    min-height: 200px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility Improvements */
.custom-table thead th:focus,
.custom-table tbody td:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

.table-mobile .table-card:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.table-style2 .table-row .row-header:focus,
.table-style2 .table-row .row-data .data-cell:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

/* Print Styles */
@media print {
    .table-desktop {
        display: block;
    }
    
    .table-mobile,
    .table-mobile-style2 {
        display: none;
    }
    
    .custom-table {
        border-collapse: collapse;
    }
    
    .custom-table thead th,
    .custom-table tbody td {
        border: 1px solid #000;
        padding: 8px;
    }
    
    .custom-table tbody tr:hover,
    .table-style2 .table-row:hover {
        transform: none;
        box-shadow: none;
    }
}

/* RTL Support */
[dir="rtl"] .custom-table thead th,
[dir="rtl"] .custom-table tbody td {
    text-align: right;
}

[dir="rtl"] .table-mobile .table-card .card-row .card-value {
    text-align: left;
}

[dir="rtl"] .table-style2 .table-row .row-header {
    text-align: right;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .custom-table thead th {
        border: 2px solid #000;
    }
    
    .custom-table tbody td {
        border: 1px solid #666;
    }
    
    .table-mobile .table-card,
    .table-mobile-style2 .mobile-card {
        border: 2px solid #000;
    }
    
    .table-style2 .table-row .row-header,
    .table-style2 .table-row .row-data .data-cell {
        border: 1px solid #666;
    }
}

/* Higher Specificity Base Selectors - WITHOUT !important for typography */
.elementor-widget-custom-table .custom-table-container,
body .elementor-widget-custom-table .custom-table-container,
.elementor .elementor-widget-custom-table .custom-table-container {
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

/* STYLE 1: Traditional Table Layout */
.elementor-widget-custom-table .table-desktop,
body .elementor-widget-custom-table .table-desktop {
    display: block;
    overflow-x: auto;
}

.elementor-widget-custom-table .custom-table,
body .elementor-widget-custom-table .custom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

/* Header Styles - Allow typography override */
.elementor-widget-custom-table .custom-table thead,
body .elementor-widget-custom-table .custom-table thead {
    position: relative;
}

.elementor-widget-custom-table .custom-table thead th,
body .elementor-widget-custom-table .custom-table thead th,
.elementor .elementor-widget-custom-table .custom-table thead th {
    background-color: #1e3a8a;
    color: #ffffff;
    font-weight: 600;
    font-size: 16px;
    padding: 15px 20px;
    text-align: left;
    border: none;
    position: relative;
    white-space: nowrap;
    vertical-align: middle;
    /* Remove !important from typography properties */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.elementor-widget-custom-table .custom-table thead th:first-child,
body .elementor-widget-custom-table .custom-table thead th:first-child {
    border-top-left-radius: 8px;
}

.elementor-widget-custom-table .custom-table thead th:last-child,
body .elementor-widget-custom-table .custom-table thead th:last-child {
    border-top-right-radius: 8px;
}

/* Body Styles - Allow typography override */
.elementor-widget-custom-table .custom-table tbody,
body .elementor-widget-custom-table .custom-table tbody {
    background-color: #ffffff;
}

.elementor-widget-custom-table .custom-table tbody td,
body .elementor-widget-custom-table .custom-table tbody td,
.elementor .elementor-widget-custom-table .custom-table tbody td {
    padding: 12px 20px;
    border-bottom: 1px solid #e5e7eb;
    color: #374151;
    font-size: 14px;
    line-height: 1.5;
    vertical-align: middle;
    transition: all 0.2s ease;
    background-color: #ffffff;
    /* Remove !important from typography properties */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Style 2 - Allow typography override */
.elementor-widget-custom-table .table-style2,
body .elementor-widget-custom-table .table-style2,
.elementor .elementor-widget-custom-table .table-style2 {
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.elementor-widget-custom-table .table-style2 .table-row,
body .elementor-widget-custom-table .table-style2 .table-row {
    display: flex;
    transition: all 0.2s ease;
}

.elementor-widget-custom-table .table-style2 .table-row .row-header,
body .elementor-widget-custom-table .table-style2 .table-row .row-header,
.elementor .elementor-widget-custom-table .table-style2 .table-row .row-header {
    background-color: #1e3a8a;
    color: #ffffff;
    font-weight: 600;
    font-size: 16px;
    padding: 15px 20px;
    text-align: left;
    border: none;
    min-width: 200px;
    max-width: 200px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    /* Remove !important from typography properties */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.elementor-widget-custom-table .table-style2 .table-row .row-data .data-cell,
body .elementor-widget-custom-table .table-style2 .table-row .row-data .data-cell,
.elementor .elementor-widget-custom-table .table-style2 .table-row .row-data .data-cell {
    flex: 1;
    padding: 15px 20px;
    border-right: 1px solid #e5e7eb;
    color: #374151;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    background-color: #ffffff;
    /* Remove !important from typography properties */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Style 3 - Allow typography override */
.table-style3 .table-header-row .header-cell {
    flex: 1;
    padding: 15px 20px;
    color: #ffffff;
    font-weight: 600;
    font-size: 16px;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Remove !important from typography properties */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.table-style3 .table-data-row .data-cell {
    flex: 1;
    padding: 15px 20px;
    color: #374151;
    background-color: #ffffff;
    font-size: 14px;
    border-right: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    /* Remove !important from typography properties */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.table-style3 .table-data-row .data-cell.row-header-cell {
    background-color: #1e3a8a;
    color: #ffffff;
    font-weight: 600;
    font-size: 16px;
    justify-content: flex-start;
}

/* Mobile/Responsive with lower specificity for custom CSS override */
@media (max-width: 768px) {
    .elementor-widget-custom-table .table-desktop,
    body .elementor-widget-custom-table .table-desktop {
        display: none;
    }
    
    .elementor-widget-custom-table .table-style1 .table-mobile,
    body .elementor-widget-custom-table .table-style1 .table-mobile {
        display: block;
    }
    
    .elementor-widget-custom-table .table-style2 .table-mobile-style2,
    body .elementor-widget-custom-table .table-style2 .table-mobile-style2 {
        display: block;
    }
    
    .elementor-widget-custom-table .table-style3 .table-mobile-style3,
    body .elementor-widget-custom-table .table-style3 .table-mobile-style3 {
        display: block;
    }
}


/* ============================================
   STYLE 3: DOUBLE HEADER TABLE
   ============================================ */

/* Desktop Version - Style 3 */
.table-style3 .table-desktop {
    display: block;
}

.table-style3 .table-mobile {
    display: none;
}

.table-style3 .table-style3-wrapper {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background-color: #ffffff;
}

/* Header Row (Top Row - r1) - DEFAULT COLORS, CAN BE OVERRIDDEN */
.table-style3 .table-header-row {
    display: flex;
    background-color: #1e3a8a; /* Default - Elementor can override */
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.table-style3 .table-header-row .header-cell {
    flex: 1;
    padding: 15px 20px;
    color: #ffffff; /* Default - Elementor can override */
    font-weight: 600;
    font-size: 16px;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-style3 .table-header-row .header-cell:last-child {
    border-right: none;
}

/* Data Rows */
.table-style3 .table-data-row {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
}

.table-style3 .table-data-row:last-child {
    border-bottom: none;
}

.table-style3 .table-data-row:hover {
    background-color: #f9fafb;
}

.table-style3 .table-data-row .data-cell {
    flex: 1;
    padding: 15px 20px;
    color: #374151; /* Default - Elementor can override */
    background-color: #ffffff; /* Default - Elementor can override */
    font-size: 14px;
    border-right: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.table-style3 .table-data-row .data-cell:last-child {
    border-right: none;
}

/* First column in data rows (row headers - c1) - DEFAULT COLORS */
.table-style3 .table-data-row .data-cell.row-header-cell {
    background-color: #1e3a8a; /* Default - Elementor can override */
    color: #ffffff; /* Default - Elementor can override */
    font-weight: 600;
    font-size: 16px;
    justify-content: flex-start;
}

/* Mobile Version - Style 3 */
.table-style3 .table-mobile-style3 {
    display: none;
}

.table-style3 .table-mobile-style3 .mobile-card {
    background-color: #ffffff; /* Default - Elementor can override */
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-style3 .table-mobile-style3 .mobile-card:last-child {
    margin-bottom: 0;
}

/* Main Header (from first column - r2c1, r3c1, etc.) - DEFAULT COLORS */
.table-style3 .table-mobile-style3 .card-main-header {
    background-color: #1e3a8a; /* Default - Elementor can override */
    color: #ffffff; /* Default - Elementor can override */
    font-weight: 600;
    font-size: 18px;
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

/* Card Content */
.table-style3 .table-mobile-style3 .card-content {
    padding: 15px;
    background-color: #ffffff; /* Default - Elementor can override */
}

/* Card Items (sub-header + data pairs) */
.table-style3 .table-mobile-style3 .card-item {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.table-style3 .table-mobile-style3 .card-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Sub-header (from r1 - r1c2, r1c3, r1c4) - DEFAULT COLOR */
.table-style3 .table-mobile-style3 .card-sub-header {
    flex: 0 0 40%;
    font-weight: 600;
    color: #1e3a8a; /* Default - Elementor can override */
    font-size: 14px;
    padding-right: 15px;
    display: flex;
    align-items: center;
}

/* Data (from current row - r2c2, r2c3, r2c4) - DEFAULT COLOR */
.table-style3 .table-mobile-style3 .card-data {
    flex: 1;
    color: #374151; /* Default - Elementor can override */
    font-size: 14px;
    display: flex;
    align-items: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .table-style3 .table-desktop {
        display: none !important;
    }

    .table-style3 .table-mobile-style3 {
        display: block !important;
    }

    /* Adjust sub-header width on small screens */
    .table-style3 .table-mobile-style3 .card-sub-header {
        flex: 0 0 35%;
        font-size: 13px;
    }

    .table-style3 .table-mobile-style3 .card-data {
        font-size: 13px;
    }

    .table-style3 .table-mobile-style3 .card-main-header {
        font-size: 16px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .table-style3 .table-mobile-style3 .card-item {
        flex-direction: column;
        gap: 5px;
    }

    .table-style3 .table-mobile-style3 .card-sub-header {
        flex: 1;
        padding-right: 0;
        padding-bottom: 5px;
    }

    .table-style3 .table-mobile-style3 .card-data {
        flex: 1;
    }
}

/* Style 3 Specific Styling Options Support */
.table-style3 .table-header-row .header-cell {
    transition: background-color 0.3s ease;
}

.table-style3 .table-data-row .data-cell {
    transition: all 0.3s ease;
}

/* Alternate Row Colors Support for Style 3 */
.table-style3 .table-data-row:nth-child(even) {
    background-color: #f9fafb;
}

.table-style3 .table-data-row:nth-child(odd) {
    background-color: #ffffff;
}

.table-style3 .table-data-row:hover {
    background-color: #f3f4f6 !important;
}