/**
 * Trainer Dashboard Styles
 */

.trainer-dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #667eea;
}

.dashboard-header h1 {
    margin: 0;
    color: #333;
    font-size: 32px;
    font-weight: 700;
}

.btn-refresh {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-refresh:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-refresh .dashicons {
    font-size: 18px;
}

/* Overview Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon .dashicons {
    color: white;
    font-size: 32px;
    width: 32px;
    height: 32px;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: #333;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filters */
.dashboard-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.search-input,
.sort-select {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-input {
    flex: 1;
}

.search-input:focus,
.sort-select:focus {
    outline: none;
    border-color: #667eea;
}

/* Client Table */
.clients-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

.clients-table {
    width: 100%;
    border-collapse: collapse;
}

.clients-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.clients-table th {
    padding: 16px;
    text-align: left;
    color: white;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clients-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.clients-table tbody tr:hover {
    background-color: #f9f9f9;
}

.clients-table td {
    padding: 16px;
    font-size: 14px;
}

.client-name strong {
    color: #333;
    font-size: 16px;
}

.client-email {
    color: #666;
    font-size: 13px;
    margin-top: 4px;
}

/* Completion Bar */
.completion-bar {
    position: relative;
    width: 100%;
    height: 28px;
    background: #f0f0f0;
    border-radius: 14px;
    overflow: hidden;
}

.completion-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.6s ease;
    border-radius: 14px;
}

.completion-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

/* View Details Button */
.btn-view-details {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.btn-view-details:hover {
    background: #5568d3;
}

.btn-delete-client {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    margin-left: 8px;
    transition: background-color 0.2s, transform 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-delete-client:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.btn-delete-client:disabled {
    background: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-delete-client .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Bulk Actions Bar */
.bulk-actions-bar {
    background: #f8f9ff;
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 12px 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.selected-count {
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
}

.btn-delete-selected {
    transition: all 0.2s;
}

.btn-delete-selected:hover {
    background: #c82333 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

/* Checkbox styling */
.client-checkbox,
#selectAll {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Delete Confirmation Modal */
.delete-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.delete-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

.delete-modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    z-index: 2;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.delete-modal-content h2 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 24px;
}

.delete-modal-content p {
    margin: 10px 0;
    color: #666;
    font-size: 15px;
    line-height: 1.5;
}

.delete-modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    justify-content: flex-end;
}

.btn-cancel-delete,
.btn-confirm-delete {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel-delete {
    background: #f0f0f0;
    color: #333;
}

.btn-cancel-delete:hover {
    background: #e0e0e0;
}

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

.btn-confirm-delete:hover {
    background: #c82333;
}

/* Client Details Row */
.client-details-row td {
    padding: 0 !important;
}

.client-details-container {
    padding: 30px;
    background: #f9f9f9;
    border-top: 3px solid #667eea;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

/* Client Details Content */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.details-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.details-card h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    margin-top: 15px;
}

/* Recent Workouts List */
.recent-workouts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recent-workouts-list li {
    padding: 12px;
    margin-bottom: 8px;
    background: #f9f9f9;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.workout-date {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.workout-summary {
    font-size: 13px;
    color: #666;
}

/* Weekly Workouts Container */
.weekly-workouts-container {
    padding: 0;
    margin: 0;
}

.week-section {
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.week-header {
    padding: 14px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    transition: background 0.2s;
    user-select: none;
}

.week-header:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%);
}

.week-toggle-icon {
    font-size: 12px;
    transition: transform 0.3s;
    display: inline-block;
    width: 16px;
}

.week-title {
    font-size: 15px;
    font-weight: 700;
}

.week-count {
    font-size: 13px;
    opacity: 0.9;
    font-weight: 400;
}

.week-workouts {
    background: #fafafa;
    padding: 0;
}

/* Single Workout */
.single-workout {
    padding: 16px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.single-workout:last-child {
    border-bottom: none;
}

.workout-header {
    margin-bottom: 12px;
}

.workout-date {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* Workout Block */
.workout-block {
    margin-bottom: 16px;
}

.workout-block:last-child {
    margin-bottom: 0;
}

.block-header {
    font-size: 13px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e8e8e8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Workout Exercises */
.workout-exercises {
    margin: 12px 0;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.exercise-item {
    padding: 8px 0;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.exercise-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.exercise-item.has-warning {
    background: #fff9f9;
    padding: 8px;
    margin: 0 -8px;
    border-radius: 4px;
}

.exercise-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    flex: 1;
}

.exercise-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.exercise-details {
    color: #666;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.rep-warning {
    color: #d32f2f;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Trainer Notes - Yellow Box */
.trainer-notes {
    margin: 12px 0;
    background: #fff9e6;
    border-left: 3px solid #ffc107;
    padding: 12px;
    border-radius: 6px;
}

.trainer-notes .notes-label {
    font-size: 12px;
    font-weight: 700;
    color: #f57c00;
    margin-bottom: 6px;
}

.trainer-notes .notes-content {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

/* Client Notes - Blue Box */
.client-notes {
    margin: 12px 0;
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
    padding: 12px;
    border-radius: 6px;
}

.client-notes .notes-label {
    font-size: 12px;
    font-weight: 700;
    color: #1976d2;
    margin-bottom: 6px;
}

.client-notes .notes-content {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

/* Responsive Design - Mobile Portrait */
@media (max-width: 768px) {
    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .dashboard-filters {
        flex-direction: column;
    }

    /* Enable horizontal scrolling for table on mobile */
    .clients-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        border-radius: 12px;
    }

    .clients-table {
        font-size: 12px;
        min-width: 600px; /* Ensure table doesn't shrink too much */
    }

    .clients-table th,
    .clients-table td {
        padding: 8px 10px;
        white-space: nowrap; /* Prevent text wrapping */
    }

    /* Don't hide columns anymore - let user scroll to see them */
    .clients-table th,
    .clients-table td {
        display: table-cell; /* Show all columns */
    }

    /* Make View Details button sticky on the right */
    .clients-table th:nth-child(7),
    .clients-table td:nth-child(7) {
        position: sticky;
        right: 0;
        background: white;
        box-shadow: -2px 0 4px rgba(0,0,0,0.1);
        z-index: 2;
    }

    .clients-table th:nth-child(7) {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }

    /* Client details - stack vertically on mobile portrait */
    .details-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Compact details container */
    .client-details-container {
        padding: 10px;
        max-height: none; /* Allow scrolling */
    }

    .details-card {
        padding: 12px;
    }

    .details-card h3 {
        font-size: 16px;
        margin-bottom: 10px;
    }

    /* Smaller charts on portrait mobile */
    .chart-container {
        height: 200px;
    }

    /* Compact workout stats */
    .workout-stats-summary {
        padding: 15px;
        margin-bottom: 15px;
    }

    .workout-stats-summary h4 {
        font-size: 14px;
    }

    .workout-stats-summary .stats-number {
        font-size: 32px;
    }

    .workout-stats-summary .stats-label {
        font-size: 12px;
    }

    /* Smaller recent workouts list */
    .recent-workouts-list li {
        padding: 10px;
        font-size: 12px;
    }

    .workout-date {
        font-size: 13px;
    }

    .workout-summary {
        font-size: 11px;
    }

    /* Make buttons more touch-friendly */
    .btn-view-details {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    .btn-refresh {
        padding: 14px 20px;
        font-size: 16px;
    }

    /* Smaller client name and email */
    .client-name strong {
        font-size: 14px;
    }

    .client-email {
        font-size: 11px;
    }

    /* Completion bar - make text smaller */
    .completion-text {
        font-size: 11px;
    }
}

/* Responsive Design - Mobile Landscape */
@media (max-width: 768px) and (orientation: landscape) {
    /* Slightly larger charts in landscape, but keep single column */
    .chart-container {
        height: 240px;
    }

    /* Keep single column in landscape - more compact */
    .details-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Stats Summary Block in Details */
.workout-stats-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.workout-stats-summary h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
}

.workout-stats-summary .stats-number {
    font-size: 42px;
    font-weight: 700;
    margin: 10px 0;
}

.workout-stats-summary .stats-label {
    font-size: 14px;
    opacity: 0.9;
}

/* Exercise Picker Modal Styles */
.td-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
}

.td-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 900px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: tdModalSlideIn 0.3s ease-out;
}

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

.td-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.td-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    flex: 1;
}

.td-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.td-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.td-modal-back {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    margin-right: 10px;
    transition: background 0.2s;
}

.td-modal-back:hover {
    background: rgba(255, 255, 255, 0.3);
}

.td-modal-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.td-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.td-category-btn {
    background: white;
    border: 2px solid #e0e0e0;
    padding: 20px;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.td-category-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.td-exercise-list {
    display: grid;
    gap: 10px;
}

.td-exercise-btn {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    font-size: 14px;
}

.td-exercise-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateX(5px);
}

.td-exercise-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.td-exercise-meta {
    font-size: 12px;
    color: #666;
}

/* Exercise button in editor */
.btn-choose-exercise {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.btn-choose-exercise:hover {
    background: #5568d3;
    transform: translateX(2px);
}

.btn-choose-exercise.has-exercise {
    background: #4caf50;
    color: white;
}

.btn-choose-exercise.has-exercise:hover {
    background: #43a047;
    color: white;
}

/* Copy to Weeks Button */
.btn-copy-to-weeks {
    width: 100%;
    padding: 12px;
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    margin-top: 15px;
    transition: all 0.2s;
}

.btn-copy-to-weeks:hover {
    background: #f57c00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}
