/* Modal System Styles */

.app-modal {
    /* Remove conflicting centering and sizing here to use only main.css rules */
    /* position: fixed; */
    /* top: 0; */
    /* left: 0; */
    /* width: 100%; */
    /* height: 100%; */
    /* background: rgba(0, 0, 0, 0.5); */
    /* backdrop-filter: blur(5px); */
    /* display: flex; */
    /* justify-content: center; */
    /* align-items: center; */
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.app-modal.show {
    opacity: 1;
    visibility: visible;
}

/* App Modal Content */
.app-modal-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(50px);
    transition: all 0.3s ease;
    position: relative;
}

.app-modal.show .app-modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-title {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.close-btn:hover {
    color: #333;
    background: #f0f0f0;
}

/* Modal body content */
.modal-body {
    margin-bottom: 20px;
}

/* Modal sections */
.modal-section {
    margin-bottom: 25px;
}

.modal-section h4 {
    margin-bottom: 15px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

/* Admin tools grid */
.admin-tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* System admin content */
.admin-content {
    display: none;
}

.admin-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 10px;
    }
    
    .admin-tool-grid {
        grid-template-columns: 1fr;
    }
}

/* Modal accessibility */
.app-modal[aria-hidden="true"] {
    display: none;
}

.modal-content:focus {
    outline: none;
}

/* Focus trap for modals */
.modal-content button:first-of-type {
    margin-right: auto;
}

.modal-content button:last-of-type {
    margin-left: auto;
}

/* Login Modal Overlay (for loginModal only) */
#loginModal.modal {
    position: fixed !important;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    z-index: 99999;
    overflow: hidden;
}
#loginModal .modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 32px 32px 24px 32px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
    min-width: 320px;
    max-width: 95vw;
    min-height: 0;
    margin: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.3s;
}

body.modal-open {
    overflow: hidden !important;
}

/* Subject Management Modal Styles */
.subjects-display {
    max-height: 400px;
    overflow-y: auto;
}

.subjects-filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

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

.filter-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
}

.filter-group select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 0.9rem;
}

.subject-category-section {
    margin-bottom: 25px;
}

.category-title {
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
    font-size: 1.1rem;
}

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

.subject-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.subject-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

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

.subject-header h5 {
    margin: 0;
    color: #333;
    font-size: 1rem;
}

.subject-code {
    background: #007bff;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.subject-details {
    margin-bottom: 15px;
}

.subject-details p {
    margin: 5px 0;
    font-size: 0.9rem;
    color: #666;
}

.subject-details strong {
    color: #333;
}

.status {
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

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

.status.inactive {
    background: #f8d7da;
    color: #721c24;
}

.subject-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.subject-actions .btn {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Enrollment Management Modal Styles */
.enrollments-display {
    max-height: 400px;
    overflow-y: auto;
}

.enrollments-stats {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.enrollments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.enrollment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.enrollment-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.enrollment-info h5 {
    margin: 0 0 8px 0;
    color: #333;
}

.enrollment-info p {
    margin: 3px 0;
    font-size: 0.9rem;
    color: #666;
}

.enrollment-actions {
    display: flex;
    gap: 8px;
}

.enrollment-actions .btn {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Loading and empty states */
.loading, .error, .empty-state {
    text-align: center;
    padding: 40px 20px;
    font-size: 1rem;
    color: #666;
}

.error {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
}

.empty-state {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}
