/* Fee Calculation and Earnings Display Styles */

.fee-breakdown-card,
.earnings-card,
.revenue-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
}

.fee-summary,
.earnings-summary,
.revenue-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.fee-summary h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 500;
    opacity: 0.9;
}

.total-amount {
    font-size: 42px;
    font-weight: 700;
    margin: 10px 0;
}

.summary-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.summary-row:last-child {
    margin-bottom: 0;
}

.summary-item {
    flex: 1;
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

.summary-item.primary {
    background: rgba(255, 255, 255, 0.2);
}

.summary-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.summary-value {
    font-size: 28px;
    font-weight: 700;
}

.fee-breakdown-table,
.earnings-breakdown-table,
.revenue-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.fee-breakdown-table tbody tr,
.earnings-breakdown-table tbody tr,
.revenue-breakdown-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
}

.fee-breakdown-table td,
.earnings-breakdown-table td,
.revenue-breakdown-table td,
.earnings-breakdown-table th,
.revenue-breakdown-table th {
    padding: 12px 8px;
}

.breakdown-detail td {
    font-size: 14px;
    color: #666;
}

.total-row {
    border-top: 2px solid #333 !important;
    background: #f9f9f9;
    font-weight: bold;
}

.total-row td {
    padding: 15px 8px !important;
}

.fee-note,
.earnings-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f0f7ff;
    border-left: 4px solid #2196f3;
    border-radius: 4px;
    margin-top: 20px;
    font-size: 14px;
    color: #1976d2;
}

.fee-note i,
.earnings-note i {
    font-size: 20px;
}

.level-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.level-badge.beginner {
    background: #e8f5e9;
    color: #2e7d32;
}

.level-badge.intermediate {
    background: #fff3e0;
    color: #e65100;
}

.level-badge.advanced {
    background: #fce4ec;
    color: #c2185b;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #757575;
}

.text-success {
    color: #4caf50;
}

.text-danger {
    color: #f44336;
}

