/**
 * Schedule Application - Modern Design System
 * Clean, modern CSS with card-based design and improved UX
 */

:root {
    /* Modern Color Palette */
    --primary-color: #667eea;
    --primary-hover: #5a6fd8;
    --primary-light: #f0f2ff;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    
    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Course Type Colors - Modern Palette */
    --vorlesung-bg: linear-gradient(135deg, #fef3c7 0%, #fcd34d 100%);
    --vorlesung-border: #f59e0b;
    --vorlesung-shadow: rgba(245, 158, 11, 0.2);
    
    --praktikum-bg: linear-gradient(135deg, #dbeafe 0%, #60a5fa 100%);
    --praktikum-border: #3b82f6;
    --praktikum-shadow: rgba(59, 130, 246, 0.2);
    
    --uebung-bg: linear-gradient(135deg, #dcfce7 0%, #4ade80 100%);
    --uebung-border: #10b981;
    --uebung-shadow: rgba(16, 185, 129, 0.2);
    
    --seminar-bg: linear-gradient(135deg, #f3e8ff 0%, #a78bfa 100%);
    --seminar-border: #8b5cf6;
    --seminar-shadow: rgba(139, 92, 246, 0.2);
    
    --sprachkurs-bg: linear-gradient(135deg, #fed7aa 0%, #fb923c 100%);
    --sprachkurs-border: #ea580c;
    --sprachkurs-shadow: rgba(234, 88, 12, 0.2);
    
    --tutorium-bg: linear-gradient(135deg, #fce7f3 0%, #f472b6 100%);
    --tutorium-border: #ec4899;
    --tutorium-shadow: rgba(236, 72, 153, 0.2);
    
    /* Design System */
    --border-radius-sm: 0.375rem;
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --transition-fast: 0.15s ease-out;
    --transition: 0.3s ease-out;
    --transition-slow: 0.5s ease-out;
    
    /* Typography */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    
    --line-height-tight: 1.25;
    --line-height-snug: 1.375;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.625;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 1.5rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--gray-800);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
}

/* Modern Container */
.container-modern {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header Section */
.header-section {
    background: white;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--gray-200);
}

.schedule-title {
    font-size: var(--font-size-4xl);
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color) 0%, #764ba2 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    letter-spacing: -0.025em;
}

.schedule-subtitle {
    font-size: var(--font-size-xl);
    color: var(--primary-color);
    font-weight: 600;
    margin: 0.5rem 0 0 0;
}

/* Modern Card Design */
.filter-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--gray-200);
    transition: all var(--transition);
    position: relative;
    z-index: auto;
}

.filter-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.filter-section {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

/* Form Elements - Compact Design */
.form-section {
    margin-bottom: 0;
}

.form-section-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section-title::before {
    content: '';
    width: 3px;
    height: 1rem;
    background: linear-gradient(135deg, var(--primary-color), #764ba2);
    border-radius: 2px;
}

.form-check-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.form-check-modern {
    position: relative;
    margin: 0;
}

.form-check-input {
    position: absolute;
    opacity: 0;
}

.form-check-label {
    position: relative;
    padding-left: 1.75rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
    font-size: var(--font-size-sm);
}

.form-check-label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    background: white;
    transition: all var(--transition);
}

.form-check-label::after {
    content: '';
    position: absolute;
    left: 0.2rem;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #764ba2);
    transition: all var(--transition);
}

.form-check-input:checked + .form-check-label::before {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.form-check-input:checked + .form-check-label::after {
    transform: translateY(-50%) scale(1);
}

.form-check-input:checked + .form-check-label {
    color: var(--primary-color);
    font-weight: 600;
}



.dropdown-toggle {
    background: linear-gradient(135deg, var(--primary-color) 0%, #764ba2 100%);
    border: none;
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    font-weight: 600;
    color: white;
    box-shadow: var(--shadow);
    transition: all var(--transition);
    min-width: 160px;
    text-align: left;
    position: relative;
    font-size: var(--font-size-sm);

}

.dropdown-toggle:hover,
.dropdown-toggle:focus {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, var(--primary-hover) 0%, #6a4c93 100%);
}

.dropdown-toggle::after {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
}

.dropdown-menu {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 0.25rem;
    margin-top: 0.25rem;
    background: white;
    max-height: 250px;
    overflow-y: auto;
    position: fixed !important;
    z-index: 1070 !important; /* Bootstrap's modal z-index is 1060 */
    will-change: transform;
}

.dropdown-item {
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.125rem;
    transition: all var(--transition-fast);
    color: var(--gray-700);
    font-weight: 500;
    font-size: var(--font-size-sm);
    position: relative;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: linear-gradient(135deg, var(--primary-light) 0%, #f0f2ff 100%);
    color: var(--primary-color);
    transform: translateX(2px);
}

/* Override Bootstrap's default positioning */
.dropdown-menu[data-popper-placement] {
    position: fixed !important;
    z-index: 1070 !important;
}

/* Compact Alert Styles */
.alert-container {
    margin-bottom: 1rem;
    position: relative;
}

.alert-success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid var(--success-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    color: #065f46;
    font-weight: 500;
    box-shadow: var(--shadow);
    font-size: var(--font-size-sm);
    position: relative;
}

/* Modern Table */
.table-container {
    background: white;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    position: relative;

}

.table {
    margin: 0;
    border: none;
    font-size: var(--font-size-sm);
    width: 100%;
}

.table th {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    border: 1px solid var(--gray-200);
    font-weight: 600;
    text-align: center;
    padding: 1rem 0.75rem;
    color: var(--gray-800);
    font-size: var(--font-size-sm);
    position: sticky;
    top: 0;
}

.table td,
.table th {
    border: 1px solid var(--gray-200);
    vertical-align: middle;
    transition: all var(--transition-fast);
}

/* Course Type Styling - Modern Cards */
.table-secondary {
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.table-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gray-300);
    transition: all var(--transition);
}

/* Course Type Colors */
.table-secondary[data-course-type="V"],
.table-secondary[data-course-type="SL"],
.table-secondary.course-v,
.table-secondary.course-sl {
    background: var(--vorlesung-bg);
    border-color: var(--vorlesung-border);
    box-shadow: 0 2px 8px var(--vorlesung-shadow);
}

.table-secondary[data-course-type="V"]::before,
.table-secondary[data-course-type="SL"]::before,
.table-secondary.course-v::before,
.table-secondary.course-sl::before {
    background: var(--vorlesung-border);
}

.table-secondary[data-course-type="P"],
.table-secondary.course-p {
    background: var(--praktikum-bg);
    border-color: var(--praktikum-border);
    box-shadow: 0 2px 8px var(--praktikum-shadow);
}

.table-secondary[data-course-type="P"]::before,
.table-secondary.course-p::before {
    background: var(--praktikum-border);
}

.table-secondary[data-course-type="Ü"],
.table-secondary[data-course-type="U"],
.table-secondary.course-ue {
    background: var(--uebung-bg);
    border-color: var(--uebung-border);
    box-shadow: 0 2px 8px var(--uebung-shadow);
}

.table-secondary[data-course-type="Ü"]::before,
.table-secondary[data-course-type="U"]::before,
.table-secondary.course-ue::before {
    background: var(--uebung-border);
}

.table-secondary[data-course-type="S"],
.table-secondary.course-s {
    background: var(--seminar-bg);
    border-color: var(--seminar-border);
    box-shadow: 0 2px 8px var(--seminar-shadow);
}

.table-secondary[data-course-type="S"]::before,
.table-secondary.course-s::before {
    background: var(--seminar-border);
}

.table-secondary[data-course-type="F"],
.table-secondary.course-f {
    background: var(--sprachkurs-bg);
    border-color: var(--sprachkurs-border);
    box-shadow: 0 2px 8px var(--sprachkurs-shadow);
}

.table-secondary[data-course-type="F"]::before,
.table-secondary.course-f::before {
    background: var(--sprachkurs-border);
}

.table-secondary[data-course-type="T"],
.table-secondary.course-t {
    background: var(--tutorium-bg);
    border-color: var(--tutorium-border);
    box-shadow: 0 2px 8px var(--tutorium-shadow);
}

.table-secondary[data-course-type="T"]::before,
.table-secondary.course-t::before {
    background: var(--tutorium-border);
}

.table-secondary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.stunde {
    margin: 0;
    padding: 0.25rem 0;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-tight);
    font-weight: 600;
    color: var(--gray-800);
}

/* Footer - Modern Design */
.legend-section {
    background: white;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-top: 2rem;
    border: 1px solid var(--gray-200);
}

.legend-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-title::before {
    content: '';
    width: 4px;
    height: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), #764ba2);
    border-radius: 2px;
}

.course-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    transition: all var(--transition);
}

.legend-item:hover {
    background: white;
    box-shadow: var(--shadow);
}

.legend-color {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: var(--border-radius-sm);
    border: 2px solid;
    flex-shrink: 0;
}

.legend-color.vorlesung {
    background: var(--vorlesung-bg);
    border-color: var(--vorlesung-border);
}

.legend-color.praktikum {
    background: var(--praktikum-bg);
    border-color: var(--praktikum-border);
}

.legend-color.uebung {
    background: var(--uebung-bg);
    border-color: var(--uebung-border);
}

.legend-color.seminar {
    background: var(--seminar-bg);
    border-color: var(--seminar-border);
}

.legend-color.sprachkurs {
    background: var(--sprachkurs-bg);
    border-color: var(--sprachkurs-border);
}

.legend-color.tutorium {
    background: var(--tutorium-bg);
    border-color: var(--tutorium-border);
}

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

.legend-list li {
    padding: 0.5rem 0;
    font-weight: 500;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
}

.legend-list li:last-child {
    border-bottom: none;
}

.footer-text {
    font-size: var(--font-size-sm);
    color: var(--gray-500);
    text-align: center;
    margin-top: 1rem;
}

/* Loading State */
.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: "";
    position: fixed;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    margin: -30px;
    border: 4px solid transparent;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0.75rem;
    }
    
    .header-section {
        padding: 1rem;
        text-align: center;
    }
    
    .schedule-title {
        font-size: var(--font-size-2xl);
    }
    
    .filter-card {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .form-section-title {
        font-size: var(--font-size-sm);
        margin-bottom: 0.5rem;
    }
    
    .form-check-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .form-check-modern {
        display: flex;
        align-items: center;
    }
    
    .dropdown-toggle {
        width: 100%;
        margin-top: 0.5rem;
        padding: 0.75rem 1rem;
        font-size: var(--font-size-base);
    }
    
    .table {
        font-size: var(--font-size-xs);
    }
    
    .stunde {
        font-size: var(--font-size-xs);
        padding: 0.125rem 0;
    }
    
    .course-legend {
        grid-template-columns: 1fr;
    }
    
    .legend-section {
        padding: 1rem;
    }
}

@media (min-width: 1200px) {
    .container-modern {
        padding: 0 2rem;
    }
    
    .header-section {
        padding: 2rem;
    }
    
    .schedule-title {
        font-size: var(--font-size-4xl);
    }
    
    .filter-card {
        padding: 1.25rem;
    }
}

/* Accessibility */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Internal Planning Badge */
.internal-badge {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
    color: white !important;
    font-weight: 700 !important;
    border: 2px solid #fff !important;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4) !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3) !important;
    animation: pulse-planning 2s infinite;
}

@keyframes pulse-planning {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(220, 53, 69, 0.6);
    }
}

