/* ============================================
   TEACHERS KPI VIEW - Styles
   Primary: #820c22 (Dark Red)
   Secondary: #fac40d (Gold)
   ============================================ */

/* Cairo Google Fonts removed - using Qatar font instead */
/* @import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap'); */

.teachers-kpi-view-wrapper {
    font-family: 'Qatar-medium', sans-serif;
    background: linear-gradient(135deg, #820c22 0%, #820c22 100%);
    min-height: 100vh;
    padding: 20px;
    direction: rtl;
    border-radius: 20px;

}

/* ============================================
   HEADER
   ============================================ */

.kpi-view-header {
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(130, 12, 34, 0.1);
        display: flex;
    justify-content: space-between;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 20px;
}

.title-icon {
    font-size: 32px;
}

.header-controls {
    display: flex;
    gap: 15px;
    align-items: baseline;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.search-box input {
    width: 250px;
    padding: 10px 18px;
    border: 2px solid rgba(130, 12, 34, 0.15);
    border-radius: 25px;
    font-size: 14px;
    font-family: 'Qatar-medium', sans-serif;
    transition: all 0.3s ease;
}

.filters-box {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid rgba(130, 12, 34, 0.15);
    border-radius: 20px;
    font-size: 14px;
    font-family: 'Qatar-medium', sans-serif;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.filter-select:hover {
    border-color: #820c22;
}

.filter-select:focus {
    outline: none;
    border-color: #820c22;
    box-shadow: 0 0 0 3px rgba(130, 12, 34, 0.1);
}

.search-box input:focus {
    outline: none;
    border-color: #820c22;
    box-shadow: 0 0 0 3px rgba(130, 12, 34, 0.1);
}

.view-toggle {
    display: flex;
    gap: 10px;
}

.view-btn {
    height: 45px;
    border: 2px solid rgba(130, 12, 34, 0.15);
    background: white;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #820c22;
}

.view-btn:hover {
    border-color: #ffffff;
    background: rgb(255 255 255 / 5%);
    color: white;
}

.view-btn.active {
    background: #fac40d;
    border-color: #ffffff;
    color: #000000;
}

/* ============================================
   CARDS VIEW
   ============================================ */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 25px;
}

.teacher-card {
    background: linear-gradient(180deg, #fff 0%, #eee 100%);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.50);
    transition: all 0.3s ease;
    cursor: pointer;
    min-width: 220px;
}

.teacher-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(130, 12, 34, 0.15);
    border-color: #fac40d;
}

/* Horizontal Layout for Teacher Card */
.teacher-card-layout {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Right Section: Image, Name, Classification */
.teacher-card-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex-shrink: 0;
    width: 100px;
    flex: 0.5;
}

.teacher-card-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fac40d;
}

.teacher-card-name {
    font-size: 16px;
    font-weight: 700;
    color: #820c22;
    margin: 10px 0 5px;
}

/* Classification badges in cards */
.teacher-classification-badges {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
}

.classification-badge {
    display: inline-block;
    padding: 3px 8px;
    background: linear-gradient(135deg, #820c22 0%, #a32d3d 100%);
    color: white;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
}

/* Center Divider Line */
.teacher-card-divider {
    width: 1px;
    height: 90px;
    background: linear-gradient(180deg, transparent 0%, #820c22 50%, transparent 100%);
    flex-shrink: 0;
}

/* Left Section: Stats */
.teacher-card-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.teacher-card-stats-row {
    display: flex;
    gap: 10px;
}

.teacher-card-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.card-stat {
    background: linear-gradient(180deg, #eaeaea, #d9d9d9);
    padding: 10px;
    border-radius: 10px;
    text-align: center;
    flex: 1;
}

.card-stat-label {
    font-size: 11px;
    color: #000000;
    display: block;
}

.card-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #820c22;
}

.card-rating {
    background: linear-gradient(180deg, #eaeaea, #d9d9d9);
    color: #fac40d;
}

.card-rating .card-stat-value {
    color: #000000;
}

/* Legacy styles for table view and other components */
.teacher-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.teacher-card-m-id {
    font-size: 13px;
    color: #666;
    margin-top: 3px;
}

/* Classification badges in table */
.table-classification-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.classification-badge-small {
    display: inline-block;
    padding: 1px 6px;
    background: linear-gradient(135deg, #820c22 0%, #a32d3d 100%);
    color: white;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 500;
}

/* ============================================
   TABLE VIEW
   ============================================ */

.teachers-table-view {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(130, 12, 34, 0.1);
}

.table-container {
    overflow-x: auto;
}

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

.teachers-table thead {
    background: linear-gradient(135deg, #820c22, #a51028);
    color: white;
}

.teachers-table th {
    padding: 15px;
    text-align: right;
    font-weight: 600;
    font-size: 14px;
}

.teachers-table tbody tr {
    border-bottom: 1px solid rgba(130, 12, 34, 0.1);
    transition: background 0.3s ease;
}

.teachers-table tbody tr:hover {
    background: rgba(130, 12, 34, 0.05);
}

.teachers-table td {
    padding: 15px;
}

.table-teacher-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.table-name {
    font-weight: 600;
    color: #820c22;
}

.rating-badge {
    display: inline-block;
    background: linear-gradient(135deg, #820c22, #a51028);
    color: #fac40d;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

.view-details-btn {
    background: linear-gradient(135deg, #fac40d, #f5b800);
    color: #820c22;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Qatar-medium', sans-serif;
}

.view-details-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(250, 196, 13, 0.4);
}

/* ============================================
   MODAL
   ============================================ */

.kpi-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.kpi-modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 1400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

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

.kpi-modal-header {
    background: linear-gradient(135deg, #820c22, #a51028);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.modal-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid #fac40d;
}

.header-text h3 {
    margin: 0;
    font-size: 22px;
}

.modal-m-id {
    display: inline-block;
    background: rgba(250, 196, 13, 0.2);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 13px;
    margin-top: 5px;
}

.close-modal {
    font-size: 32px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

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

/* Modal Body */
.kpi-modal-body {
    padding: 30px;
}

/* Statistics Grid */
.modal-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(145deg, #ffffff 0%, #fefaf5 100%);
    border: 2px solid rgba(130, 12, 34, 0.1);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: #fac40d;
    box-shadow: 0 5px 15px rgba(130, 12, 34, 0.1);
}

.stat-icon {
    font-size: 36px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(130, 12, 34, 0.1), rgba(130, 12, 34, 0.05));
    border-radius: 12px;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #820c22;
}

/* Charts Section */
.modal-charts-section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #820c22;
    margin-bottom: 15px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.chart-container {
    background: white;
    border: 2px solid rgba(130, 12, 34, 0.1);
    border-radius: 12px;
    padding: 20px;
}

.chart-container h5 {
    margin: 0 0 15px;
    font-size: 14px;
    font-weight: 600;
    color: #820c22;
    text-align: center;
}

.chart-container canvas {
    max-height: 250px;
}

/* Filters Section */
.modal-filters-section {
    margin-bottom: 30px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: #820c22;
    margin-bottom: 8px;
}

.filter-group input,
.filter-group select {
    padding: 10px 15px;
    border: 2px solid rgba(130, 12, 34, 0.15);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Qatar-medium', sans-serif;
    transition: all 0.3s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #820c22;
}

.rating-filter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rating-filter select {
    flex: 1;
}

.filter-group.actions {
    flex-direction: row;
    align-items: flex-end;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Qatar-medium', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #820c22, #a51028);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(130, 12, 34, 0.3);
}

.btn-secondary {
    background: #f5f5f5;
    color: #666;
}

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

/* Evaluations Table */
.modal-table-section {
    margin-bottom: 20px;
}

/* ============================================
   PROFILE VIEW TABLE
   ============================================ */

.teachers-profile-view {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(130, 12, 34, 0.1);
}

.profile-table-container {
    overflow-x: auto;
}

.profile-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 950px;
    font-size: 13px;
}

.profile-table thead {
    background: linear-gradient(135deg, #820c22, #a51028);
    color: white;
}

.profile-table th {
    padding: 12px 10px;
    text-align: right;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.profile-table tbody tr {
    border-bottom: 1px solid rgba(130, 12, 34, 0.1);
    transition: background 0.3s ease;
}

.profile-table tbody tr:hover {
    background: rgba(130, 12, 34, 0.05);
}

.profile-table td {
    padding: 10px;
    font-size: 12px;
    white-space: nowrap;
}

.profile-table .profile-name-cell {
    font-weight: 700;
    color: #820c22;
    min-width: 140px;
    white-space: normal;
}

.profile-details-btn {
    background: linear-gradient(135deg, #fac40d, #f5b800);
    color: #820c22;
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Qatar-medium', sans-serif;
    font-size: 12px;
    white-space: nowrap;
}

.profile-details-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(250, 196, 13, 0.4);
}

/* ============================================
   PROFILE DETAILS POPUP
   ============================================ */

.profile-popup-content {
    max-width: 850px;
}

.popup-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 8px 0;
    padding: 10px 16px;
    background: linear-gradient(135deg, #820c22, #a51028);
    border-radius: 10px;
}

.popup-section-header:first-child {
    margin-top: 0;
}

.popup-section-icon {
    font-size: 20px;
}

.popup-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #fac40d;
}

.popup-section {
    background: #fafafa;
    border: 1px solid rgba(130, 12, 34, 0.08);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 4px;
}

.popup-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 24px;
}

.popup-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(130, 12, 34, 0.05);
}

.popup-detail-row:last-child {
    border-bottom: none;
}

.popup-detail-icon {
    font-size: 15px;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.popup-detail-label {
    font-size: 12px;
    color: #888;
    font-weight: 500;
    flex-shrink: 0;
    min-width: 85px;
}

.popup-detail-value {
    font-size: 13px;
    color: #333;
    font-weight: 600;
    word-break: break-word;
}

.popup-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.popup-date-source {
    font-size: 11px;
    color: #888;
    font-weight: 400;
    font-style: italic;
}

.table-wrapper {
    overflow-x: auto;
    border: 2px solid rgba(130, 12, 34, 0.1);
    border-radius: 12px;
}

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

.evaluations-table thead {
    background: linear-gradient(135deg, #820c22, #a51028);
    color: white;
}

.evaluations-table th {
    padding: 12px 15px;
    text-align: right;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

.evaluations-table tbody tr {
    border-bottom: 1px solid rgba(130, 12, 34, 0.1);
}

.evaluations-table tbody tr:hover {
    background: rgba(130, 12, 34, 0.03);
}

.evaluations-table td {
    padding: 12px 15px;
    font-size: 13px;
}

.rating-cell {
display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 55px;
  height: 30px;
  border-radius: 10%;
  font-weight: 700;
  color: rgb(0, 0, 0);
}

.rating-1 { background: #e74c3c; }
.rating-2 { background: #e67e22; }
.rating-3 { background: #f39c12; }
.rating-4 { background: #2ecc71; }
.rating-5 { background: #27ae60; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.page-btn {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(130, 12, 34, 0.15);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #820c22;
    transition: all 0.3s ease;
}

.page-btn:hover {
    border-color: #820c22;
    background: rgba(130, 12, 34, 0.05);
}

.page-btn.active {
    background: linear-gradient(135deg, #820c22, #a51028);
    border-color: #820c22;
    color: #fac40d;
}

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

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #000000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(130, 12, 34, 0.1);
    border-top-color: #820c22;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.hidden {
    display: none !important;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 15px;
}

.empty-state-text {
    font-size: 18px;
    color: #666;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 992px) {
    .kpi-view-header {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
        padding: 20px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 15px;
    }

    .header-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box input {
        width: 100%;
    }

    .filters-box {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .filter-select {
        width: 100%;
        min-width: 0;
    }

    .view-toggle {
        justify-content: center;
        margin-top: 10px;
    }
}

@media (max-width: 768px) {
    .teachers-kpi-view-wrapper {
        padding: 10px;
        border-radius: 0;
    }

    .page-title {
        justify-content: center;
        margin-bottom: 10px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Teacher Card Mobile Optimizations */
    .teacher-card {
        padding: 15px;
    }

    .teacher-card-layout {
        gap: 15px;
    }

    .teacher-card-avatar {
        width: 60px;
        height: 60px;
    }

    .teacher-card-name {
        font-size: 14px;
    }

    .card-stat-value {
        font-size: 14px;
    }

    /* Modal Mobile Optimizations */
    .kpi-modal-content {
        width: 98%;
        margin: 5px auto;
        border-radius: 15px;
        max-height: 98vh;
    }

    .kpi-modal-header {
        padding: 10px 15px;
        flex-direction: row; /* Keep horizontal on mobile for compactness */
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .header-info {
        flex-direction: row; /* Side by side avatar and text */
        gap: 10px;
        align-items: center;
        text-align: right;
    }

    .modal-avatar {
        width: 45px;
        height: 45px;
        border-width: 2px;
    }

    .header-text h3 {
        font-size: 16px;
    }

    .modal-m-id {
        font-size: 11px;
        padding: 2px 8px;
    }

    .close-modal {
        font-size: 24px;
        width: 32px;
        height: 32px;
    }

    .kpi-modal-body {
        padding: 15px;
    }

    .modal-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 10px;
        flex-direction: row; /* Keep icon and text side by side */
        text-align: right;
        gap: 10px;
        align-items: center;
        justify-content: flex-start;
    }

    .stat-icon {
        width: 35px;
        height: 35px;
        font-size: 18px;
        flex-shrink: 0;
    }

    .stat-label {
        font-size: 10px;
    }

    .stat-value {
        font-size: 15px;
    }

    .charts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .chart-container {
        padding: 10px;
    }

    .filters-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .filter-group.actions {
        display: flex;
        flex-direction: row;
        gap: 10px;
        margin-top: 10px;
    }

    .btn {
        padding: 12px;
        font-size: 14px;
    }

    .evaluations-table {
        min-width: 600px; /* Ensure table doesn't squish too much, forces scroll */
    }

    .table-wrapper {
        -webkit-overflow-scrolling: touch;
        margin-bottom: 10px;
    }
}

@media (max-width: 580px) {
    .filters-box {
        grid-template-columns: 1fr;
    }

    .teacher-card-layout {
        flex-direction: column;
        text-align: center;
    }

    .teacher-card-right {
        width: 100%;
    }

    .teacher-card-divider {
        width: 80%;
        height: 1px;
        margin: 5px auto;
    }

    .teacher-card-left {
        width: 100%;
    }

    .modal-stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 20px;
    }

    .title-icon {
        font-size: 24px;
    }

    .filter-group.actions {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar Styling */
.teachers-kpi-view-wrapper ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.teachers-kpi-view-wrapper ::-webkit-scrollbar-track {
    background: rgba(130, 12, 34, 0.05);
}

.teachers-kpi-view-wrapper ::-webkit-scrollbar-thumb {
    background: #820c22;
    border-radius: 4px;
}

.teachers-kpi-view-wrapper ::-webkit-scrollbar-thumb:hover {
    background: #a51028;
}

/* ============================================
   EVALUATION DETAILS MODAL STYLES
   ============================================ */

.evaluation-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.evaluation-row:hover {
    background-color: rgba(130, 12, 34, 0.05);
}

.evaluation-details-content {
    max-width: 700px;
}

.evaluation-details-content .kpi-modal-header {
    background: linear-gradient(135deg, #820c22 0%, #a51028 100%);
    padding: 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.evaluation-details-content .kpi-modal-header h3 {
    color: #ffffff;
    margin: 0;
    font-size: 20px;
}

.evaluation-info-section,
.evaluation-ratings-section,
.evaluation-notes-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
}

.evaluation-info-section h4,
.evaluation-ratings-section h4,
.evaluation-notes-section h4 {
    color: #820c22;
    font-size: 16px;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #fac40d;
}

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

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.info-value {
    font-size: 15px;
    color: #333;
    font-weight: 600;
}

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

.rating-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.rating-display.rating-total {
    background: linear-gradient(135deg, #820c22 0%, #a51028 100%);
    border-color: #820c22;
}

.rating-display.rating-total .rating-label,
.rating-display.rating-total .rating-value {
    color: #ffffff;
}

.rating-label {
    font-size: 14px;
    color: #333;
}

.rating-value {
    font-size: 18px;
    font-weight: 700;
    color: #820c22;
}

.notes-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.note-item {
    padding: 12px 15px;
    background: #ffffff;
    border-radius: 8px;
    border-right: 4px solid #fac40d;
}

.note-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #820c22;
    margin-bottom: 8px;
}

.note-text {
    margin: 0;
    font-size: 14px;
    color: #555;
    line-height: 1.6;
}

.no-notes {
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 20px;
}

/* ============================================
   EVALUATION DETAILS EDITABLE MODAL STYLES
   ============================================ */

.zuwad-modal {
    position: fixed;
    z-index: 11000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.zuwad-modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    position: relative;
}

.zuwad-close-modal {
    position: absolute;
    left: 20px;
    top: 15px;
    font-size: 35px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
}

.zuwad-close-modal:hover,
.zuwad-close-modal:focus {
    color: #000;
}

.kpi-evaluation-content {
    padding: 30px;
}

.kpi-evaluation-content h3 {
    text-align: center;
    color: #820c22;
    margin: 0 0 25px 0;
    font-size: 22px;
    padding-bottom: 15px;
    border-bottom: 2px solid #fac40d;
}

.evaluation-info-header {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 10px;
    flex-wrap: wrap;
}

.evaluation-info-header .info-item {
    display: flex;
    gap: 10px;
    align-items: center;
}

.evaluation-info-header .info-label {
    font-weight: 600;
    color: #820c22;
}

.evaluation-info-header .info-value {
    color: #333;
}

.form-section {
    margin-bottom: 25px;
}

.form-section.compact-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.form-section h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 15px 0;
    color: #820c22;
    font-size: 16px;
}

.section-icon {
    font-size: 20px;
}

/* Star Rating Cards */
.rating-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
}

.rating-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.rating-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 5px;
}

.rating-icon {
    font-size: 18px;
}

.rating-header label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.rating-desc {
    font-size: 11px;
    color: #777;
    margin-bottom: 8px;
    line-height: 1.3;
}

/* Star Rating Styles - CRITICAL */
.rating-stars {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 4px;
    margin-top: auto;
}

.rating-stars span {
    font-size: 28px; /* Slightly larger for touch */
    cursor: pointer;
    color: #ddd;
    transition: color 0.2s;
    padding: 2px; /* Touch target */
}

/* Hover and active states using CSS sibling selectors */
.rating-stars span:hover,
.rating-stars span:hover ~ span,
.rating-stars span.active {
    color: #fac40d;
}

.rating-value-display {
    font-size: 16px;
    font-weight: 700;
    color: #820c22;
}

/* Text Grid for Notes */
.text-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

@media (max-width: 600px) {
    .text-grid {
        grid-template-columns: 1fr;
    }
    
    .rating-grid {
        grid-template-columns: 1fr;
    }

    .teacher-card-stats {
        grid-template-columns: 1fr;
    }
}

.form-group.small-group {
    margin-bottom: 0;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

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

.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: 'Qatar-medium', sans-serif;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
}

.form-group.no-margin {
    margin: 0;
}

/* General Rank Display */
.general-rank-display {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #820c22 0%, #a51028 100%);
    border-radius: 8px;
    color: #fff;
}

.general-rank-display .rank-value {
    font-size: 32px;
    font-weight: 700;
    display: block;
}

.general-rank-display .rank-label {
    font-size: 13px;
    opacity: 0.9;
}

/* Form Actions */
.form-actions {
    text-align: center;
    margin-top: 25px;
}

.submit-btn {
    background: linear-gradient(135deg, #820c22 0%, #a51028 100%);
    color: #ffffff;
    border: none;
    padding: 12px 40px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Qatar-medium', sans-serif;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(130, 12, 34, 0.3);
}

/* ============================================
   KPI EMPLOYEE STATS VIEW
   ============================================ */

.kpi-stats-view {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(130, 12, 34, 0.1);
}

.kpi-stats-header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.kpi-stats-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    color: #820c22;
    margin: 0;
}

.kpi-stats-filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kpi-month-select {
    min-width: 180px;
    padding: 10px 18px;
    border: 2px solid rgba(130, 12, 34, 0.15);
    border-radius: 20px;
    font-size: 15px;
    font-family: 'Qatar-medium', sans-serif;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.kpi-month-select:hover {
    border-color: #820c22;
}

.kpi-month-select:focus {
    outline: none;
    border-color: #820c22;
    box-shadow: 0 0 0 3px rgba(130, 12, 34, 0.1);
}

.kpi-stats-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #666;
}

.kpi-stats-empty {
    text-align: center;
    padding: 80px 20px;
}

.kpi-stats-empty .empty-state-icon {
    font-size: 64px;
    margin-bottom: 15px;
}

.kpi-stats-empty .empty-state-text {
    font-size: 18px;
    color: #666;
}

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

.kpi-stats-table th {
    padding: 15px;
    text-align: right;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.kpi-stats-table td {
    padding: 15px;
    font-size: 14px;
    white-space: nowrap;
}

.kpi-stat-num {
    font-size: 18px;
    font-weight: 700;
    color: #820c22;
}

.kpi-stats-cards-grid {
    display: none;
    grid-template-columns: 1fr;
    gap: 20px;
}

.kpi-emp-card {
    background: linear-gradient(180deg, #fff 0%, #f9f9f9 100%);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(130, 12, 34, 0.08);
    transition: all 0.3s ease;
}

.kpi-emp-card:hover {
    box-shadow: 0 6px 20px rgba(130, 12, 34, 0.12);
    border-color: #fac40d;
}

.kpi-emp-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 18px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(130, 12, 34, 0.1);
}

.kpi-emp-avatar {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fac40d;
}

.kpi-emp-name {
    font-size: 18px;
    font-weight: 700;
    color: #820c22;
    margin: 0;
}

.kpi-emp-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.kpi-emp-stat {
    background: linear-gradient(180deg, #f5f5f5, #eaeaea);
    padding: 12px;
    border-radius: 10px;
    text-align: center;
}

.kpi-emp-stat-highlight {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #820c22 0%, #a51028 100%);
}

.kpi-emp-stat-highlight .kpi-emp-stat-label {
    color: rgba(255, 255, 255, 0.85);
}

.kpi-emp-stat-highlight .kpi-emp-stat-value {
    color: #fac40d;
}

.kpi-emp-stat-label {
    font-size: 11px;
    color: #666;
    display: block;
    margin-bottom: 4px;
}

.kpi-emp-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #820c22;
}

.kpi-emp-card-action {
    margin-top: 15px;
    text-align: center;
}

.kpi-card-detail-btn {
    width: 100%;
}

.modal-detail-icon {
    font-size: 32px;
}

.kpi-detail-month-label {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #820c22;
    margin-bottom: 20px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 10px;
}

.kpi-detail-desktop-table {
    display: block;
}

.kpi-detail-mobile-cards {
    display: none;
    gap: 15px;
}

.kpi-detail-teacher-card {
    background: #ffffff;
    border: 1px solid rgba(130, 12, 34, 0.1);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
}

.kpi-detail-teacher-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(130, 12, 34, 0.08);
}

.kpi-detail-teacher-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.kpi-employee-detail-content {
    max-width: 700px;
}

/* KPI Stats Responsive */
@media (max-width: 992px) {
    .kpi-stats-header-section {
        flex-direction: column;
        align-items: stretch;
    }

    .kpi-stats-filter-row {
        justify-content: stretch;
    }

    .kpi-month-select {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .kpi-stats-view {
        padding: 15px;
        border-radius: 0;
    }

    .kpi-stats-section-title {
        font-size: 18px;
        justify-content: center;
    }

    #kpi-stats-table-container {
        display: none;
    }

    .kpi-stats-cards-grid {
        display: grid !important;
    }

    .kpi-emp-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .kpi-detail-desktop-table {
        display: none;
    }

    .kpi-detail-mobile-cards {
        display: block;
    }
}

@media (min-width: 769px) {
    .kpi-stats-cards-grid {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .kpi-emp-stats-grid {
        grid-template-columns: 1fr;
    }

    .kpi-emp-card {
        padding: 15px;
    }

    .kpi-emp-avatar {
        width: 45px;
        height: 45px;
    }

    .kpi-emp-name {
        font-size: 16px;
    }

    .kpi-emp-stat-value {
        font-size: 16px;
    }
}

/* ============================================
   RESPONSIVE DESIGN (Consolidated)
   ============================================ */

@media (max-width: 992px) {
    .kpi-view-header {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
        padding: 20px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 15px;
    }

    .header-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box input {
        width: 100%;
    }

    .filters-box {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .filter-select {
        width: 100%;
        min-width: 0;
    }

    .view-toggle {
        justify-content: center;
        margin-top: 10px;
    }
}

@media (max-width: 768px) {
    .teachers-kpi-view-wrapper {
        padding: 10px;
        border-radius: 0;
    }

    .page-title {
        justify-content: center;
        margin-bottom: 10px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Teacher Card Mobile Optimizations */
    .teacher-card {
        padding: 15px;
    }

    .teacher-card-layout {
        gap: 15px;
    }

    .teacher-card-avatar {
        width: 60px;
        height: 60px;
    }

    .teacher-card-name {
        font-size: 14px;
    }

    .card-stat-value {
        font-size: 14px;
    }

    /* Modal Mobile Optimizations */
    .kpi-modal-content {
        width: 98%;
        margin: 5px auto;
        border-radius: 15px;
        max-height: 98vh;
    }

    .kpi-modal-header {
        padding: 10px 15px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .header-info {
        flex-direction: row;
        gap: 10px;
        align-items: center;
        text-align: right;
    }

    .modal-avatar {
        width: 45px;
        height: 45px;
        border-width: 2px;
    }

    .header-text h3 {
        font-size: 16px;
    }

    .modal-m-id {
        font-size: 11px;
        padding: 2px 8px;
    }

    .close-modal {
        font-size: 24px;
        width: 32px;
        height: 32px;
    }

    .kpi-modal-body {
        padding: 15px;
    }

    .modal-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 10px;
        flex-direction: row;
        text-align: right;
        gap: 10px;
        align-items: center;
        justify-content: flex-start;
    }

    .stat-icon {
        width: 35px;
        height: 35px;
        font-size: 18px;
        flex-shrink: 0;
    }

    .stat-label {
        font-size: 10px;
    }

    .stat-value {
        font-size: 15px;
    }

    .charts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .filters-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .btn {
        padding: 12px;
        font-size: 14px;
    }

    .evaluations-table {
        min-width: 600px;
    }

    .table-wrapper {
        -webkit-overflow-scrolling: touch;
        margin-bottom: 10px;
    }

    /* KPI Evaluation Details */
    .ratings-grid, .info-grid, .rating-grid, .text-grid {
        grid-template-columns: 1fr !important;
    }

    .evaluation-info-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Profile table mobile */
    .profile-table {
        min-width: 750px;
    }

    .profile-table-container {
        -webkit-overflow-scrolling: touch;
    }

    .teachers-profile-view {
        padding: 10px;
    }

    .popup-details-grid {
        grid-template-columns: 1fr;
    }

    .profile-popup-content {
        width: 98%;
        margin: 5px auto;
        max-height: 98vh;
    }

    .popup-section-header {
        padding: 8px 12px;
    }

    .popup-section {
        padding: 8px 12px;
    }
}

@media (max-width: 600px) {
    .teacher-card-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 580px) {
    .filters-box {
        grid-template-columns: 1fr;
    }

    .teacher-card-layout {
        flex-direction: column;
        text-align: center;
    }

    .teacher-card-right {
        width: 100%;
    }

    .teacher-card-divider {
        width: 80%;
        height: 1px;
        margin: 5px auto;
    }

    .teacher-card-left {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 18px;
    }

    .title-icon {
        font-size: 20px;
    }

    .modal-stats-grid {
        grid-template-columns: 1fr;
    }

    .filter-group.actions {
        flex-direction: column;
    }
}

/* Ensure SweetAlert appears above the modal */
.swal2-container {
    z-index: 12000 !important;
}

.swal2-popup {
    z-index: 12000 !important;
}

/* Scrollbar Styling */
.teachers-kpi-view-wrapper ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.teachers-kpi-view-wrapper ::-webkit-scrollbar-track {
    background: rgba(130, 12, 34, 0.05);
}

.teachers-kpi-view-wrapper ::-webkit-scrollbar-thumb {
    background: #820c22;
    border-radius: 4px;
}

.teachers-kpi-view-wrapper ::-webkit-scrollbar-thumb:hover {
    background: #a51028;
}
