* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.user-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

.login-box, .attend-box {
    max-width: 400px;
    margin: 50px auto;
    padding: 40px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

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

.btn-primary:hover {
    background: #5568d3;
}

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

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-small {
    padding: 5px 10px;
    font-size: 14px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.error-message {
    color: #dc3545;
    margin-top: 10px;
}

.lectures-list {
    display: grid;
    gap: 20px;
}

/* 講義グループ */
.lecture-group {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    overflow: visible;
}

.lecture-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.lecture-group-header:hover {
    background: #e9ecef;
}

.lecture-group-header h3 {
    margin: 0;
    flex-grow: 1;
}

.collapse-icon {
    font-size: 14px;
    color: #667eea;
    transition: transform 0.2s;
}

.lecture-summary {
    color: #666;
    font-size: 14px;
}

.lecture-group-content {
    border-top: 1px solid #ddd;
    padding: 10px;
}

.lecture-card {
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: #f8f9fa;
}

.lecture-card:last-child {
    margin-bottom: 0;
}

.lecture-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.lecture-header h4 {
    margin: 0 0 5px 0;
}

.lecture-creator {
    margin: 5px 0 0 0;
    font-size: 13px;
    color: #667eea;
    font-weight: 500;
}

.lecture-remarks {
    margin: 5px 0 0 0;
    font-size: 14px;
    color: #666;
}

.permission-badge {
    background: #667eea;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    white-space: nowrap;
}

.lecture-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.qr-display-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.qr-header {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}

.qr-content {
    background: white;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
}

#qr-image {
    max-width: 400px;
    margin: 20px 0;
}

.qr-info {
    margin-top: 30px;
    text-align: left;
}

.info-item {
    margin: 15px 0;
    font-size: 20px;
}

.info-item .label {
    font-weight: 600;
    margin-right: 10px;
}

.info-item .value {
    font-size: 24px;
    color: #667eea;
}

.warning {
    color: #dc3545;
}

.success {
    color: #28a745;
}

.summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

.attendance-table {
    width: 100%;
    border-collapse: collapse;
}

.attendance-table th, .attendance-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.attendance-table th {
    background: #667eea;
    color: white;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
}

.close {
    float: right;
    font-size: 28px;
    cursor: pointer;
}

/* タブUI */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ステータスバッジ */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

.status-present {
    background: #d4edda;
    color: #155724;
}

.status-excused {
    background: #d1ecf1;
    color: #0c5460;
}

.status-late {
    background: #fff3cd;
    color: #856404;
}

.status-absent {
    background: #f8d7da;
    color: #721c24;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-approved {
    background: #d4edda;
    color: #155724;
}

.status-rejected {
    background: #f8d7da;
    color: #721c24;
}

/* ボタンスタイル */
.btn-success {
    background: #28a745;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger:hover {
    background: #c82333;
}

/* CSV出力ドロップダウン */
.csv-dropdown {
    position: relative;
    display: inline-flex;
    margin-left: 10px;
    flex-shrink: 0;
}

.btn-csv {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    background: #28a745;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-csv:hover {
    background: #218838;
}

.csv-dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    right: 0;
    background-color: white;
    min-width: 220px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    border-radius: 5px;
    z-index: 9999;
    padding-top: 3px;
}

/* ボタンとメニュー間の見えないブリッジ */
.csv-dropdown-content::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 0;
    right: 0;
    height: 5px;
    background: transparent;
}

