/* --- 全体基本スタイル --- */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f6f9;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 15px;
}

/* ヘッダー */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.app-title {
    margin: 0;
    font-size: 1.6rem;
    color: #2c3e50;
}

.header-links a {
    text-decoration: none;
    color: #007bff;
    font-weight: bold;
    margin-left: 15px;
}

.header-links a.button-like,
.header-links a.btn {
    text-decoration: none;
    margin-left: 0;
}

.header-links a.btn-primary,
.header-links a.btn-secondary {
    color: #ffffff !important;
}

/* 多言語セレクター */
.lang-selector-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid #ccc;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.lang-selector-box select {
    border: none;
    font-size: 0.95rem;
    background: transparent;
    font-weight: bold;
    color: #2c3e50;
    cursor: pointer;
    outline: none;
}

/* カードコンポーネント */
.card {
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 20px;
    margin-bottom: 20px;
}

.card h2 {
    margin-top: 0;
    font-size: 1.3rem;
    color: #34495e;
    border-bottom: 2px solid #f0f2f5;
    padding-bottom: 8px;
    margin-bottom: 15px;
}

/* フォーム要素 */
label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #495057;
}

input[type="text"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* ボタンスタイル */
.button-like, button[type="submit"], .btn {
    background-color: #007bff;
    color: white;
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background-color 0.2s, transform 0.1s;
    margin: 4px 2px;
}

.button-like:hover, button[type="submit"]:hover, .btn:hover {
    background-color: #0056b3;
}

.button-like:active, button[type="submit"]:active, .btn:active {
    transform: scale(0.98);
}

.button-like:disabled, button:disabled {
    background-color: #cccccc !important;
    cursor: not-allowed;
    transform: none !important;
}

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

.btn-warning { background-color: #ffc107; color: #212529; }
.btn-warning:hover { background-color: #e0a800; }

.btn-danger, .delete-all-button, .delete-submission-button {
    background-color: #dc3545;
}
.btn-danger:hover, .delete-all-button:hover, .delete-submission-button:hover {
    background-color: #c82333;
}

.btn-secondary { background-color: #6c757d; }
.btn-secondary:hover { background-color: #5a6268; }

.btn-lg {
    padding: 14px 24px;
    font-size: 1.1rem;
    width: 100%;
}

/* ドラッグ＆ドロップエリア */
.drop-area {
    border: 2px dashed #007bff;
    border-radius: 10px;
    padding: 25px 15px;
    text-align: center;
    margin-bottom: 20px;
    background-color: #f8fbff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-area.drag-over {
    border-color: #28a745;
    background-color: #eafaf1;
    transform: scale(1.01);
}

.drop-area p {
    margin: 6px 0;
    color: #495057;
}

.file-button-label {
    cursor: pointer;
    display: inline-block;
}

.file-button-label input[type="file"] {
    display: none;
}

/* プレビューコンテナ */
.preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 15px;
}

.image-preview-item {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    padding: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.submission-image-preview {
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
    display: block;
}

.ocr-checkmark {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #28a745;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    display: none;
}

/* 進捗バー */
.progress-bar-container {
    width: 100%;
    background-color: #e9ecef;
    border-radius: 20px;
    overflow: hidden;
    height: 22px;
    margin-top: 10px;
    display: none;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: #28a745;
    color: white;
    text-align: center;
    line-height: 22px;
    font-size: 12px;
    font-weight: bold;
    transition: width 0.3s ease;
}

/* 個別OCR表示 */
.ocr-result-item {
    background-color: #fcfcfc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #007bff;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.ocr-result-item h4 {
    margin: 0 0 10px 0;
    color: #2d3748;
}

/* 課題リスト表示 */
.assignment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 10px;
    background: #fafafa;
    flex-wrap: wrap;
    gap: 10px;
}

.assignment-item:hover {
    background: #f1f5f9;
}

.assignment-item h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #1a202c;
}

.assignment-meta {
    font-size: 0.85rem;
    color: #718096;
}

.assignment-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* 採点結果カード */
.submission-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.submission-card .summary {
    background: #edf2f7;
    padding: 12px 15px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.submission-card .details {
    padding: 15px;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    overflow-y: auto;
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 25px;
    border-radius: 12px;
    max-width: 550px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
    animation: modalSlide 0.25s ease-out;
}

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

.close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

.close-button:hover {
    color: #333;
}

/* QRコード表示ボックス */
.qr-container {
    text-align: center;
    padding: 15px;
}

.qr-image {
    max-width: 250px;
    width: 100%;
    height: auto;
    border: 4px solid #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    margin: 15px 0;
}

.qr-url-box {
    background: #f1f3f5;
    padding: 10px 14px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.9rem;
    word-break: break-all;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

/* ステータスメッセージ */
#statusMessage {
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: 6px;
    font-weight: 600;
    display: none;
}

#statusMessage.success {
    display: block;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#statusMessage.error {
    display: block;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

#statusMessage.info {
    display: block;
    background-color: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

/* スマホ対応（レスポンシブ） */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }
    .app-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .lang-selector-box {
        justify-content: center;
    }
    .assignment-item {
        flex-direction: column;
        align-items: stretch;
    }
    .assignment-actions {
        justify-content: stretch;
    }
    .assignment-actions button {
        flex: 1 1 auto;
    }
    .modal-content {
        margin: 10% 10px;
        padding: 15px;
    }
}

/* --- モーダル共通・特大QRコード表示スタイル --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 15px;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: #ffffff;
    border-radius: 16px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.classroom-qr-card img:hover {
    transform: scale(1.03);
}
