/**
 * CloudTech Auto Grading - Form Styles
 */

/* コンテナ */
.ctg-grading-form-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ヘッダー */
.ctg-header h3 {
    margin: 0 0 0.5rem 0;
    color: #1a1a2e;
    font-size: 1.5rem;
}

.ctg-description {
    color: #666;
    margin-bottom: 1.5rem;
}

/* 通知メッセージ */
.ctg-notice {
    padding: 1rem 1.5rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.ctg-notice-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.ctg-notice-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.ctg-notice-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.ctg-notice-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* 採点回数表示 */
.ctg-limit-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.ctg-limit-label {
    font-weight: 600;
    color: #495057;
}

.ctg-limit-count {
    color: #007bff;
    font-weight: 700;
}

.ctg-limit-remaining {
    color: #28a745;
}

/* ExternalId セクション */
.ctg-external-id-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.ctg-external-id-section h4 {
    margin: 0 0 1rem 0;
    color: #1e40af;
    font-size: 1.2rem;
    border-bottom: 2px solid #3b82f6;
    padding-bottom: 0.5rem;
}

/* 情報ボックス */
.ctg-info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-left: 4px solid #3b82f6;
    border-radius: 4px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.ctg-info-box p {
    margin: 0.5rem 0;
    color: #1e40af;
}

.ctg-info-box p:first-child {
    margin-top: 0;
}

.ctg-info-box p:last-child {
    margin-bottom: 0;
}

.ctg-small-text {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.6;
}

/* ステップ説明 */
.ctg-step-instruction {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.ctg-step-instruction p {
    margin: 1rem 0;
    line-height: 1.7;
}

.ctg-step-instruction p:first-child {
    margin-top: 0;
}

/* プライマリボタン */
.ctg-btn-primary {
    display: inline-block;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff !important;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.ctg-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    color: #fff !important;
}

/* チェックボックスラベル表示 */
.ctg-checkbox-label {
    display: inline-block;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: #475569;
    margin-top: 0.5rem;
}

/* ExternalId ボックス */
.ctg-external-id-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    padding: 0.875rem 1rem;
    border-radius: 6px;
    border: 2px solid #3b82f6;
    margin: 1rem 0;
}

.ctg-external-id-box code {
    flex: 1;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 1rem;
    color: #dc2626;
    background: none;
    padding: 0;
    font-weight: 600;
}

.ctg-copy-btn {
    padding: 0.5rem 1rem;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
}

.ctg-copy-btn:hover {
    background: #1d4ed8;
}

.ctg-copy-btn.copied {
    background: #16a34a;
}

/* セキュリティ情報（折りたたみ） */
.ctg-security-info {
    background: #fefce8;
    border: 1px solid #fde047;
    border-radius: 6px;
    margin-top: 1rem;
}

.ctg-security-info summary {
    padding: 0.875rem 1rem;
    cursor: pointer;
    font-weight: 600;
    color: #854d0e;
    user-select: none;
}

.ctg-security-info summary:hover {
    background: #fef9c3;
}

.ctg-details-content {
    padding: 0 1rem 1rem 1rem;
    border-top: 1px solid #fde047;
}

.ctg-details-content ul {
    margin: 0.75rem 0;
    padding-left: 1.25rem;
}

.ctg-details-content li {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: #713f12;
    line-height: 1.6;
}

.ctg-help-text {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
}

.ctg-help-text a {
    color: #3b82f6;
    text-decoration: none;
}

.ctg-help-text a:hover {
    text-decoration: underline;
}

/* フォーム */
.ctg-form h4 {
    margin: 1.5rem 0 1rem 0;
    color: #1a1a2e;
    font-size: 1.1rem;
    border-bottom: 2px solid #007bff;
    padding-bottom: 0.5rem;
}

.ctg-form-group {
    margin-bottom: 1.5rem;
}

.ctg-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.ctg-form-group label .required {
    color: #dc3545;
}

.ctg-form-group input[type="text"],
.ctg-form-group input[type="email"],
.ctg-form-group select,
.ctg-form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.ctg-form-group input:focus,
.ctg-form-group select:focus,
.ctg-form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.ctg-form-group input:invalid {
    border-color: #dc3545;
}

.ctg-form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.ctg-field-help {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* ファイルアップロード */
.ctg-form-group input[type="file"] {
    padding: 0.5rem;
    border: 2px dashed #ced4da;
    border-radius: 4px;
    background: #f8f9fa;
    cursor: pointer;
}

.ctg-form-group input[type="file"]:hover {
    border-color: #007bff;
    background: #e7f3ff;
}

/* 区切り線 */
.ctg-divider {
    border: none;
    border-top: 1px solid #e9ecef;
    margin: 2rem 0;
}

/* 送信ボタン */
.ctg-form-actions {
    text-align: center;
    margin-top: 2rem;
}

.ctg-submit-btn {
    display: inline-block;
    padding: 1rem 3rem;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ctg-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.ctg-submit-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ctg-btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.ctg-btn-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: ctg-spin 0.8s linear infinite;
}

@keyframes ctg-spin {
    to {
        transform: rotate(360deg);
    }
}

/* 結果表示 */
.ctg-result {
    margin-top: 2rem;
    padding: 1.5rem;
    border-radius: 6px;
}

.ctg-result.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.ctg-result.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

.ctg-result h4 {
    margin: 0 0 0.5rem 0;
    border: none;
    padding: 0;
}

.ctg-result p {
    margin: 0.5rem 0;
}

.ctg-result .request-id {
    font-family: monospace;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
}

/* 理解度確認セクション */
.ctg-questions-section {
    margin-top: 1.5rem;
}

.ctg-questions-section h5 {
    font-size: 1rem;
    color: #1a1a2e;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #6366f1;
}

.ctg-question-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.ctg-question-block label {
    color: #1e40af;
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.ctg-question-text {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #6366f1;
    border-radius: 4px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #374151;
}

.ctg-question-block textarea {
    background: #fff;
    border: 1px solid #cbd5e1;
}

.ctg-question-block textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Academy宣伝バナー */
.ctg-academy-promo {
    background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    color: #fff;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ctg-academy-promo-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    padding: 0.25rem 0.8rem;
    border-radius: 20px;
    margin-bottom: 0.8rem;
}

.ctg-academy-promo-text {
    font-size: 0.95rem;
    line-height: 1.7;
    margin: 0 0 1rem;
}

.ctg-academy-promo-text strong {
    color: #fffde7;
}

.ctg-academy-promo-link {
    display: inline-block;
    background: #1a365d;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.6rem 1.8rem;
    border-radius: 8px;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ctg-academy-promo-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: #2a4a7f;
    color: #fff;
    text-decoration: none;
}

/* 説明ガイドビデオセクション */
.ctg-guide-video-section {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    color: #fff;
}

.ctg-guide-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.ctg-guide-description {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
}

.ctg-video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 アスペクト比 */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.ctg-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .ctg-grading-form-container {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .ctg-external-id-box {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ctg-submit-btn {
        width: 100%;
        padding: 1rem;
    }
    
    .ctg-question-block {
        padding: 1rem;
    }
    
    .ctg-question-text {
        padding: 0.875rem 1rem;
    }
    
    .ctg-guide-video-section {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .ctg-guide-title {
        font-size: 1.1rem;
    }
}


/* ========================================
   GPA ダッシュボード
   ======================================== */

.ctg-gpa-dashboard {
    max-width: 900px;
    margin: 2rem auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ヘッダー */
.ctg-gpa-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 16px;
    padding: 2rem;
    color: #fff;
    margin-bottom: 1.5rem;
}

.ctg-gpa-header-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
    color: #fff;
}

.ctg-gpa-overview {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

/* GPA円グラフ */
.ctg-gpa-circle-wrapper {
    text-align: center;
    flex-shrink: 0;
}

.ctg-gpa-circle {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: conic-gradient(
        var(--gpa-color) calc(var(--gpa-pct) * 1%),
        rgba(255,255,255,0.15) calc(var(--gpa-pct) * 1%)
    );
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.ctg-gpa-circle-inner {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #1e293b;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ctg-gpa-number {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
}

.ctg-gpa-label {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 2px;
}

.ctg-gpa-target {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 0.5rem;
}

/* 修了条件 */
.ctg-gpa-conditions {
    flex: 1;
}

.ctg-gpa-conditions h4 {
    font-size: 1rem;
    margin: 0 0 0.8rem;
    color: #fff;
}

.ctg-gpa-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ctg-gpa-checklist li {
    padding: 0.5rem 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.ctg-check-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.ctg-check-pass .ctg-check-icon {
    background: #10b981;
    color: #fff;
}

.ctg-check-pending .ctg-check-icon {
    background: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.6);
}

.ctg-check-detail {
    margin-left: auto;
    font-size: 0.8rem;
    opacity: 0.6;
}

.ctg-gpa-graduated {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 1rem;
    text-align: center;
}

.ctg-gpa-hint {
    background: rgba(255,255,255,0.08);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    opacity: 0.7;
    margin-top: 1rem;
    line-height: 1.5;
}

/* 提出進捗バー */
.ctg-progress-section {
    margin-top: 1.5rem;
}

.ctg-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
    opacity: 0.8;
}

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

.ctg-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* テーブル */
.ctg-gpa-table-wrapper {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.ctg-gpa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.ctg-gpa-table thead th {
    background: #f8fafc;
    padding: 0.8rem 0.6rem;
    text-align: center;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.8rem;
}

.ctg-gpa-table thead th:first-child {
    text-align: left;
    padding-left: 1rem;
}

.ctg-gpa-table tbody td {
    padding: 0.7rem 0.6rem;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.ctg-sprint-name {
    text-align: left !important;
    padding-left: 1rem !important;
    font-weight: 500;
    white-space: nowrap;
}

.ctg-row-pending td {
    opacity: 0.5;
}

.ctg-cell-empty {
    color: #cbd5e1;
}

/* バッジ */
.ctg-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.ctg-badge-submitted {
    background: #dcfce7;
    color: #166534;
}

.ctg-badge-pending {
    background: #f1f5f9;
    color: #94a3b8;
}

/* グレード */
.ctg-grade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8rem;
}

.ctg-grade-s { background: #fef3c7; color: #92400e; }
.ctg-grade-a { background: #dbeafe; color: #1e40af; }
.ctg-grade-b { background: #dcfce7; color: #166534; }
.ctg-grade-c { background: #e0f2fe; color: #075985; }
.ctg-grade-d { background: #fed7aa; color: #9a3412; }
.ctg-grade-e { background: #fecaca; color: #991b1b; }
.ctg-grade-f { background: #fecaca; color: #dc2626; }
.ctg-grade-none { background: #f1f5f9; color: #94a3b8; }

/* グレード基準 */
.ctg-gpa-legend {
    background: #fff;
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.ctg-gpa-legend h4 {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0 0 0.8rem;
}

.ctg-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.ctg-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: #64748b;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .ctg-gpa-dashboard {
        margin: 1rem;
    }
    
    .ctg-gpa-header {
        padding: 1.2rem;
    }
    
    .ctg-gpa-overview {
        flex-direction: column;
        align-items: center;
    }
    
    .ctg-gpa-table-wrapper {
        overflow-x: auto;
    }
    
    .ctg-gpa-table {
        min-width: 600px;
    }
    
    .ctg-legend-items {
        gap: 0.5rem;
    }
}
