/**
 * Activities Table - Desktop Styles
 * Pixel-perfect implementation based on Figma design
 * 
 * @package Activities_Table
 */

/* Main Wrapper */
.activities-table-wrapper {
    direction: rtl;
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    max-width: 1560px;
    margin: 0 auto;
}

/* Controls Row - Search Box and View Switcher */
.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
}

/* View Switcher */
.view-switcher {
    display: flex !important;
    gap: 10.013px;
    align-items: center;
}

.view-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    height: auto;
    padding: 8px 20px;
    border: 1px solid #283565;
    border-radius: 10px;
    background-color: white;
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-weight: 400;
    font-size: 18px;
    line-height: 25.033px;
    color: #283565;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn svg {
    width: 20.026px;
    height: 20.026px;
}

.view-btn.active {
    background-color: #283565;
    color: white;
}

.view-btn.active svg path {
    stroke: white;
}

.view-btn:hover:not(.active) {
    background-color: #f8fcff;
}

.search-box {
    position: relative;
    width: 363px;
}

.search-box input {
    width: 100%;
    height: 53px;
    padding: 12px 50px 12px 16px;
    border: 1.075px solid #283565;
    border-radius: 8px;
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-size: 18px;
    line-height: 1.4;
    text-align: right;
    background-color: white;
    color: black;
}

.search-box input::placeholder {
    opacity: 0.6;
    color: black;
}

.search-box .search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #283565;
}

/* Filter Section */
.filter-section {
    margin-bottom: 35px;
}

.clear-filters-btn {
    padding: 8px 20px;
    border: 1px solid #283565;
    border-radius: 8px;
    background-color: white;
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.4;
    color: #283565;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-filters-btn:hover {
    background-color: #283565;
    color: white;
}

.filter-dropdowns {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-select {
    height: 53.75px;
    padding: 12px 12px 12px 40px;
    border: 1.075px solid #283565;
    border-radius: 8px;
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-size: 18px;
    line-height: 1.4;
    text-align: right;
    background-color: white;
    color: black;
    opacity: 0.6;
    cursor: pointer;
    min-width: 125px;
    background-image: url("/wp-content/uploads/2025/11/icon.png");
    background-repeat: no-repeat;
    background-position: 16px center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.filter-select:focus {
    outline: none;
    border-color: #40cecf;
    opacity: 1;
}

.results-count {
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-weight: 400;
    font-size: 22px;
    line-height: 30.039px;
    color: #283565;
    text-align: right;
    margin: 0;
}

#activities-count {
    font-weight: 600;
}

/* Table Container */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.activities-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 8.213px;
    overflow: hidden;
    box-shadow: 0px 2.566px 5.133px -2.566px rgba(0, 0, 0, 0.1), 0px 5.133px 7.699px -1.283px rgba(0, 0, 0, 0.1);
}

/* Table Header */
.activities-table thead tr {
    background-color: #283565;
    height: 50px;
}

.activities-table thead th {
    padding: 12px 8px 12px 8px;
    text-align: right;
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-weight: 600;
    font-size: 18.478px;
    line-height: 25.698px;
    color: white;
    border-bottom: 1.283px solid rgba(0, 0, 0, 0.1);
}

/* Table Body */
.activities-table tbody tr {
    border-bottom: 1.283px solid rgba(0, 0, 0, 0.1);
}

.activities-table tbody tr.row-alt {
    background-color: #f8fcff;
}

.activities-table tbody td {
    padding: 18px 8px;
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-weight: 400;
    font-size: 18px;
    line-height: 25.698px;
    color: #283565;
    vertical-align: top;
    text-align: right;
}

/* Checkbox/Accordion Toggle Cell */
.checkbox-cell {
    width: 56px;
    text-align: center !important;
    padding: 22px 0 !important;
}

.accordion-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.activity-row.expanded .accordion-toggle svg {
    transform: rotate(45deg);
}

