/* ========================================
   沖縄高専 出席管理アプリ - スタイルシート
   ======================================== */

/* CSS Variables */
:root {
    /* Colors */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;

    --success-50: #ecfdf5;
    --success-100: #d1fae5;
    --success-500: #10b981;
    --success-600: #059669;

    --warning-50: #fffbeb;
    --warning-100: #fef3c7;
    --warning-500: #f59e0b;
    --warning-600: #d97706;

    --danger-50: #fef2f2;
    --danger-100: #fee2e2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;

    --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;

    /* Background - Dark Theme (default) */
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e1b4b;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.08);

    /* Text - Dark Theme */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);

    /* Border */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* Layout */
    --sidebar-width: 280px;
    --sidebar-collapsed: 80px;
}

/* ========================================
   Light Theme
   ======================================== */
body.light-theme {
    --bg-gradient-start: #f8fafc;
    --bg-gradient-end: #e2e8f0;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(255, 255, 255, 1);

    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

body.light-theme .sidebar,
body.light-theme .mobile-header,
body.light-theme .modal,
body.light-theme .toast,
body.light-theme .mobile-semester-bar {
    background: rgba(255, 255, 255, 0.95);
}

/* ========================================
   Rose Theme
   ======================================== */
body.rose-theme {
    --primary-400: #f472b6;
    --primary-500: #ec4899;
    --primary-600: #db2777;
    --primary-700: #be185d;

    --bg-gradient-start: #1f1020;
    --bg-gradient-end: #3b1534;
    --shadow-glow: 0 0 20px rgba(236, 72, 153, 0.3);
}

body.rose-theme .sidebar {
    background: linear-gradient(180deg, rgba(59, 21, 52, 0.95) 0%, rgba(31, 16, 32, 0.98) 100%);
}

body.rose-theme .mobile-header {
    background: rgba(59, 21, 52, 0.95);
}

body.rose-theme .mobile-semester-bar {
    background: rgba(31, 16, 32, 0.95);
}

/* ========================================
   Mint Theme
   ======================================== */
body.mint-theme {
    --primary-400: #34d399;
    --primary-500: #10b981;
    --primary-600: #059669;
    --primary-700: #047857;

    --bg-gradient-start: #0f1f1a;
    --bg-gradient-end: #0d3028;
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.3);
}

body.mint-theme .sidebar {
    background: linear-gradient(180deg, rgba(13, 48, 40, 0.95) 0%, rgba(15, 31, 26, 0.98) 100%);
}

body.mint-theme .mobile-header {
    background: rgba(13, 48, 40, 0.95);
}

body.mint-theme .mobile-semester-bar {
    background: rgba(15, 31, 26, 0.95);
}

/* ========================================
   Theme Picker Styles
   ======================================== */
.setting-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.theme-picker {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.theme-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-dot:hover {
    background: var(--bg-card-hover);
}

.theme-dot.active {
    border-color: var(--primary-500);
    background: var(--bg-card);
}

.theme-dot-inner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast);
}

.theme-dot:hover .theme-dot-inner {
    transform: scale(1.1);
}

.theme-dot.active .theme-dot-inner {
    box-shadow: 0 0 0 3px var(--primary-500), var(--shadow-md);
}

.theme-dot-inner.dark {
    background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 100%);
}

.theme-dot-inner.light {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-dot-inner.rose {
    background: linear-gradient(135deg, #3b1534 0%, #ec4899 100%);
}

.theme-dot-inner.mint {
    background: linear-gradient(135deg, #0d3028 0%, #10b981 100%);
}

.theme-dot-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Mobile header - hidden by default on desktop */
.mobile-header {
    display: none;
}

/* ========================================
   Sidebar Navigation
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-400), var(--primary-300));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition-fast);
}

.nav-menu {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 4px;
}

.nav-item:hover {
    background: var(--bg-card-hover);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    box-shadow: var(--shadow-glow);
}

.nav-icon {
    font-size: 20px;
}

.nav-text {
    font-weight: 500;
    font-size: 15px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.semester-selector select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.semester-selector select:hover,
.semester-selector select:focus {
    background: var(--bg-card-hover);
    border-color: var(--primary-500);
    outline: none;
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    min-height: 100vh;
}

.page {
    display: none;
    animation: fadeIn var(--transition-normal);
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text-primary), var(--primary-300));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
}

/* ========================================
   Cards
   ======================================== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.card:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

/* ========================================
   Stats Grid
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--stat-color, var(--primary-500));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 28px;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 4px;
    background: linear-gradient(135deg, var(--text-primary), var(--stat-color, var(--primary-400)));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ========================================
   Dashboard
   ======================================== */
.dashboard-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.subject-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.subject-item:last-child {
    border-bottom: none;
}

.subject-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.subject-color {
    width: 4px;
    height: 40px;
    border-radius: 2px;
}

.subject-details h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.subject-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

.subject-stats {
    display: flex;
    align-items: center;
    gap: 24px;
}

.progress-container {
    width: 120px;
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width var(--transition-normal);
}

.progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
}

.attendance-rate {
    font-size: 24px;
    font-weight: 700;
    min-width: 70px;
    text-align: right;
}

.attendance-rate.safe {
    color: var(--success-500);
}

.attendance-rate.warning {
    color: var(--warning-500);
}

.attendance-rate.danger {
    color: var(--danger-500);
}

/* Alerts */
.alert-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--border-radius-md);
    margin-bottom: 12px;
}

