/* =================================================================
   IFD LMS STUDENTS PAGE STYLES
   ================================================================= */

/* General Page Styles */
.ifd-students-page .description {
    font-size: 16px;
    margin-bottom: 30px;
    color: #666;
}

/* =================================================================
   TABLE AND FILTERING STYLES
   ================================================================= */

.filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    box-sizing: border-box;
    position: relative;
    float: unset;
    margin: 0px;
    padding: 0px;
    width: unset;
    background: none;
    border: none;
    box-shadow: none;
}

.search-input, .filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Status Badges */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #fff3cd;
    color: #856404;
}

/* Course Info in Table */
.courses-count {
    color: #7B2B85;
    font-weight: 600;
}

.no-courses {
    color: #666;
    font-style: italic;
}

.never-login {
    color: #999;
    font-style: italic;
}

/* Action buttons styling */
.column-actions .action-buttons {
    display: flex !important;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
    visibility: visible !important;
    opacity: 1 !important;
}

.column-actions .action-buttons .button {
    margin: 0;
    font-size: 11px;
    padding: 2px 6px;
    white-space: nowrap;
    visibility: visible !important;
    opacity: 1 !important;
    display: inline-block !important;
}

/* Force override WordPress default hover behavior with very specific selectors */
.ifd-students-page .wp-list-table .action-buttons,
.ifd-students-page #students-table .action-buttons,
.ifd-students-page #students-table tbody tr .action-buttons,
.ifd-students-page #students-table tbody tr:not(:hover) .action-buttons {
    visibility: visible !important;
    opacity: 1 !important;
    display: flex !important;
}

/* Force all buttons in action-buttons to be visible */
.ifd-students-page .wp-list-table .action-buttons .button,
.ifd-students-page #students-table .action-buttons .button,
.ifd-students-page #students-table tbody tr .action-buttons .button,
.ifd-students-page #students-table tbody tr:not(:hover) .action-buttons .button {
    visibility: visible !important;
    opacity: 1 !important;
    display: inline-block !important;
}

/* Sorting */
.sort-link {
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    color: inherit;
}

.sort-link:hover {
    color: #7B2B85;
}

.sorting-indicator {
    font-size: 0.8em;
    opacity: 0.5;
}

.sorting-indicator::after {
    content: "↕";
}

.sort-asc .sorting-indicator::after {
    content: "↑";
    opacity: 1;
}

.sort-desc .sorting-indicator::after {
    content: "↓";
    opacity: 1;
}

/* No Students */
.no-students {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.no-students p {
    font-size: 1.2em;
    margin-bottom: 20px;
}

/* =================================================================
   GENERAL MODAL STYLES
   ================================================================= */

.students-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    max-width: 1200px;
    width: 95%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.3em;
    color: #7B2B85;
}

.close-modal {
    font-size: 24px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.close-modal:hover {
    color: #7B2B85;
}

.modal-body {
    padding: 20px;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

.loading:before {
    content: "⏳ ";
    font-size: 1.2em;
}

/* Edit Mode Styles */
.edit-mode {
    display: none !important;
}

form.edit-mode-active .edit-mode {
    display: block !important;
}

form.edit-mode-active .view-mode {
    display: none !important;
}

/* Add additional specificity for toggle buttons */
.edit-toggle button {
    cursor: pointer;
}

/* =================================================================
   STUDENT DETAILS MODAL STYLES (GENERAL)
   ================================================================= */

/* Modal form styling */
.student-details-info {
    max-width: 100%;
}

.student-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e1e1e1;
}

.student-header img {
    border-radius: 50%;
}

.student-info {
    flex: 1;
    align-items: flex-start;
    gap: 0px;
    flex-direction: column;
}

.student-info h3 {
    margin: 0 0 5px 0;
    color: #7B2B85;
}

.student-info p {
    margin: 0;
    color: #666;
    font-size: 0.9em;
}

.edit-toggle {
    margin-left: auto;
}

.user-details-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 20px;
}

.details-section {
    margin-bottom: 25px;
    background: #f3e8f5;
    padding: 20px;
    border-radius: 5px;
    border-left: 4px solid #7B2B85;
}

.details-section h4 {
    margin: 0 0 15px 0;
    color: #7B2B85;
    font-size: 1.1em;
}

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

.detail-item {
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: white;
    border-radius: 3px;
    border: 1px solid #e1e1e1;
}

.stat-item label,
.detail-item label,
.password-reset-fields label {
    font-weight: 700;
    color: #555;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.detail-item span.view-mode {
    color: #333;
    word-wrap: break-word;
}