.accordion-toggle svg {
    width: 20px;
    height: 20px;
    background-color: #283565;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

/* Activity Name Cell */
.activity-name {
    width: 220px;
    padding-right: 0 !important;
    text-align: right;
}

/* Health Domain Cell */
.health-domain-cell {
    width: 203px;
    text-align: right;
}

/* Collapsed State - Show Only First Badge */
.health-domain-cell .badge {
    display: none;
}

.health-domain-cell .badge:first-child {
    display: inline-block;
    margin-bottom: 0;
}

/* Badges */
.badge {
    display: inline-block;
    height: 28.331px;
    padding: 2.57px 10.279px;
    border-radius: 10px;
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-weight: 400;
    font-size: 18px;
    line-height: 20.558px;
    overflow: hidden;
    white-space: nowrap;
}

/* Badge colors are applied inline from ACF fields */

/* Truncatable Cells - Default State (Collapsed) */
.timing-cell,
.goal-cell {
    max-width: 219px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 30px !important;
}

/* Expanded State - Remove Truncation */
.activity-row.expanded .timing-cell,
.activity-row.expanded .goal-cell {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 22px;
}

/* Actions Cell */
.actions-cell {
    width: 105px;
    padding-right: 0 !important;
    padding-left: 0 !important;
}

.details-link {
    display: inline-flex;
    align-items: center;
    gap: 10.266px;
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-weight: 600;
    font-size: 18px;
    line-height: 25.698px;
    color: #40cecf;
    text-decoration: none;
    cursor: pointer;
}

.class-cell {
    width: 103px;
}

.duration-cell {
    width: 103px;
}

.details-link:hover {
    opacity: 0.8;
}

.details-link svg {
    width: 27.107px;
    height: 27.107px;
    transform: rotate(180deg);
}

/* Smooth Transition for Row Expansion */
.activity-row td {
    transition: padding 0.3s ease;
}

/* Expanded Row Styling */
.activity-row.expanded td {
    padding-top: 20px;
    padding-bottom: 20px;
    vertical-align: top;
}

/* Expanded State - Show All Badges Vertically Stacked */
.activity-row.expanded .health-domain-cell .badge {
    display: block;
    margin-bottom: 10.266px;
    width: fit-content;
}

.activity-row.expanded .health-domain-cell .badge:last-child {
    margin-bottom: 0;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.pagination-info {
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-weight: 400;
    font-size: 18px;
    line-height: 20px;
    color: #283565;
}

.pagination-actions {
    display: flex;
    gap: 12px;
}

.pagination-btn {
    padding: 8px 20px;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    background-color: white;
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-weight: 400;
    font-size: 18px;
    line-height: 20px;
    color: #283565;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #f8fcff;
    border-color: #283565;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading State */
.activities-table-wrapper.loading {
    opacity: 0.6;
    pointer-events: none;
}

.activities-table-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #283565;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Desktop Cards View */
#cards-view {
    margin-bottom: 20px;
}

.desktop-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);  /* 3 equal flexible columns */
    gap: 31px;
    margin-bottom: 35px;
    justify-content: center;
    max-width: 1562px;  /* Don't exceed design width */
    margin-left: auto;
    margin-right: auto;
}

.desktop-card {
    width: 100%;  /* Fill the grid column, not fixed 500px */
    border-radius: 20px;
    box-sizing: border-box;
    border: 1px solid rgba(239, 239, 239, 0.00);
    background: #FFF;
    box-shadow: 0 5.007px 7.51px -1.252px rgba(0, 0, 0, 0.10), 0 2.503px 5.007px -2.503px rgba(0, 0, 0, 0.10);
}

.desktop-card-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 50px 36px;
    height: 100%;
}

/* Desktop Card Badges */
.desktop-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

.desktop-card-badge {
    display: inline-block;
    height: 28.331px;
    padding: 3.855px 11.564px;
    border: 1.285px solid transparent;
    border-radius: 10.279px;
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-weight: 400;
    font-size: 18.478px;
    line-height: 20.558px;
    white-space: nowrap;
}

/* Desktop Card Title */
.desktop-card-title {
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-weight: 500;
    font-size: 28px;
    line-height: 40.035px;
    color: #283565;
    text-align: right;
    margin: 0;
}

/* Desktop Card Info Section */
.desktop-card-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

.desktop-card-info-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    justify-content: flex-end;
}

.desktop-card-info-content {
    flex: 1;
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-weight: 400;
    font-size: 18px;
    line-height: 22px;
    color: #283565;
    text-align: right;
}

.desktop-card-info-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 34px;
    height: auto;
}

.desktop-card-divider {
    width: 100%;
    height: 1px;
    background-color: #e0e0e0;
}

/* Desktop Card Details Button */
.desktop-card-details-btn {
    width: 100%;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 2px solid #40cecf;
    border-radius: 12px;
    background-color: white;
    padding: 4px 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.desktop-card-details-btn span {
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-weight: 500;
    font-size: 18px;
    line-height: 32.933px;
    color: #40cecf;
}

.desktop-card-details-btn svg {
    width: 16px;
    height: 16px;
}

.desktop-card-details-btn:hover {
    background-color: #40cecf;
}

.desktop-card-details-btn:hover span {
    color: white;
}

.desktop-card-details-btn:hover svg path {
    stroke: white;
}

/* Cards Pagination - Load More */
.cards-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
}

.load-more-btn {
    padding: 20px;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    background-color: white;
    font-family: 'Heebo-New',Helvetica,Arial,Lucida,sans-serif !important;
    font-weight: 400;
    font-size: 18px;
    line-height: 20px;
    color: #283565;
    cursor: pointer;
    transition: all 0.2s ease;
}

.load-more-btn:hover:not(:disabled) {
    background-color: #f8fcff;
    border-color: #283565;
}

.load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.load-more-btn.hidden {
    display: none;
}

/* Hide Mobile-Only Elements on Desktop */
.mobile-filter-btn {
    display: none;
}

.results-and-filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Laptop */
@media (min-width: 981px) and (max-width: 1600px) {
    .search-box input {
        font-size: 16px;
        height: 45px;
    }
    
    .filter-select {
        font-size: 16px;
        height: 45px;
    }

    .results-count {
        font-size: 20px;
    }

    .activities-table thead th {
        font-size: 16px;
    }
    .activities-table tbody td {
        font-size: 16px;
    }
    
    .desktop-card-content {
        padding: 40px 25px;
    }

    .desktop-card-badge {
        font-size: 16px;
    }

    .desktop-card-title {
        font-size: 24px;
    }

    .desktop-card-info-content {
        font-size: 16px;
    }

    .desktop-card-details-btn {
        font-size: 16px;
    }
}