.alert-item:last-child {
    margin-bottom: 0;
}

.alert-item.warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
}

.alert-icon {
    font-size: 20px;
}

.alert-content h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-content p {
    font-size: 13px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 15px;
}

/* ========================================
   Schedule Grid
   ======================================== */
.schedule-actions {
    margin-bottom: 24px;
}

.schedule-grid {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.schedule-header {
    display: grid;
    grid-template-columns: 80px repeat(5, 1fr);
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--border-color);
}

.schedule-cell {
    padding: 16px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

.time-cell {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

.schedule-body {
    display: grid;
    grid-template-columns: 80px repeat(5, 1fr);
}

.schedule-row {
    display: contents;
}

.period-cell {
    padding: 16px;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
}

.period-cell .period-time {
    font-size: 11px;
    margin-top: 4px;
}

.class-cell {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.class-item {
    width: 100%;
    padding: 12px;
    border-radius: var(--border-radius-sm);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.class-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.class-item .class-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.class-item .class-info {
    font-size: 11px;
    opacity: 0.8;
}

.class-cell.empty {
    background: repeating-linear-gradient(45deg,
            transparent,
            transparent 10px,
            rgba(255, 255, 255, 0.02) 10px,
            rgba(255, 255, 255, 0.02) 20px);
}

/* ========================================
   Attendance Page
   ======================================== */
.attendance-controls {
    margin-bottom: 24px;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-selector label {
    font-weight: 500;
    color: var(--text-secondary);
}

.date-selector input[type="date"] {
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    cursor: pointer;
}

.date-selector input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-500);
}

.today-classes {
    display: grid;
    gap: 16px;
    margin-bottom: 32px;
}

.class-attendance-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    transition: all var(--transition-fast);
}

.class-attendance-card:hover {
    background: var(--bg-card-hover);
}

.class-attendance-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.class-attendance-color {
    width: 4px;
    height: 50px;
    border-radius: 2px;
}

.class-attendance-details h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.class-attendance-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

.attendance-buttons {
    display: flex;
    gap: 8px;
}

.attendance-btn {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.attendance-btn:hover {
    background: var(--bg-card-hover);
}

.attendance-btn.selected {
    border-color: var(--btn-color, var(--primary-500));
    background: var(--btn-bg, var(--primary-500));
    color: white;
}

.attendance-btn[data-status="present"] {
    --btn-color: var(--success-500);
    --btn-bg: var(--success-500);
}

.attendance-btn[data-status="absent"] {
    --btn-color: var(--danger-500);
    --btn-bg: var(--danger-500);
}

.attendance-btn[data-status="late"] {
    --btn-color: var(--warning-500);
    --btn-bg: var(--warning-500);
}

.attendance-btn[data-status="early"] {
    --btn-color: var(--primary-500);
    --btn-bg: var(--primary-500);
}

/* Attendance History */
.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.history-item:last-child {
    border-bottom: none;
}

.history-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-date {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 90px;
}

.history-subject {
    font-weight: 500;
}

.history-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.history-status.present {
    background: var(--success-100);
    color: var(--success-600);
}

.history-status.absent {
    background: var(--danger-100);
    color: var(--danger-600);
}

.history-status.late {
    background: var(--warning-100);
    color: var(--warning-600);
}

.history-status.early {
    background: var(--primary-100);
    color: var(--primary-600);
}

/* ========================================
   Settings
   ======================================== */
.settings-content {
    display: grid;
    gap: 24px;
    max-width: 600px;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
}

.setting-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.setting-item input[type="number"] {
    width: 100px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
}

.setting-item input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-500);
}

/* Toggle Switch */
.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.toggle-label input {
    display: none;
}

.toggle-switch {
    width: 48px;
    height: 26px;
    background: var(--gray-600);
    border-radius: 13px;
    position: relative;
    transition: background var(--transition-fast);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-fast);
}

