/* Improvements CSS - All new styles for enhanced features */

/* Section Search Styles */
.section-search {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.section-search input,
.section-search select {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
}

.section-search input:focus,
.section-search select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Assignment Counts */
.assignment-counts,
.resource-counts,
.log-counts,
.test-counts {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.count-item {
    font-size: 14px;
    color: var(--text-secondary);
}

.count-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Quote Box Styles */
.quote-box {
    padding: 24px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--primary);
}

.quote-box blockquote {
    margin: 0;
    font-style: italic;
}

.quote-box blockquote p {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.quote-box cite {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Test Schedule Styles */
.test-schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.test-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.test-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--warning) !important;
}

.test-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

/* Match assignment card styling */
.assignment-card {
    background: var(--bg-primary);
    border: 2px solid var(--primary-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.assignment-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--warning);
}

.assignment-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.assignment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    padding-top: 4px;
}

.assignment-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.assignment-category {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.assignment-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.assignment-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 500;
    background: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.assignment-actions {
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px 12px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.checkbox-label:hover {
    background: rgba(37, 99, 235, 0.15);
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
    transform: scale(1.2);
}

.test-card.test-scheduled {
    border: 2px solid #2563eb;
}

.test-card.test-cancelled {
    border: 2px solid #ef4444;
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(239, 68, 68, 0.05) 100%) !important;
}

.test-card.test-postponed {
    border: 2px solid #f59e0b;
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(245, 158, 11, 0.05) 100%) !important;
}

.test-card.test-done {
    border: 2px solid #10b981;
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(16, 185, 129, 0.05) 100%) !important;
    opacity: 0.9;
}

.test-card.test-rescheduled {
    border: 2px solid #2563eb;
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(37, 99, 235, 0.08) 100%) !important;
}

.test-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-top: 4px;
}

