/**
 * Course Search & Schedule Styles
 */

/* ==========================================
   Trending Card
   ========================================== */
.trending-card {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, var(--card-bg) 100%);
    border: 2px solid rgba(255, 107, 107, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.2);
}

.trending-header {
    margin-bottom: 14px;
}

.trending-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.trending-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

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

.trending-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--card-bg);
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.trending-item:hover {
    border-color: #FF6B6B;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.2);
}

.trending-rank {
    font-size: 20px;
    font-weight: 700;
    min-width: 32px;
    text-align: center;
    color: #FF6B6B;
}

.trending-content {
    flex: 1;
}

.trending-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.trending-count {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.trending-icon {
    font-size: 20px;
    color: #FF6B6B;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.trending-item:hover .trending-icon {
    opacity: 1;
    transform: translateX(4px);
}

.trending-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
}

/* ==========================================
   Deadlines Card
   ========================================== */
.deadlines-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.deadlines-header {
    margin-bottom: 20px;
}

.deadlines-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.deadlines-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Scrollbar styling for deadlines list */
.deadlines-list::-webkit-scrollbar {
    width: 6px;
}

.deadlines-list::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 3px;
}

.deadlines-list::-webkit-scrollbar-thumb {
    background: var(--purdue-gold);
    border-radius: 3px;
}

.deadlines-list::-webkit-scrollbar-thumb:hover {
    background: #B8A87A;
}

.deadline-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: 8px;
    border-left: 4px solid #ccc;
    transition: all 0.3s ease;
}

.deadline-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.deadline-item.urgent {
    border-left-color: #f44336;
    background: linear-gradient(90deg, rgba(244, 67, 54, 0.1) 0%, var(--bg-primary) 100%);
}

.deadline-item.high-priority {
    border-left-color: #FF9800;
    background: linear-gradient(90deg, rgba(255, 152, 0, 0.1) 0%, var(--bg-primary) 100%);
}

.deadline-item.medium-priority {
    border-left-color: #CFB991;
    background: linear-gradient(90deg, rgba(207, 185, 145, 0.1) 0%, var(--bg-primary) 100%);
}

.deadline-item.low-priority {
    border-left-color: #4CAF50;
}

.deadline-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.deadline-content {
    flex: 1;
}