.toggle-label input:checked+.toggle-switch {
    background: var(--primary-500);
}

.toggle-label input:checked+.toggle-switch::after {
    transform: translateX(22px);
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-600));
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-danger {
    background: var(--danger-500);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-600);
}

/* ========================================
   Modal
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-gradient-start);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    width: 90%;
    max-width: 500px;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-small {
    max-width: 400px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

/* ========================================
   Forms
   ======================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input[type="color"] {
    height: 48px;
    padding: 4px;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 16px 24px;
    background: var(--bg-gradient-start);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastIn 0.3s ease;
}

.toast.success {
    border-color: var(--success-500);
}

.toast.error {
    border-color: var(--danger-500);
}

.toast.warning {
    border-color: var(--warning-500);
}

.toast-icon {
    font-size: 20px;
}

.toast-message {
    font-size: 14px;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1024px) {
    .dashboard-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {

    /* Mobile header - always visible at top */
    .mobile-header {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 70px;
        padding: 0 20px;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border-color);
        z-index: 200;
        align-items: center;
        justify-content: space-between;
    }

    .menu-toggle {
        display: flex;
    }

    /* Hide sidebar header on mobile (we use mobile-header instead) */
    .sidebar-header {
        display: none;
    }

    /* Sidebar slides in from left */
    .sidebar {
        transform: translateX(-100%);
        z-index: 150;
        padding-top: 80px;
        /* ヘッダーの高さ分下げる */
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 140;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
        padding-top: 90px;
    }

    .page-header h1 {
        font-size: 24px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .schedule-grid {
        overflow-x: auto;
    }

    .schedule-header,
    .schedule-body {
        min-width: 600px;
    }

    .class-attendance-card {
        flex-direction: column;
        align-items: stretch;
    }

    .attendance-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 28px;
    }

    .subject-stats {
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
    }

    .progress-container {
        width: 80px;
    }

    .attendance-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* ========================================
   FAB (Floating Action Button)
   ======================================== */
.fab {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(99, 102, 241, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .fab {
        bottom: 24px;
        right: 16px;
        width: 52px;
        height: 52px;
        font-size: 24px;
    }
}

/* ========================================
   Empty Cell Hover Effects
   ======================================== */
.class-cell.empty {
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.class-cell.empty::after {
    content: '＋';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.class-cell.empty:hover {
    background: rgba(99, 102, 241, 0.1) !important;
}

.class-cell.empty:hover::after {
    opacity: 1;
    color: var(--primary-400);
}

/* ========================================
   Empty State with Action Button
   ======================================== */
.empty-state-action {
    margin-top: 16px;
}

.empty-state-action .btn {
    display: inline-flex;
    padding: 10px 20px;
    font-size: 14px;
}

.empty-state-link {
    color: var(--primary-400);
    text-decoration: underline;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.empty-state-link:hover {
    color: var(--primary-300);
}

/* ========================================
   Mobile Semester Selector (Fixed Bottom)
   ======================================== */
.mobile-semester-bar {
    display: none;
}

@media (max-width: 768px) {
    .sidebar-footer {
        display: none;
    }

    .mobile-semester-bar {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 12px 20px;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(20px);
        border-top: 1px solid var(--border-color);
        z-index: 50;
    }

    .mobile-semester-bar select {
        width: 100%;
        padding: 10px 16px;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius-sm);
        color: var(--text-primary);
        font-size: 14px;
        font-family: inherit;
    }

    .toast-container {
        bottom: 80px;
    }
}

/* ========================================
   Supplementary Class (補講) Styles
   ======================================== */
.supplementary-badge {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, var(--warning-500), var(--warning-600));
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.supplementary-list-card {
    margin-top: 1.5rem;
}

.supplementary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.supplementary-item:last-child {
    border-bottom: none;
}

.supplementary-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.supplementary-date {
    font-weight: 600;
    font-size: 14px;
}

.supplementary-period {
    color: var(--text-secondary);
    font-size: 13px;
}

.supplementary-subject {
    font-weight: 500;
    font-size: 14px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Supplementary class attendance card highlight */
.class-attendance-card.is-supplementary {
    border: 2px solid var(--warning-500);
    background: rgba(245, 158, 11, 0.05);
}

.class-attendance-card.is-supplementary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--warning-500);
}

/* Schedule page actions layout */
.schedule-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .supplementary-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .supplementary-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}