@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&family=Fira+Code:wght@400;500;600&display=swap');

:root {
    --bg-dark: #0B0F19;
    /* Deep sleek dark blue */
    --panel-bg: rgba(20, 26, 38, 0.65);
    /* Glassmorphism panel base */
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-main: #cbd5e1;
    --text-muted: #94a3b8;
    --text-bright: #f8fafc;
    --accent-primary: #10B981;
    /* Premium Emerald */
    --accent-primary-dim: rgba(16, 185, 129, 0.2);
    --accent-secondary: #3b82f6;
    /* Premium Blue */
    --error: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    color: var(--text-main);
    background-color: var(--bg-dark);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    /* Beautiful ambient light gradients */
    background-image:
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.08), transparent 30%),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.08), transparent 30%);
    background-attachment: fixed;
}

.container {
    max-width: 1050px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    position: relative;
    z-index: 10;
}

/* Typography */
header {
    text-align: center;
    margin-bottom: 3.5rem;
}

header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff, #94a3b8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p.subtitle {
    color: var(--accent-primary);
    font-size: 1rem;
    font-family: 'Fira Code', monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.9;
}

/* Glass Panels */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    margin-bottom: 2rem;
}

h2 {
    font-size: 1.25rem;
    color: var(--text-bright);
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title {
    font-size: 1.5rem;
    color: var(--text-bright);
    margin: 3rem 0 1.5rem;
}

/* Controls & Settings */
.main-controls {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 768px) {
    .main-controls {
        flex-direction: row;
        align-items: stretch;
    }

    .settings,
    .file-upload {
        flex: 1;
    }
}

/* Select inputs */
select {
    appearance: none;
    background-color: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid var(--panel-border) !important;
    color: var(--text-bright) !important;
    font-size: 0.95rem;
    border-radius: 8px !important;
    padding: 10px 14px !important;
    outline: none;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
}

select:hover,
select:focus {
    border-color: var(--accent-secondary) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

select option {
    background-color: var(--bg-dark);
    color: var(--text-bright);
}

.select-group label {
    font-family: 'Inter', sans-serif;
    color: var(--text-muted) !important;
    font-weight: 500 !important;
    margin-bottom: 6px !important;
}

/* Modern Toggles */
.toggle-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 1.25rem;
    padding: 0.5rem 0;
    transition: opacity 0.2s;
}

.toggle-container:hover {
    opacity: 0.8;
}

.toggle-container input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 46px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    margin-right: 12px;
    transition: 0.3s;
    flex-shrink: 0;
}

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

input:checked+.toggle-slider {
    background-color: var(--accent-primary);
}

input:checked+.toggle-slider:before {
    transform: translateX(22px);
    background-color: #fff;
}

.toggle-label {
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--text-main);
}

/* File Upload Area */
.file-upload {
    position: relative;
    border: 2px dashed var(--panel-border);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload:hover,
.file-upload.dragover {
    border-color: var(--accent-primary);
    background: var(--accent-primary-dim);
}

.file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-content {
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.upload-content svg {
    color: var(--accent-primary);
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.file-upload:hover .upload-content svg {
    transform: translateY(-5px);
}

.upload-content h3 {
    margin-bottom: 0.5rem;
    color: var(--text-bright);
    font-weight: 600;
}

.upload-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Results Section */
.hidden {
    display: none !important;
}

.info-gpa-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .info-gpa-container {
        grid-template-columns: 1fr 1fr;
    }
}

.info-grid {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 1rem;
    font-size: 0.95rem;
}

.info-grid .label {
    color: var(--text-muted);
}

.info-grid .val {
    color: var(--text-bright);
    font-weight: 500;
}

.overall-gpa {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Subtle glow behind GPA */
.overall-gpa::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    background: var(--accent-primary);
    filter: blur(80px);
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

.gpa-score {
    font-size: 5.5rem;
    font-family: 'Fira Code', monospace;
    font-weight: 700;
    color: var(--text-bright);
    line-height: 1;
    margin-bottom: 1.5rem;
    z-index: 1;
    position: relative;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.stats-grid {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--panel-border);
    z-index: 1;
    position: relative;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-item .val {
    font-size: 1.25rem;
    font-weight: 600;
    font-family: 'Fira Code', monospace;
    color: var(--text-bright);
}

/* Grade Counts Customization */
.grade-counts div strong {
    font-family: 'Fira Code', monospace;
    color: var(--text-bright);
}

.group-grade-counts strong {
    font-family: 'Fira Code', monospace;
    color: var(--text-bright);
    margin-top: 2px;
}

/* Grid for Groups */
.group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.group-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.group-card:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.15);
}

.group-card h3 {
    font-size: 1.1rem;
    color: var(--text-bright);
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    margin-top: 0;
}

.group-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.g-stat {
    display: flex;
    flex-direction: column;
}

.g-stat .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.g-stat .val {
    font-size: 1.1rem;
    font-family: 'Fira Code', monospace;
    font-weight: 500;
}

.g-gpa {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.g-gpa .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.g-gpa .val {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: 'Fira Code', monospace;
    color: var(--accent-primary);
}

/* Accordion Subjects */
.subjects-details {
    margin-top: 1rem;
    border-top: 1px solid var(--panel-border);
    padding-top: 0.5rem;
}

.subjects-details summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--accent-secondary);
    outline: none;
    padding: 0.5rem 0;
    font-weight: 500;
    transition: 0.2s;
    user-select: none;
}

.subjects-details summary:hover {
    color: #60a5fa;
}

.subject-list {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Elegant Scrollbars */
.subject-list::-webkit-scrollbar {
    width: 4px;
}

.subject-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.subject-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.subject-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.s-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
}

.s-name {
    color: var(--text-bright);
    flex: 1;
    margin-right: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.s-meta {
    color: var(--text-muted);
    white-space: nowrap;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
}

.s-grade {
    font-weight: 700;
    color: var(--accent-primary);
    margin-left: 0.5rem;
    display: inline-block;
    width: 20px;
    text-align: right;
}

/* ========================================
   トグル展開要件グループのスタイル
   ======================================== */

.requirement-group-header {
    transition: background-color 0.2s ease;
}

.requirement-group-header:hover {
    background-color: rgba(76, 175, 80, 0.2) !important;
}

.requirement-group-content {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* 学科選択パネルのスタイル */
#departmentSelectPanel {
    background: rgba(20, 26, 38, 0.65);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

#departmentSelectPanel h2 {
    color: var(--accent-primary);
    margin-bottom: 1.5rem;
}
}