.deadline-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.deadline-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.deadline-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.deadline-date {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.deadline-countdown {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    background: #e0e0e0;
    color: #000;
}

.deadline-countdown.urgent {
    background: #f44336;
    color: #fff;
}

.deadline-countdown.high-priority {
    background: #FF9800;
    color: #fff;
}

.deadline-countdown.medium-priority {
    background: #CFB991;
    color: #000;
}

.deadline-countdown.low-priority {
    background: #4CAF50;
    color: #fff;
}

/* ==========================================
   Course Planner Section
   ========================================== */
.course-planner {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.course-planner.highlighted {
    border: 3px solid #CFB991;
    background: linear-gradient(135deg, rgba(207, 185, 145, 0.15) 0%, var(--card-bg) 100%);
    box-shadow: 0 4px 16px rgba(207, 185, 145, 0.3);
}

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

.course-planner-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.course-planner-badge {
    background: #CFB991;
    color: #000;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* ==========================================
   Search Bar
   ========================================== */
.course-search-container {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.course-search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.course-search-input:focus {
    outline: none;
    border-color: #CFB991;
    box-shadow: 0 0 0 3px rgba(207, 185, 145, 0.1);
}

.term-select {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    min-width: 200px;
}

.course-search-button {
    padding: 12px 32px;
    background: #CFB991;
    color: #000;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.course-search-button:hover {
    background: #B89968;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(207, 185, 145, 0.3);
}

.course-search-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================
   Loading Indicator
   ========================================== */
.search-loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.search-loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60% { content: '...'; }
    80%, 100% { content: ''; }
}

/* ==========================================
   Course Results
   ========================================== */
.course-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.course-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.course-card:hover {
    border-color: #CFB991;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

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

.course-code {
    font-size: 18px;
    font-weight: 700;
    color: #CFB991;
}

.course-credits {
    font-size: 14px;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 4px 8px;
    border-radius: 4px;
}

.course-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.course-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.view-sections-btn {
    width: 100%;
    padding: 10px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-sections-btn:hover {
    background: #CFB991;
    color: #000;
    border-color: #CFB991;
}

/* ==========================================
   Sections Display
   ========================================== */
.course-sections {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid var(--border-color);
}

.course-sections h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.sections-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-card {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s ease;
}

.section-card.selected {
    border-color: #CFB991;
    background: rgba(207, 185, 145, 0.1);
}

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

.section-crn {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.section-type {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--card-bg);
    padding: 2px 8px;
    border-radius: 4px;
}

.section-info {
    margin-bottom: 12px;
}

.section-times {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.6;
}

.section-availability {
    font-size: 12px;
    color: #4CAF50;
    font-weight: 600;
}

.section-availability.full {
    color: #f44336;
}

.add-section-btn {
    width: 100%;
    padding: 8px;
    background: #CFB991;
    color: #000;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-section-btn:hover {
    background: #B89968;
}

.add-section-btn.selected {
    background: #f44336;
    color: #fff;
}

.add-section-btn:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
}

/* ==========================================
   Empty States
   ========================================== */
.no-results,
.no-sections {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.no-results .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.no-results h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.no-results p {
    font-size: 14px;
}

.no-sections {
    padding: 20px;
    font-size: 14px;
}

.loading-sections {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.error-message {
    background: #ffebee;
    border: 2px solid #f44336;
    border-radius: 8px;
    padding: 16px;
    color: #c62828;
    text-align: center;
}

.dark-theme .error-message {
    background: rgba(244, 67, 54, 0.1);
    border-color: #f44336;
    color: #ff5252;
}

/* ==========================================
   Schedule Grid
   ========================================== */
.schedule-section {
    margin-top: 32px;
}

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

.schedule-title-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.schedule-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.credit-counter {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: var(--purdue-gold);
    color: var(--purdue-black);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.schedule-actions {
    display: flex;
    gap: 12px;
}

.export-btn {
    background: linear-gradient(135deg, #CFB991, #B1810B) !important;
    color: #000 !important;
    font-weight: 600;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(206, 184, 136, 0.4);
}

.schedule-grid {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    min-height: 200px;
    overflow-x: auto;
}

.schedule-grid:not(.active) {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

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

.schedule-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* Weekly Grid Layout */
.weekly-grid {
    display: grid;
    gap: 1px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    position: relative;
    min-width: 700px;
}

.grid-corner {
    background: var(--bg-primary);
}

.day-header {
    background: #CFB991;
    color: #000;
    font-weight: 700;
    font-size: 14px;
    padding: 10px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.time-label {
    background: var(--bg-primary);
    font-size: 11px;
    color: var(--text-secondary);
    padding: 4px;
    text-align: right;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    font-weight: 600;
}

.time-label.empty {
    background: var(--bg-primary);
}

.schedule-cell {
    background: var(--card-bg);
    min-height: 20px;
    border: none;
}

/* Meeting Blocks */
.meeting-block {
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #000;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.meeting-block:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.meeting-block.conflict {
    border: 2px solid #f44336 !important;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(244, 67, 54, 0.1);
    }
}

.meeting-block-content {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.2;
}

.meeting-course {
    font-weight: 700;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meeting-type {
    font-size: 9px;
    opacity: 0.9;
}

.meeting-location {
    font-size: 9px;
    opacity: 0.85;
    font-weight: 500;
}

.meeting-time {
    font-size: 8px;
    opacity: 0.8;
    margin-top: 1px;
}

/* Conflict Warning */
.conflict-warning {
    background: #ffebee;
    border: 2px solid #f44336;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.dark-theme .conflict-warning {
    background: rgba(244, 67, 54, 0.1);
    border-color: #f44336;
}

.conflict-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.conflict-warning strong {
    color: #c62828;
    display: block;
    margin-bottom: 4px;
}

.dark-theme .conflict-warning strong {
    color: #ff5252;
}

.conflict-warning p {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
}

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 768px) {
    .course-search-container {
        flex-direction: column;
    }

    .course-search-input,
    .term-select,
    .course-search-button {
        width: 100%;
    }

    .course-results {
        grid-template-columns: 1fr;
    }

    .course-planner-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ==========================================
   Dark Theme Adjustments
   ========================================== */
.dark-theme .course-planner {
    background: var(--card-bg-dark, #1a1a1a);
}

.dark-theme .course-card {
    background: var(--card-bg-dark, #1a1a1a);
}

.dark-theme .section-card {
    background: var(--bg-primary-dark, #0d0d0d);
}

.dark-theme .section-type {
    background: var(--card-bg-dark, #1a1a1a);
}
