:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-sub: #6b7280;
    --border-color: #e5e7eb;
    --font-family: 'Noto Sans JP', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.main-header h1 {
    text-align: center;
    color: var(--text-main);
    margin-bottom: 24px;
}

/* Tabs */
.mode-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 24px;
    background: #e2e8f0;
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-sub);
    flex: 1;
    text-align: center;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tab-btn:first-child {
    border-radius: 8px 0 0 8px;
}

.tab-btn:last-child {
    border-radius: 0 8px 8px 0;
}

/* Sections */
.mode-section {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

.mode-section.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.card h2,
.card h3 {
    margin-top: 0;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
    cursor: pointer;
    /* For toggle headers */
}

/* Hint Box */
.hint-box {
    background: #eff6ff;
    border-left: 4px solid var(--primary-color);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.hint-box h3 {
    margin-top: 0;
    color: var(--primary-color);
}

/* Controls Bar */
.controls-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    color: white;
}

.btn-primary {
    background: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--text-sub);
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-success {
    background: var(--secondary-color);
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: var(--warning-color);
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--danger-color);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 2px dashed var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: #eff6ff;
}

.btn-large {
    font-size: 1.2rem;
    padding: 16px 32px;
    width: 100%;
}

.full-width {
    width: 100%;
    display: block;
    margin-top: 10px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 10px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
}

.data-table input[type="text"],
.data-table input[type="number"],
.data-table select {
    width: 100%;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
}

/* Timetable Editor */
.timetable-container {
    display: grid;
    /* Grid template cols will be set dynamically */
    gap: 2px;
    background: var(--border-color);
}

.timetable-cell {
    background: white;
    padding: 8px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timetable-header {
    background: #f1f5f9;
    font-weight: bold;
    text-align: center;
}

/* separator styles */
.border-right-thick {
    border-right: 3px solid #333 !important;
    /* Darker and important */
}

.border-top-thick {
    border-top: 3px solid #333 !important;
}

/* Palette & Drag Drop */
.palette-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    min-height: 60px;
    background: #f8fafc;
    border-radius: 6px;
    border: 2px dashed #cbd5e1;
}

.teacher-chip {
    background: white;
    border: 1px solid #cbd5e1;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: grab;
    user-select: none;
    font-size: 0.9rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 6px;
}

.teacher-chip.dragging {
    opacity: 0.5;
}

.drop-zone {
    min-height: 50px;
    transition: background 0.2s;
    border: 2px solid transparent;
}

.drop-zone.drag-over {
    background: #e0f2fe;
    border-color: var(--primary-color);
}

.assigned-chip {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-top: 4px;
    cursor: grab;
}

/* Helper Class */
.hidden {
    display: none !important;
}

/* Responsive Grid for Result */
.table-responsive {
    overflow-x: auto;
}