/* Scheduling Tool Stylesheet */

.scheduler-layout {
    display: grid;
    grid-template-columns: 320px 1fr 340px;
    gap: 1.5rem;
    align-items: start;
    margin-top: 1rem;
}

@media (max-width: 1200px) {
    .scheduler-layout {
        grid-template-columns: 1fr;
    }
}

/* Sidebar and configurations */
.plan-table-wrapper {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.2);
}

.plan-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.plan-table th, .plan-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.plan-table th {
    background: rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 0;
    z-index: 10;
    color: hsl(var(--text-secondary));
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger-icon:hover {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
}

/* Main timetable grid */
.timetable-card {
    padding: 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.timetable-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.timetable-grid-wrapper {
    overflow-x: auto;
}

.timetable-grid {
    display: grid;
    gap: 6px;
    min-width: 650px;
}

/* Grid columns layout will be dynamically set by JS inline styles, default is 6 (1 header + 5 days) */
.grid-header-cell {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-weight: 600;
    color: hsl(var(--text-secondary));
    font-family: var(--font-heading);
}

.grid-time-cell {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    color: hsl(var(--text-secondary));
    font-weight: 500;
}

.grid-time-cell span {
    font-size: 0.7rem;
    color: hsl(var(--text-muted));
    margin-top: 2px;
}

/* Course card cell */
.grid-course-cell {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    min-height: 70px;
    padding: 6px;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.grid-course-cell:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

.course-card {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.15) 0%, rgba(99, 102, 241, 0.1) 100%);
    border: 1px solid rgba(14, 165, 233, 0.25);
    border-left: 3px solid hsl(var(--primary));
    border-radius: 6px;
    padding: 6px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition-smooth);
    user-select: none;
}

.course-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.15);
    border-color: rgba(14, 165, 233, 0.4);
}

.course-subject {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
}

.course-teacher {
    font-size: 0.75rem;
    color: hsl(var(--text-secondary));
    margin-top: 2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Drag states */
.grid-course-cell.drag-over-valid {
    background: rgba(16, 185, 129, 0.15) !important;
    border: 2px dashed rgba(16, 185, 129, 0.5) !important;
}

.grid-course-cell.drag-over-invalid {
    background: rgba(239, 68, 68, 0.15) !important;
    border: 2px dashed rgba(239, 68, 68, 0.5) !important;
}

.course-card.dragging {
    opacity: 0.4;
}

/* Warnings and conflicts list */
.warnings-section {
    margin-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
    padding-top: 1rem;
}

.warnings-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #f87171;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.warnings-list {
    list-style-type: none;
    padding-left: 0;
}

.warning-item {
    font-size: 0.8rem;
    color: hsl(var(--text-secondary));
    padding: 0.4rem 0.6rem;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 6px;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.warning-item-dot {
    width: 6px;
    height: 6px;
    background-color: #ef4444;
    border-radius: 50%;
}

/* AI Chat adjustments */
.chat-panel {
    display: flex;
    flex-direction: column;
    height: 600px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    overflow: hidden;
}

.chat-header {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-bot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--secondary)));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.chat-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.chat-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.chat-messages::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.chat-msg {
    max-width: 85%;
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.4;
}

.chat-msg.user {
    align-self: flex-end;
    background: hsl(var(--primary));
    color: #ffffff;
    border-bottom-right-radius: 2px;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

.chat-msg.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    color: hsl(var(--text-primary));
    border-bottom-left-radius: 2px;
    border: 1px solid var(--glass-border);
}

.chat-msg.bot.error {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.chat-input-area {
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: #ffffff;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

.chat-input:focus {
    outline: none;
    border-color: hsl(var(--primary));
    background: rgba(255, 255, 255, 0.08);
}

.chat-send-btn {
    background: hsl(var(--primary));
    border: none;
    border-radius: 8px;
    color: white;
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

.chat-send-btn:hover {
    background: rgba(14, 165, 233, 0.8);
    transform: scale(1.02);
}

.chat-quick-cmds {
    padding: 0.5rem 1rem;
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--glass-border);
    scrollbar-width: none; /* Firefox */
}

.chat-quick-cmds::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.quick-cmd-tag {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    color: hsl(var(--text-secondary));
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.quick-cmd-tag:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: hsl(var(--primary));
}

/* Statistics dashboard */
.stats-panel {
    grid-column: 1 / -1;
    margin-top: 1.5rem;
}

.teacher-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.teacher-stat-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.teacher-stat-name {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.teacher-stat-sub {
    font-size: 0.75rem;
    color: hsl(var(--text-muted));
}

.teacher-bar-wrapper {
    background: rgba(255, 255, 255, 0.05);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.teacher-bar-fill {
    height: 100%;
    background: linear-gradient(to right, hsl(var(--primary)), hsl(var(--secondary)));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.teacher-stat-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: hsl(var(--text-secondary));
    margin-top: 0.4rem;
}

/* Leave suggestions dialog modal */
.leave-modal-content {
    background: #0d1220;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 500px;
    width: 90%;
    margin: 10% auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.leave-modal-close {
    position: absolute;
    right: 1.5rem;
    top: 1.2rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: hsl(var(--text-secondary));
}

.leave-modal-close:hover {
    color: white;
}

.leave-option-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 250px;
    overflow-y: auto;
}

.leave-option-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.leave-option-item:hover {
    background: rgba(14, 165, 233, 0.08);
    border-color: hsl(var(--primary));
}

.leave-option-desc {
    color: #ffffff;
    font-weight: 500;
}

.leave-option-action {
    color: hsl(var(--primary));
    font-weight: 600;
    font-size: 0.75rem;
}

/* Custom constraints display panel */
.constraints-panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 1rem;
}

.constraint-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.constraint-tag {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.constraint-tag-remove {
    cursor: pointer;
    font-weight: bold;
    color: #f87171;
}

.constraint-tag-remove:hover {
    color: #ef4444;
}

.empty-state {
    color: hsl(var(--text-muted));
    font-size: 0.8rem;
    text-align: center;
    padding: 0.5rem;
}