.alert {
    padding: 16px;
    border-radius: 4px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert i {
    font-size: 24px;
}

.alert p {
    margin: 0 0 8px 0;
}

.alert p:last-child {
    margin-bottom: 0;
}

.alert-info {
    background: #e3f2fd;
    color: #1976d2;
    border-left: 4px solid #2196f3;
}

.alert-warning {
    background: #fff3e0;
    color: #e65100;
    border-left: 4px solid #ff9800;
}

.alert-danger {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

.instrument-tag {
    display: inline-block;
    padding: 4px 12px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.loading-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

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

.breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.breakdown-table td {
    padding: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.breakdown-table td:first-child {
    font-weight: 500;
}

.action-buttons {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.mdc-icon-button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.mdc-icon-button:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.mdc-icon-button i {
    font-size: 20px;
    color: #666;
}

/* ===================================================================
   MODAL STYLES MOVED TO modal.css - 2026-02-14
   =================================================================== */

.earnings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
}

.close-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none !important;
    border-color: #6200ea;
    box-shadow: none !important;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #6200ea;
    color: white;
}

.btn-primary:hover {
    background: #5300d8;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state i {
    opacity: 0.3;
}

.empty-state p {
    margin-top: 12px;
    color: #757575;
}

/* ============================================================
   Trainer Dashboard → Earnings → By Student
   Loaded after main.css so these rules win the cascade.
   ============================================================ */

#trainer-dashboardContainer .earn-students,
.earn-students {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#trainer-dashboardContainer .material-card .earn-students-toolbar,
#trainer-dashboardContainer .earn-students-toolbar,
.earn-students-toolbar {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    margin: 0 !important;
    width: 100%;
}

#trainer-dashboardContainer .material-card .earn-month-picker,
#trainer-dashboardContainer .earn-month-picker,
.earn-month-picker {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px;
    width: max-content !important;
    max-width: none !important;
    height: 40px !important;
    margin: 0 !important;
    padding: 0 12px !important;
    flex: 0 0 auto;
    box-sizing: border-box;
    background: #f7f5fb;
    border: 1px solid #e6e1f0;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

#trainer-dashboardContainer .earn-month-picker .material-icons,
.earn-month-picker .material-icons {
    font-size: 18px !important;
    width: 18px;
    height: 18px;
    line-height: 18px !important;
    color: var(--primary-color, #e2486c);
    flex-shrink: 0;
}

#trainer-dashboardContainer .material-card .earn-month-picker select,
#trainer-dashboardContainer .earn-month-picker select,
.earn-month-picker select {
    display: block !important;
    width: 9.5em !important;
    max-width: 9.5em !important;
    min-width: 0 !important;
    height: 38px !important;
    margin: 0 !important;
    padding: 0 18px 0 0 !important;
    border: 0 !important;
    background-color: transparent !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%235a5672'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 2px center !important;
    background-size: 12px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 38px !important;
    color: #1a1d2e !important;
    box-sizing: border-box;
    appearance: none !important;
    -webkit-appearance: none !important;
    cursor: pointer;
}

#trainer-dashboardContainer .earn-view-toggle,
.earn-view-toggle {
    display: inline-flex !important;
    align-items: center;
    flex: 0 0 auto;
    height: 40px;
    margin: 0 0 0 auto !important;
    padding: 3px;
    gap: 2px;
    box-sizing: border-box;
    background: #f4f1fa;
    border: 1px solid #e6e1f0;
    border-radius: 10px;
}

#trainer-dashboardContainer .material-card .earn-view-toggle button,
#trainer-dashboardContainer .earn-view-toggle button,
.earn-view-toggle button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: auto !important;
    height: 34px !important;
    min-height: 34px !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 12px !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #5a5672 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    white-space: nowrap;
    cursor: pointer;
}

#trainer-dashboardContainer .earn-view-toggle button .material-icons,
.earn-view-toggle button .material-icons {
    font-size: 16px !important;
    width: 16px;
    height: 16px;
    line-height: 16px !important;
}

#trainer-dashboardContainer .earn-view-toggle button.is-active,
.earn-view-toggle button.is-active {
    background: #fff !important;
    color: var(--primary-color, #e2486c) !important;
    box-shadow: 0 1px 3px rgba(26, 29, 46, 0.08) !important;
}

#trainer-dashboardContainer .earn-kpi-grid,
.earn-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

#trainer-dashboardContainer .earn-kpi,
.earn-kpi {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 88px;
    min-width: 0;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

.earn-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.earn-kpi-icon .material-icons {
    font-size: 24px !important;
    color: #fff !important;
    line-height: 1 !important;
}

.earn-kpi-body {
    min-width: 0;
    flex: 1;
}

#trainer-dashboardContainer .earn-kpi-label,
.earn-kpi-label {
    display: block !important;
    margin: 0 0 4px !important;
    font-size: 12px;
    font-weight: 500;
    color: #666;
}

#trainer-dashboardContainer .earn-kpi strong,
.earn-kpi strong {
    display: block;
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #333;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.earn-mix {
    margin: 0;
    padding: 16px 18px 18px;
    background: #fff;
    border: 1px solid #efeaf8;
    border-radius: 16px;
}

.earn-mix-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.earn-mix-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #3d3a52;
}

.earn-mix-title .material-icons {
    font-size: 18px !important;
    line-height: 1 !important;
    color: var(--primary-color, #e2486c);
}

#trainer-dashboardContainer .earn-mix-link,
.earn-mix-link {
    display: inline-flex !important;
    align-items: center;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 5px 12px !important;
    border: 1px solid #eadff3 !important;
    border-radius: 999px !important;
    background: #faf7ff !important;
    color: var(--primary-color, #e2486c) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    text-transform: none !important;
    box-shadow: none !important;
    cursor: pointer;
}

.earn-pie-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: center;
    gap: 20px 28px;
}

.earn-pie-canvas-wrap {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.earn-pie-canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.earn-pie-center {
    position: absolute;
    inset: 28%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
}

.earn-pie-center strong {
    display: block;
    font-size: 16px;
    font-weight: 800;
    color: #1a1d2e;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.earn-pie-center span {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8b87a0;
}

.earn-pie-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.earn-pie-legend-row {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 10px;
    background: #faf8fc;
}

.earn-pie-legend-copy {
    min-width: 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.earn-pie-legend-copy strong {
    font-size: 13px;
    font-weight: 600;
    color: #1a1d2e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.earn-pie-legend-copy em {
    flex-shrink: 0;
    font-style: normal;
    font-size: 12px;
    font-weight: 700;
    color: #5a5672;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.earn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

@media (max-width: 720px) {
    .earn-pie-layout {
        grid-template-columns: 1fr;
        justify-items: center;
    }
    .earn-pie-legend {
        width: 100%;
    }
}

.earn-students-empty {
    text-align: center;
    padding: 48px 20px;
    color: #8b87a0;
}

.earn-students-empty .material-icons {
    font-size: 48px;
    opacity: 0.45;
}

#trainer-dashboardContainer .earn-students-empty h4,
.earn-students-empty h4 {
    margin: 12px 0 6px !important;
    color: #3d3a52;
    font-size: 16px;
    text-align: center;
}

.earn-students-empty p {
    margin: 0;
    font-size: 13px;
}

#trainer-dashboardContainer .earn-students-view,
.earn-students-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 0;
}

#trainer-dashboardContainer .earn-students-view.is-hidden,
.earn-students-view.is-hidden {
    display: none !important;
}

.earn-rank-list {
    border: 1px solid #efeaf8;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
}

.earn-rank-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1.5fr) 120px 72px minmax(80px, 1.4fr) 108px;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 10px 16px;
    box-sizing: border-box;
    border-bottom: 1px solid #f3eef8;
}

.earn-rank-row:last-child {
    border-bottom: 0;
}

.earn-rank-head {
    min-height: 40px;
    background: #faf8fc;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8b87a0;
}

.earn-rank-head span:last-child,
.earn-rank-row .earn-student-amt,
.earn-rank-cls {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.earn-rank-inst,
.earn-rank-cls {
    font-size: 13px;
    color: #5a5672;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.earn-student-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.earn-student-name {
    font-weight: 600;
    color: #1a1d2e;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.earn-student-amt {
    font-weight: 700;
    color: #2e7d32;
    font-size: 14px;
    white-space: nowrap;
}

.earn-rank-bar {
    display: block;
    min-width: 0;
}

.earn-student-track {
    display: block;
    width: 72px;
    height: 8px;
    background: #f1eef7;
    border-radius: 999px;
    overflow: hidden;
}

.earn-student-track-wide {
    width: 100%;
}

.earn-student-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    min-width: 4px;
}

.earn-student-table-wrap {
    margin: 0;
}

.earn-student-table {
    width: 100%;
}

.earn-student-table th,
.earn-student-table td {
    vertical-align: middle;
}

.earn-student-table thead th:nth-child(3),
.earn-student-table tbody td:nth-child(3),
.earn-student-table thead th:nth-child(4),
.earn-student-table tbody td:nth-child(4),
.earn-student-table thead th:nth-child(5),
.earn-student-table tbody td:nth-child(5) {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.earn-student-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

@media (max-width: 860px) {
    .earn-rank-row {
        grid-template-columns: 36px minmax(0, 1fr) minmax(80px, 1fr) 96px;
    }
    .earn-rank-head span:nth-child(3),
    .earn-rank-head span:nth-child(4),
    .earn-rank-inst,
    .earn-rank-cls {
        display: none;
    }
}

@media (max-width: 720px) {
    #trainer-dashboardContainer .earn-students-toolbar,
    .earn-students-toolbar {
        flex-wrap: wrap;
    }
    #trainer-dashboardContainer .earn-view-toggle,
    .earn-view-toggle {
        margin-left: 0 !important;
    }
    #trainer-dashboardContainer .earn-kpi-grid,
    .earn-kpi-grid {
        grid-template-columns: 1fr;
    }
    .earn-student-table thead th:nth-child(2),
    .earn-student-table tbody td:nth-child(2),
    .earn-student-table thead th:nth-child(4),
    .earn-student-table tbody td:nth-child(4) {
        display: none;
    }
}
