/**
 * Schedule Mapper Frontend Styles
 */

/* Reset and Base Styles */
.schedule-mapper-wrapper * {
    box-sizing: border-box;
}

.schedule-mapper-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #333;
    line-height: 1.6;
    background-color: #f5f5f5;
}

/* Header */
.sm-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.sm-header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sm-title {
    font-size: 1.6rem;
    font-weight: bold;
}

/* Disclaimer Banner */
.sm-disclaimer-banner {
    background-color: #fff3cd;
    color: #856404;
    padding: 1rem;
    text-align: center;
    font-size: 0.9rem;
    border-bottom: 1px solid #ffeaa7;
}

.sm-exam-notice-banner {
    background-color: #cfe2ff;
    color: #084298;
    padding: 1rem;
    text-align: center;
    font-size: 0.9rem;
    border-bottom: 1px solid #9ec5fe;
}

/* Filter Bar */
.sm-filter-bar {
    background: white;
    border-bottom: 3px solid #667eea;
    padding: 1.5rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.sm-filter-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.sm-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: fit-content;
}

.sm-filter-group label {
    font-weight: 600;
    color: #555;
    font-size: 0.85rem;
}

.sm-search-input, .sm-filter-select {
    padding: 0.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.3s;
    min-width: 120px;
}

.sm-search-input:focus, .sm-filter-select:focus {
    outline: none;
    border-color: #667eea;
}

.sm-checkbox-group-inline {
    display: flex;
    gap: 0.75rem;
}

.sm-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.sm-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}

.sm-checkbox-item label {
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0;
}

/* Toggle Switch */
.sm-toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sm-toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.sm-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.sm-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.sm-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .sm-toggle-slider {
    background-color: #667eea;
}

input:checked + .sm-toggle-slider:before {
    transform: translateX(20px);
}

.sm-toggle-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #666;
    min-width: 30px;
}

/* Main Container */
.sm-main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 300px);
}

.sm-content-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
    align-items: start;
}

/* Left Panel */
.sm-left-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sm-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.sm-btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.sm-btn-primary {
    background: #667eea;
    color: white;
}

.sm-btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.sm-btn-secondary {
    background: #6c757d;
    color: white;
}

.sm-btn-secondary:hover {
    background: #545b62;
}

/* Course List */
.sm-loading {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: 1.1rem;
}

.sm-error {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.sm-course-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.sm-course-list::-webkit-scrollbar {
    width: 6px;
}

.sm-course-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.sm-course-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.sm-course-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    border-left: 4px solid #667eea;
}

.sm-course-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.sm-course-card.selected {
    background: #f0f4ff;
    border-left-color: #4caf50;
}

.sm-course-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.5rem;
}

.sm-course-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.sm-course-schedule {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #555;
}

.sm-course-extra-meta {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #555;
}

/* Right Panel */
.sm-right-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Scoreboard */
.sm-scoreboard {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 3px solid #e0e0e0;
    transition: all 0.3s ease;
}

.sm-scoreboard.complete {
    border-color: #4caf50;
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
}

.sm-scoreboard-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1rem;
    text-align: center;
}

.sm-scoreboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.sm-scoreboard-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sm-scoreboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.9rem;
}

.sm-scoreboard-item.sm-credits {
    background: #e3f2fd;
    border-left: 4px solid #2196F3;
}

.sm-scoreboard-item.sm-writing {
    background: #fff3e0;
    border-left: 4px solid #ff9800;
}

.sm-scoreboard-item.sm-praxicum {
    background: #f3e5f5;
    border-left: 4px solid #9c27b0;
}

.sm-scoreboard-label {
    font-weight: 600;
    color: #555;
}

.sm-scoreboard-value {
    font-weight: 700;
}

.sm-scoreboard-value.yes {
    color: #4caf50;
}

.sm-scoreboard-value.no {
    color: #dc3545;
}

.sm-scoreboard-value.warning {
    color: #ffc107;
}

.sm-warning-icon {
    background: #ffc107;
    color: #333;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    margin-left: 0.5rem;
    cursor: help;
    position: relative;
}

/* Semester Tabs */
.sm-semester-tabs {
    display: flex;
    background: white;
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.sm-tab-button {
    flex: 1;
    padding: 1rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.sm-tab-button.active {
    background: #667eea;
    color: white;
}

.sm-tab-button:hover:not(.active) {
    background: #f0f0f0;
}

/* Timetable */
.sm-timetable-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.sm-timetable {
    display: grid;
    grid-template-columns: 80px repeat(5, 1fr);
    grid-template-rows: 50px repeat(30, 40px);
    border-collapse: separate;
    border-spacing: 0;
}

.sm-time-header, .sm-day-header {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.sm-time-slot {
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #666;
    background: #fafafa;
}

.sm-timetable-cell {
    border: 1px solid #e0e0e0;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
}

.sm-timetable-cell:hover {
    background-color: #f0f8ff;
}

.sm-course-block {
    position: absolute;
    left: 2px;
    right: 2px;
    top: 2px;
    bottom: 2px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 0.25rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2;
    word-break: break-word;
    white-space: normal;
}

.sm-course-block:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.sm-exam-icon {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
    z-index: 3;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Ranking View */
.sm-ranking-view {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 2rem;
    min-height: 300px;
}

.sm-ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.sm-ranking-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: #333;
}

.sm-rank-for-me-btn {
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.sm-rank-for-me-btn:hover {
    background: #45a049;
}

.sm-ranking-disclaimer {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #856404;
}

.sm-ranking-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sm-ranking-item {
    background: #f8f9fa;
    border: 2px solid #667eea;
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: grab;
    transition: box-shadow 0.2s, background 0.2s;
}

.sm-ranking-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.sm-ranking-item.dragging {
    opacity: 0.5;
    background: #e3f2fd;
}

.sm-ranking-index {
    font-size: 1.2rem;
    color: #667eea;
    font-weight: bold;
    min-width: 2rem;
    text-align: right;
}

.sm-info-icon {
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
    transition: background 0.2s;
}

.sm-info-icon:hover {
    background: #1976D2;
}

.sm-remove-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: background 0.2s;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.sm-remove-btn:hover {
    background: #c82333;
}

/* Modals */
.sm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.sm-modal.show {
    display: flex;
}

.sm-modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.sm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.sm-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
    margin: 0;
}

.sm-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
}

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

.sm-share-modal-content {
    text-align: center;
}

.sm-share-link {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    font-family: monospace;
    word-break: break-all;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.sm-export-textarea {
    width: 100%;
    height: 200px;
    font-size: 1rem;
    padding: 0.5rem;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
    margin-top: 1rem;
    font-family: monospace;
}

/* Responsive Design */
@media (max-width: 968px) {
    .sm-content-layout {
        grid-template-columns: 1fr;
    }

    .sm-actions {
        grid-template-columns: 1fr;
    }

    .sm-scoreboard-grid {
        grid-template-columns: 1fr;
    }

    .sm-filter-container {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    .sm-main-container {
        padding: 1rem;
    }

    .sm-timetable {
        font-size: 0.75rem;
        grid-template-rows: 40px repeat(30, 30px);
    }

    .sm-course-list {
        max-height: 50vh;
    }
}