.detail-item input,
.detail-item select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
}

.detail-item input:focus,
.detail-item select:focus {
    border-color: #7B2B85;
    box-shadow: 0 0 0 1px #7B2B85;
    outline: none;
}

/* Button styling for edit mode */
.button-primary {
    background: #7B2B85 !important;
    border-color: #7B2B85 !important;
    box-shadow: none !important;
}

.button-primary:hover {
    background: #6a2373 !important;
    border-color: #6a2373 !important;
}

.button-secondary {
    color: #7B2B85 !important;
    border-color: #7B2B85 !important;
}

.button-secondary:hover {
    color: #6a2373 !important;
    border-color: #6a2373 !important;
}

/* =================================================================
   STUDENT COURSES MODAL STYLES
   ================================================================= */

.student-courses-info {
    padding: 20px;
}

.student-courses-info .student-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #7B2B85;
}

.student-courses-info .student-header img {
    margin-right: 15px;
    border-radius: 50%;
}

.student-courses-info .student-info h3 {
    margin: 0 0 5px 0;
    color: #7B2B85;
}

.student-courses-info .student-info p {
    margin: 0;
    color: #666;
}

.courses-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding: 15px;
    background: #f3e8f5;
    border-radius: 8px;
}

.summary-item {
    text-align: center;
    flex: 1;
}

.summary-item strong {
    display: block;
    font-size: 24px;
    color: #7B2B85;
    margin-bottom: 5px;
}

.summary-item span {
    color: #666;
    font-size: 14px;
}

.courses-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.course-item {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
}

.course-item.completed {
    border-color: #4CAF50;
    background: #f8fff8;
}

.course-item.in-progress {
    border-color: #FF9800;
    background: #fff8f0;
}

.course-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.course-header h5 {
    margin: 0;
    color: #333;
}

.course-status {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.course-status.completed {
    background: #4CAF50;
    color: white;
}

.course-status.progress {
    background: #bf4f17;
    color: white;
}

.course-status.assessment-ready {
    background: #8c0304;
    color: white;
}

.course-status.iqa-ready {
    background: #00642e;
    color: white;
}

.course-status.liqa-ready {
    background: #3a0456;
    color: white;
}

.course-status.external-ready {
    background: #26a69a;
    color: white;
}

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

.course-group-header {
    background: #f5f5f5;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 10px;
    border-left: 4px solid #7B2B85;
    font-size: 14px;
}

.course-group-header strong {
    color: #7B2B85;
    display: block;
    margin-bottom: 4px;
}

.course-group-meta {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    font-weight: normal;
}

.course-group-items {
    margin-left: 12px;
}

.course-group-items .course-item {
    margin-bottom: 10px;
}

.course-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #7B2B85;
    transition: width 0.3s ease;
}

.progress-text {
    font-weight: bold;
    color: #7B2B85;
    min-width: 35px;
}

.course-dates {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: #666;
}

/* =================================================================
   ENHANCED STUDENT DETAILS MODAL STYLES
   ================================================================= */

.student-details-modal-content {
    max-width: 1200px;
    margin: 0 auto;
}

.student-details-info .modal-actions {
    text-align: right;
}

.student-details-info .modal-actions .button {
    margin-left: 10px;
    background: #7B2B85;
    border-color: #7B2B85;
    color: white;
}

.student-details-info .modal-actions .button:hover {
    background: #6a2570;
    border-color: #6a2570;
}

.student-details-info .modal-actions .button-secondary {
    background: #f3e8f5;
    border-color: #7B2B85;
    color: #7B2B85;
}

.student-details-info .modal-actions .button-secondary:hover {
    background: #e6d1ea;
}