.csv-dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.csv-dropdown-content a:first-child {
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

.csv-dropdown-content a:last-child {
    border-bottom: none;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
}

.csv-dropdown-content a:hover {
    background-color: #f1f1f1;
}

.csv-dropdown-content a small {
    color: #666;
    font-size: 11px;
    display: block;
    margin-top: 2px;
}

.csv-dropdown:hover .csv-dropdown-content,
.csv-dropdown-content:hover {
    display: block;
}

.btn-share {
    padding: 5px 12px;
    border: none;
    border-radius: 5px;
    background: #17a2b8;
    color: white;
    cursor: pointer;
    font-size: 14px;
    margin-left: 10px;
    transition: background 0.2s;
}

.btn-share:hover {
    background: #138496;
}

/* 講座グループヘッダーのボタン統一スタイル */
.btn-course {
    padding: 6px 14px;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    margin-left: 8px;
    transition: all 0.2s;
    white-space: nowrap;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-course:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.btn-course-csv {
    background: #28a745;
}

.btn-course-csv:hover {
    background: #218838;
}

.btn-course-add {
    background: #007bff;
}

.btn-course-add:hover {
    background: #0056b3;
}

.btn-course-share {
    background: #6f42c1;
}

.btn-course-share:hover {
    background: #5a32a3;
}

.btn-course-delete {
    background: #dc3545;
}

.btn-course-delete:hover {
    background: #c82333;
}

/* 共有モーダル */
.share-section {
    margin-bottom: 25px;
}

.share-section h3 {
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
}

.share-form .form-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.share-form input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.share-form select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.share-list {
    max-height: 300px;
    overflow-y: auto;
}

.share-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.share-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-name {
    font-weight: 500;
}

.permission-owner {
    background: #667eea;
}

.permission-editor {
    background: #28a745;
}

.permission-viewer {
    background: #6c757d;
}

.no-shares {
    text-align: center;
    color: #999;
    padding: 20px;
}

/* オートコンプリート */
.autocomplete-wrapper {
    position: relative;
    flex: 1;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 5px 5px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.autocomplete-item {
    padding: 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.autocomplete-item:hover {
    background: #f8f9fa;
}

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

.autocomplete-item.no-result {
    color: #999;
    cursor: default;
    justify-content: center;
}

.autocomplete-item.no-result:hover {
    background: white;
}

.teacher-name {
    font-weight: 500;
    color: #333;
}

.teacher-id {
    color: #666;
    font-size: 14px;
}

/* 統計画面用スタイル */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.stat-box {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #e0e0e0;
}

.stat-box.stat-present {
    background: #e8f5e9;
    border-color: #4CAF50;
}

.stat-box.stat-late {
    background: #fff3e0;
    border-color: #FF9800;
}

.stat-box.stat-excused {
    background: #e3f2fd;
    border-color: #2196F3;
}

.stat-box.stat-absent {
    background: #ffebee;
    border-color: #F44336;
}

.stat-box.stat-rate {
    background: #f3e5f5;
    border-color: #9C27B0;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.search-box {
    margin-bottom: 15px;
}

.search-box input {
    width: 100%;
    max-width: 400px;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.table-wrapper {
    overflow-x: auto;
    margin-top: 15px;
}

.warning-row {
    background-color: #fff3e0 !important;
}

.warning-row:hover {
    background-color: #ffe0b2 !important;
}

.status-present {
    color: #4CAF50;
    font-weight: 600;
}

.status-late {
    color: #FF9800;
    font-weight: 600;
}

.status-excused {
    color: #2196F3;
    font-weight: 600;
}

.status-absent {
    color: #F44336;
    font-weight: 600;
}

/* プロフィール画面用スタイル */
.profile-info {
    margin-top: 20px;
}

.info-row {
    display: flex;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: #666;
    min-width: 180px;
}

.info-value {
    color: #333;
}

.warning-card {
    background-color: #fff3e0;
    border-left: 4px solid #FF9800;
}

.warning-card h3 {
    color: #F57C00;
    margin-bottom: 10px;
}

.warning-card p {
    color: #666;
}

.password-strength {
    margin-top: 10px;
}

.strength-bar {
    height: 8px;
    background-color: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: width 0.3s, background-color 0.3s;
    border-radius: 4px;
}

#strengthText {
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

/* フィルタセクション用スタイル */
.filter-section {
    margin: 20px 0;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid #ddd;
    background-color: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.filter-btn:hover {
    background-color: #f0f0f0;
}

.filter-btn.active {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

.filter-btn[data-status="present"].active {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

.filter-btn[data-status="late"].active {
    background-color: #FF9800;
    border-color: #FF9800;
}

.filter-btn[data-status="excused"].active {
    background-color: #2196F3;
    border-color: #2196F3;
}

.filter-btn[data-status="absent"].active {
    background-color: #F44336;
    border-color: #F44336;
}

.filter-btn[data-status="suspicious"].active {
    background-color: #9C27B0;
    border-color: #9C27B0;
}
/* ダークモードスタイル */
:root {
    --bg-color: #fff;
    --text-color: #333;
    --card-bg: #fff;
    --border-color: #eee;
    --input-bg: #fff;
    --input-border: #ddd;
    --nav-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --card-bg: #2d2d2d;
    --border-color: #444;
    --input-bg: #3a3a3a;
    --input-border: #555;
    --nav-bg: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

[data-theme="dark"] body {
    background: var(--bg-color);
    color: var(--text-color);
}

[data-theme="dark"] .container,
[data-theme="dark"] .card,
[data-theme="dark"] .login-box,
[data-theme="dark"] .attend-box,
[data-theme="dark"] .modal-content {
    background: var(--card-bg);
    color: var(--text-color);
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: var(--input-bg);
    color: var(--text-color);
    border-color: var(--input-border);
}

[data-theme="dark"] table {
    color: var(--text-color);
}

[data-theme="dark"] table thead {
    background: #3a3a3a;
}

[data-theme="dark"] table tbody tr:hover {
    background: #3a3a3a;
}

[data-theme="dark"] .stat-box {
    background: #3a3a3a;
    border-color: var(--border-color);
}

[data-theme="dark"] nav {
    background: var(--nav-bg);
}

.theme-toggle {
    cursor: pointer;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 5px;
    color: white;
    font-size: 18px;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* モバイル最適化 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
        border-radius: 5px;
    }

    nav {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }

    .nav-right {
        width: 100%;
        justify-content: space-between;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .user-info {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

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

    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 14px;
    }

    table th,
    table td {
        padding: 8px 4px;
    }

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

    .modal-content {
        width: 95%;
        max-width: none;
        margin: 5% auto;
    }

    .filter-section {
        padding: 10px;
    }

    .filter-buttons {
        gap: 5px;
    }

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

    .lecture-group {
        padding: 10px;
    }

    .lecture-item {
        padding: 10px;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 20px;
    }

    h2 {
        font-size: 18px;
    }

    .stats-summary {
        grid-template-columns: 1fr;
    }

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

    table {
        font-size: 12px;
    }

    .btn {
        width: 100%;
        margin-bottom: 5px;
    }

    .form-group {
        margin-bottom: 15px;
    }
}