*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus,
.btn:focus,
.form-check-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .filter-card,
    .d-print-none {
        display: none !important;
    }
    
    .header-section,
    .legend-section,
    .table-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .table-secondary {
        background: white !important;
        border: 1px solid #000 !important;
    }
}

/* Simple day separation - just lines between different days */
.table tbody tr:not(:first-child) {
    border-top: 2px solid var(--gray-300);
}

/* Stronger separation at the start of a new day */
.table tbody tr[data-day]:not([data-day=""]) {
    border-top: 3px solid var(--gray-400);
}

/* Alternative: Simple border enhancement for day headers */
.table th {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    border: 1px solid var(--gray-200);
    font-weight: 600;
    text-align: center;
    padding: 1rem 0.75rem;
    color: var(--gray-800);
    font-size: var(--font-size-sm);
    position: sticky;
    top: 0;
}

/* Enhanced first column (day column) */
.table th:first-child {
    background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-300) 100%);
    font-weight: 700;
    border-right: 2px solid var(--gray-400);
} 

/* Custom Tab Navigation Styles */
/* Inactive tabs - black color */
.nav-tabs .nav-link {
    color: #000000 !important;
    border: 1px solid transparent;
    font-weight: 600;
    transition: all var(--transition);
}

.nav-tabs .nav-link:hover {
    color: #333333 !important;
    border-color: #dee2e6 #dee2e6 #dee2e6;
}

/* Active tab - blue color */
.nav-tabs .nav-link.active {
    color: #0066cc !important; /* Blue color for active tab */
    background-color: #ffffff;
    border-color: #dee2e6 #dee2e6 #fff;
    font-weight: 700;
}

/* Ensure focus states maintain the color scheme */
.nav-tabs .nav-link:focus {
    color: #000000 !important;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 102, 204, 0.25);
}

.nav-tabs .nav-link.active:focus {
    color: #0066cc !important;
} 