.modal-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.modal-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #7B2B85;
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal-section h3 {
    margin: 0 0 15px 0;
    color: #7B2B85;
    font-size: 16px;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

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

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #7B2B85;
    box-shadow: 0 0 0 2px rgba(123, 43, 133, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-actions {
    margin-top: 20px;
    padding-top: 20px;
    text-align: center;
}

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

.stat-item {
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #ddd;
    min-height: 74px;
    align-content: center;
    justify-items: center;
    text-align: center;
}

.stat-item strong {
    display: block;
    font-size: 24px;
    color: #7B2B85;
    margin-bottom: 5px;
}

.stat-item span {
    color: #666;
    font-size: 14px;
}

.no-courses {
    color: #666;
}

/* Password Reset Section Styles */
#password-reset-section {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #7B2B85;
    margin-top: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.password-reset-fields {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.password-reset-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.password-reset-info {
    margin-bottom: 0;
}

.password-reset-warning {
    color: #d94f4f;
    font-weight: 500;
    margin-bottom: 0;
}

.password-reset-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

#confirm-reset-password {
    background-color: #d94f4f;
    border-color: #d94f4f;
}

#confirm-reset-password:hover {
    background-color: #c13c3c;
    border-color: #c13c3c;
}

/* =================================================================
   MANAGER ASSIGNMENT STYLES
   ================================================================= */

.manager-assignment-item .assigned-manager {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.manager-assignment-item .assigned-manager img {
    border-radius: 50%;
}

.manager-assignment-item .manager-info {
    flex: 1;
}

.manager-assignment-item .manager-info strong {
    display: block;
    color: #333;
    font-size: 14px;
}

.manager-assignment-item .manager-info small {
    color: #666;
    font-size: 12px;
}

.manager-assignment-item .no-manager {
    color: #999;
    font-style: italic;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    display: block;
}

.manager-assignment-item select {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Manager assignment in table */
.manager-assignment {
    display: flex;
    align-items: center;
    gap: 8px;
}

.manager-assignment img {
    border-radius: 50%;
}

.manager-assignment .manager-details {
    flex: 1;
}

.manager-assignment .manager-details strong {
    display: block;
    font-size: 13px;
    line-height: 1.2;
}

.manager-assignment .manager-details small {
    color: #666;
    font-size: 11px;
    line-height: 1.1;
}

.no-manager {
    color: #999;
    font-style: italic;
    font-size: 12px;
}

/* =================================================================
   RESPONSIVE STYLES
   ================================================================= */

@media (max-width: 768px) {
    /* Student modal responsive styles */
    .user-details-container,
    .modal-columns {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .student-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .edit-toggle {
        margin-left: 0;
    }
    
    /* Table responsive styles */
    .students-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input, .filter-select {
        width: 100%;
    }
    
    .students-table th:not(.column-primary),
    .students-table td:not(.column-primary) {
        display: none;
    }
    
    .student-info {
        flex-direction: column;
        text-align: center;
    }
    
    .row-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .students-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-box h3 {
        font-size: 2em;
    }
}

/* =================================================================
   DOWNLOAD STUDENT ANSWERS BUTTON STYLES
   ================================================================= */

.download-student-answers {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
}

.download-student-answers:hover {
    background: #218838 !important;
    border-color: #1e7e34 !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.download-student-answers:disabled {
    background: #6c757d !important;
    border-color: #6c757d !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Progress page download button */
.masterstudy-student-progress__top-right .download-student-answers {
    font-size: 14px;
    padding: 10px 16px;
    border-radius: 6px;
    margin-top: 10px;
}

/* Action buttons alignment */
.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
}

.action-buttons .download-student-answers {
    margin-left: 5px;
}

@media (max-width: 768px) {
    .download-student-answers {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 3px;
    }
    
    .action-buttons .download-student-answers {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }
}

/* Course item download button styles */
.course-item .course-download-btn {
    background: #0073aa !important;
    color: white !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
    border-radius: 3px !important;
    text-decoration: none !important;
    display: inline-block !important;
    margin-left: 10px !important;
    vertical-align: middle !important;
    border: none !important;
    cursor: pointer !important;
}

.course-item .course-download-btn:hover {
    background: #005a87 !important;
    color: white !important;
}

.course-item .course-download-btn:disabled {
    background: #ccc !important;
    cursor: not-allowed !important;
}

/* Ensure course header has enough space */
.course-item .course-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
}

.course-item .course-header h5 {
    flex: 1 !important;
    margin-right: 10px !important;
}

/* =================================================================
   ADD CURRENT COURSES MODAL STYLES
   ================================================================= */

#add-current-courses-modal .modal-body {
    padding: 20px;
}

#add-current-courses-modal input[type="text"] {
    font-size: 14px;
}

#add-current-courses-modal label[style*="display: block"] {
    transition: background-color 0.2s;
}

#add-current-courses-modal label[style*="display: block"]:hover {
    background: #f9f9f9 !important;
}

#add-current-courses-modal input[type="checkbox"]:checked + strong {
    color: #7B2B85;
}

.current-courses-accordion {
    margin-bottom: 15px;
}

#courses-list-container {
    margin-top: 15px;
}

#courses-loading {
    text-align: center;
    padding: 30px;
}

#courses-loading .spinner {
    margin: 0 auto 10px;
}