.test-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.test-status {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.test-status.scheduled {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.test-status.cancelled {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.test-status.postponed {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.test-status.completed {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.test-topic {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
    background: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.test-date {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    padding: 8px 12px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: var(--radius-sm);
}

.test-date i {
    color: var(--primary);
    font-size: 16px;
}

/* Test Date History Styles */
.test-dates {
    margin-bottom: 16px;
}

.date-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 4px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.date-item.current {
    background: rgba(37, 99, 235, 0.1);
    color: var(--text-primary);
    font-weight: 500;
}

.date-item.old {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    opacity: 0.8;
}

.date-item.cancelled {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.date-item i {
    font-size: 12px;
    opacity: 0.7;
}

.date-item.current i {
    color: var(--primary);
}

.date-item.old i {
    color: var(--text-muted);
}

.date-item.cancelled i {
    color: var(--danger);
}

.strikethrough {
    text-decoration: line-through;
    opacity: 0.7;
}

.pending-date {
    font-style: italic;
    color: var(--warning);
    font-weight: 500;
}

.date-item small {
    font-size: 10px;
    opacity: 0.6;
    margin-left: auto;
}

/* Admin Panel Styles */
.admin-btn {
    padding: 6px 12px;
    margin: 2px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    opacity: 1;
    visibility: visible;
    display: inline-block;
}

.admin-btn.cancel {
    background: var(--danger);
    color: white;
    border: 1px solid var(--danger);
}

.admin-btn.postpone {
    background: var(--warning);
    color: white;
    border: 1px solid var(--warning);
}

.admin-btn.reschedule {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
}

.admin-btn.done {
    background: var(--success);
    color: white;
    border: 1px solid var(--success);
}

.admin-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.admin-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Admin table actions cell */
#adminTestScheduleTable td:last-child {
    white-space: nowrap;
    padding: 8px;
}

#adminTestScheduleTable .admin-btn {
    margin: 1px 2px;
    text-align: center;
}

/* Delete button styling */
.delete-btn {
    padding: 6px 12px;
    margin: 2px;
    background: var(--danger);
    color: white;
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.delete-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.delete-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.postponed-text {
    color: var(--warning);
    font-weight: 500;
    font-style: italic;
}

.test-status.done {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.test-status.rescheduled {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.add-to-calendar-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: 2px solid var(--primary);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    box-shadow: 0 3px 6px rgba(37, 99, 235, 0.25);
    text-decoration: none;
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.add-to-calendar-btn:hover {
    background: linear-gradient(135deg, var(--primary-dark), #1e40af);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.35);
}

.add-to-calendar-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(37, 99, 235, 0.25);
}

.add-to-calendar-btn i {
    font-size: 16px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.test-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

/* Status Badges */
.status-badge {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-badge.completed {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.status-badge.scheduled {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.status-badge.cancelled {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.status-badge.postponed {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* Table Improvements */
.table-container table tr.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.table-container table tr.test-cancelled {
    opacity: 0.6;
    background: rgba(239, 68, 68, 0.05);
}

.table-container table tr.test-postponed {
    background: rgba(245, 158, 11, 0.05);
}

.table-container table tr.test-completed {
    background: rgba(34, 197, 94, 0.05);
}

/* Notification Improvements */
.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
}

.notification-item:hover {
    background: var(--color-surface-secondary);
}

.notification-item.unread {
    background: rgba(37, 99, 235, 0.05);
    border-left: 3px solid var(--primary);
}

.notification-item.navigable {
    position: relative;
}

.notification-item.navigable:hover {
    background: rgba(37, 99, 235, 0.1);
}

.notification-nav-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    color: var(--primary);
    font-size: 12px;
    opacity: 0.7;
}

.notification-separator {
    height: 1px;
    background: var(--border-light);
    margin: 0;
}

.notification-separator:last-child {
    display: none;
}

.notification-content {
    flex: 1;
}

.notification-content strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.notification-content p {
    margin: 0 0 8px 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
}

.notification-content small {
    color: var(--text-muted);
    font-size: 12px;
}

/* Body-level Theme Transition */
body {
    transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out !important;
}

*:not(.test-item):not(.show-more-btn i):not(.sidebar):not(.notification-dropdown):not(.notification-item):not(.profile-settings-modal):not(.profile-settings-modal .modal-content):not(.profile-settings-tab):not(.profile-settings-tab span):not(.nav-toggle):not(.mobile-search-dropdown):not(.mobile-search-dropdown *):not(.profile-panel):not(.profile-panel-overlay):not(.uc-card):not(.uc-face):not(.uc-avatar):not(.modal-overlay):not(.login-modal):not(.modal-content):not(.modal-close) {
    transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out, border-color 0.3s ease-in-out !important;
}

/* Category Tabs Improvements */
.category-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.category-tab {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.category-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.category-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}



/* Assignment/Test Counts Mobile Fix */
.assignment-counts,
.resource-counts,
.log-counts,
.test-counts {
    display: flex !important;
    gap: 1rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.assignment-counts::-webkit-scrollbar,
.resource-counts::-webkit-scrollbar,
.log-counts::-webkit-scrollbar,
.test-counts::-webkit-scrollbar {
    display: none;
}

.count-item {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Mobile responsive overrides */
@media (max-width: 768px) {
    .category-tabs {
        flex-wrap: nowrap !important;
        flex-direction: row !important;
    }
    
    .assignment-counts,
    .resource-counts,
    .log-counts,
    .test-counts {
        flex-direction: row !important;
    }
    
    /* Force horizontal layout with higher specificity */
    #resourcesCategoryTabs,
    #assignmentsCategoryTabs,
    #logsCategoryTabs {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
    }
    
    #resourcesCategoryTabs .category-tab,
    #assignmentsCategoryTabs .category-tab,
    #logsCategoryTabs .category-tab {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }
    

}

/* Dark Mode Button Improvements */

[data-theme="dark"] .admin-btn:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}


/* Dark Mode Test Card Improvements */

[data-theme="dark"] .test-card.test-cancelled {
    background: linear-gradient(135deg, #1f2937 0%, rgba(239, 68, 68, 0.08) 100%) !important;
}

[data-theme="dark"] .test-card.test-postponed {
    background: linear-gradient(135deg, #1f2937 0%, rgba(245, 158, 11, 0.08) 100%) !important;
}

[data-theme="dark"] .test-card.test-done {
    background: linear-gradient(135deg, #1f2937 0%, rgba(16, 185, 129, 0.08) 100%) !important;
}

[data-theme="dark"] .test-card.test-rescheduled {
    background: linear-gradient(135deg, #1f2937 0%, rgba(37, 99, 235, 0.1) 100%) !important;
}

[data-theme="dark"] .add-to-calendar-btn {
    background: linear-gradient(135deg, var(--color-primary-600), var(--color-primary-700));
    border-color: var(--color-primary-500);
    box-shadow: 0 3px 6px rgba(37, 99, 235, 0.3);
}

[data-theme="dark"] .add-to-calendar-btn:hover {
    background: linear-gradient(135deg, var(--color-primary-700), var(--color-primary-800));
    border-color: var(--warning);
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.4);
}

/* Dark Mode Improvements */
[data-theme="dark"] .quote-box {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
}



[data-theme="dark"] .test-card:hover,
[data-theme="dark"] .assignment-card:hover,
[data-theme="dark"] .online-test-card:hover {
    box-shadow: 0 8px 25px rgba(139, 139, 139, 0.4);
}

[data-theme="dark"] .test-topic,
[data-theme="dark"] .assignment-content p {
    background: var(--bg-tertiary);
    border-left-color: var(--primary-light);
}

[data-theme="dark"] .test-date,
[data-theme="dark"] .checkbox-label {
    background: rgba(37, 99, 235, 0.1);
}

[data-theme="dark"] .date-item.current {
    background: rgba(37, 99, 235, 0.1);
}

[data-theme="dark"] .date-item.old {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .date-item.cancelled {
    background: rgba(239, 68, 68, 0.1);
}

[data-theme="dark"] .pending-date {
    color: #fbbf24;
}

[data-theme="dark"] .postponed-text {
    color: #fbbf24;
}

[data-theme="dark"] .checkbox-label:hover {
    background: rgba(37, 99, 235, 0.15);
}

[data-theme="dark"] .assignment-category {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-light);
}

[data-theme="dark"] .add-to-calendar-btn {
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

[data-theme="dark"] .add-to-calendar-btn:hover {
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.4);
}

[data-theme="dark"] .notification-item.unread {
    background: rgba(37, 99, 235, 0.1);
}

[data-theme="dark"] .assignment-counts,
[data-theme="dark"] .resource-counts,
[data-theme="dark"] .log-counts,
[data-theme="dark"] .test-counts {
    background: var(--bg-secondary);
    border-color: var(--border-light);
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .section-search {
        flex-direction: column;
    }
    
    .assignment-counts,
    .resource-counts,
    .log-counts,
    .test-counts {
        flex-direction: column;
        gap: 8px;
    }
    
    .test-schedule-grid {
        grid-template-columns: 1fr;
    }
    
    .category-tabs {
        flex-direction: column;
    }
    
    .test-header {
        flex-direction: column;
        gap: 8px;
    }
}

/* Loading and Empty States */

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Animation Improvements */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-item,
.quote-box {
    animation: slideIn 0.3s ease-out;
}

/* Focus Improvements */
.add-to-calendar-btn:focus,
.category-tab:focus,
.section-search input:focus,
.section-search select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .test-card,
    .online-test-card,
    .quote-box,
    .assignment-counts,
    .resource-counts,
    .log-counts,
    .test-counts {
        break-inside: avoid;
    }
    
    .notification-item {
        border: 1px solid #ddd;
        margin-bottom: 8px;
    }
}

/* Notification Dropdown Mobile Fixes and Rolling Transitions */
.notification-dropdown {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top right;
    max-height: 0;
    overflow: hidden;
}

.notification-dropdown.active {
    max-height: 400px;
    transform: translateY(0) scaleY(1);
}

/* Mobile notification dropdown fixes */
@media (max-width: 768px) {
    .notification-dropdown {
        position: fixed;
        top: 64px;
        right: 0;
        left: 0;
        width: 100%;
        height: calc(100vh - 64px);
        border-radius: 0;
        transform: translateX(-100%);
        max-width: none;
        z-index: 1002;
    }
    
    .notification-dropdown.active {
        transform: translateX(0);
        max-height: none;
    }
    
    .notification-list {
        max-height: none;
        height: calc(100vh - 140px);
    }
}

/* Rolling transition for notification items */
.notification-item {
    transform: translateX(-100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-dropdown.active .notification-item {
    transform: translateX(0);
    opacity: 1;
}

.notification-dropdown.active .notification-item:nth-child(1) { transition-delay: 0.1s; }
.notification-dropdown.active .notification-item:nth-child(2) { transition-delay: 0.15s; }
.notification-dropdown.active .notification-item:nth-child(3) { transition-delay: 0.2s; }
.notification-dropdown.active .notification-item:nth-child(4) { transition-delay: 0.25s; }
.notification-dropdown.active .notification-item:nth-child(5) { transition-delay: 0.3s; }
.notification-dropdown.active .notification-item:nth-child(n+6) { transition-delay: 0.35s; }