/* TSUNAGU Dummy Server - Test UI Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 5px;
}

.subtitle {
    opacity: 0.9;
    font-size: 0.9rem;
}

/* DCC Status */
.dcc-status {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dcc-status .status-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.dcc-status .status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.dcc-status .status-badge.active {
    background: #27ae60;
    color: white;
}

.dcc-status .status-badge.disabled {
    background: #95a5a6;
    color: white;
}

.dcc-status .status-badge.loading {
    background: #f39c12;
    color: white;
}

.dcc-status .status-badge.error {
    background: #e74c3c;
    color: white;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: white;
    padding: 8px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    flex-wrap: wrap;
}

.tab {
    flex: 1 1 auto;
    min-width: 100px;
    padding: 12px 24px;
    border: 2px solid #e0e0e0;
    background: #fafafa;
    color: #333;
    cursor: pointer;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
}

.tab:hover {
    background: #e8e8e8;
    border-color: #667eea;
    color: #333;
}

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

.tab-content {
    display: none;
}

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

/* Sections */
.section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.section h2 {
    margin-bottom: 15px;
    font-size: 1.3rem;
    color: #444;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

/* Forms */
.form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

input, select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    flex: 1;
    min-width: 150px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Textarea */
textarea {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    width: 100%;
}

.textarea-row {
    flex-direction: column;
    align-items: flex-start !important;
}

.textarea-row .form-label {
    margin-bottom: 6px;
}

.textarea-row textarea {
    width: 100%;
}

button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.3s ease;
}

button:hover {
    background: #5a6fd6;
}

button.danger {
    background: #e74c3c;
}

button.warning {
    background: #f39c12;
}

button.warning:hover {
    background: #e67e22;
}

.badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-left: 5px;
    font-weight: bold;
}

.badge.used { background: #95a5a6; color: white; }
.badge.expired { background: #e74c3c; color: white; }

button.secondary {
    background: #95a5a6;
}

button.secondary:hover {
    background: #7f8c8d;
}

/* Lists */
.list {
    /* No max-height - full page scroll */
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #fafafa;
    transition: all 0.2s ease;
}

.list-item:hover {
    background: #f0f0f0;
    border-color: #ddd;
}

.list-item .info {
    flex: 1;
}

.list-item .info .name {
    font-weight: 600;
    color: #333;
}

.list-item .info .details {
    font-size: 0.85rem;
    color: #666;
    margin-top: 3px;
}

.list-item .actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.list-item .actions select {
    padding: 6px 10px;
    font-size: 0.85rem;
    min-width: 120px;
    flex: 0 0 auto;
}

.list-item .actions button {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Lesson URLs */
.lesson-urls {
    margin-top: 8px;
    padding: 8px;
    background: #f0f4ff;
    border-radius: 4px;
    font-size: 0.85rem;
}

.lesson-urls a {
    color: #667eea;
    text-decoration: none;
    margin: 0 4px;
}

.lesson-urls a:hover {
    text-decoration: underline;
}

/* Result Box */
.result-box {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    margin-top: 15px;
    min-height: 100px;
}

.result-box .auth-link {
    display: block;
    padding: 15px;
    background: #e8f5e9;
    border-radius: 6px;
    margin-top: 10px;
    word-break: break-all;
}

.result-box .auth-link a {
    color: #2e7d32;
    text-decoration: none;
    font-weight: 500;
}

.result-box .auth-link a:hover {
    text-decoration: underline;
}

/* Logs */
.logs .log-item {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 5px;
    background: #fff;
}

.logs .log-item.success {
    border-left: 3px solid #27ae60;
}

.logs .log-item.error {
    border-left: 3px solid #e74c3c;
}

.logs .log-item .method {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-right: 8px;
}

.logs .log-item .method.get { background: #3498db; color: white; }
.logs .log-item .method.post { background: #27ae60; color: white; }
.logs .log-item .method.put { background: #f39c12; color: white; }
.logs .log-item .method.delete { background: #e74c3c; color: white; }

.logs .log-item .url {
    color: #333;
}

.logs .log-item .timestamp {
    color: #999;
    font-size: 0.75rem;
    float: right;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 8px;
}

.badge.host {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge.participant {
    background: #e3f2fd;
    color: #1565c0;
}

.badge.expired {
    background: #ffebee;
    color: #c62828;
}

.badge.used {
    background: #fafafa;
    color: #999;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Checkbox label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 15px;
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    min-width: auto;
    flex: 0 0 auto;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #333;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

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

.qr-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.qr-form input {
    flex: none;
}

#qr-result {
    text-align: center;
}

#qr-result img {
    max-width: 250px;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
    background: white;
}

#qr-result .qr-url {
    margin-top: 15px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 6px;
    word-break: break-all;
    font-size: 0.85rem;
}

#qr-info {
    margin-bottom: 15px;
}

.qr-info-text {
    padding: 10px;
    background: #e8f5e9;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #2e7d32;
    text-align: center;
}

#qr-result .loading {
    padding: 40px;
    color: #888;
}

/* Recording badge */
.badge.recording {
    background: #ffebee;
    color: #c62828;
}

/* Participant form in lesson item */
.participant-form-inline {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 6px;
}

.participant-form-inline input {
    flex: 1;
    min-width: 100px;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.participant-form-inline select {
    min-width: 120px;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.participant-form-inline button {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Lesson Form */
.lesson-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lesson-form .form-row {
    align-items: center;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
    flex: 0 0 auto;
}

/* Grade Checkboxes */
.grade-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.grade-label {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.grade-label:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.grade-label input[type="checkbox"] {
    width: auto;
    min-width: auto;
    flex: 0 0 auto;
    margin: 0;
}

.grade-label input[type="checkbox"]:checked + span,
.grade-label:has(input[type="checkbox"]:checked) {
    color: #667eea;
    font-weight: 500;
}

/* Lesson Info Display */
.lesson-info-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.lesson-info-details .info-item {
    font-size: 0.8rem;
    padding: 2px 8px;
    background: #f0f0f0;
    border-radius: 4px;
    color: #666;
}

.badge.public {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge.private {
    background: #fff3e0;
    color: #e65100;
}

.badge.language {
    background: #e3f2fd;
    color: #1565c0;
}

.badge.pii-off {
    background: #fff3e0;
    color: #e65100;
}

/* DCC Sync Status Badges */
.badge.sync-synced {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge.sync-failed {
    background: #ffebee;
    color: #c62828;
}

.badge.sync-not_synced {
    background: #fafafa;
    color: #757575;
}

/* Sync Retry Button */
.sync-retry-btn {
    font-size: 0.7rem;
    padding: 2px 8px;
    background: #f39c12;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    margin-left: 4px;
}

.sync-retry-btn:hover {
    background: #e67e22;
}

/* People section (Host/Participants) */
.people-section {
    margin-top: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
}

.people-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 4px;
}

.person-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: white;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.person-row:last-child {
    margin-bottom: 0;
}

.host-row {
    border-left: 3px solid #667eea;
}

.participant-row {
    border-left: 3px solid #27ae60;
}

.person-link {
    font-size: 0.8rem;
    color: #667eea;
    text-decoration: none;
    padding: 2px 6px;
    background: #f0f4ff;
    border-radius: 3px;
}

.person-link:hover {
    background: #e0e8ff;
    text-decoration: underline;
}

.person-link.test-link {
    color: #e67e22;
    background: #fff3e0;
}

.person-link.test-link:hover {
    background: #ffe0b2;
}

/* Student section label */
.student-section-label {
    font-size: 0.75rem;
    color: #888;
    font-weight: 500;
    margin-left: 8px;
}

/* Student links */
.person-link.student-link {
    color: #8e44ad;
    background: #f5eef8;
}

.person-link.student-link:hover {
    background: #e8daef;
}

.person-link.student-test-link {
    color: #009688;
    background: #e0f2f1;
}

.person-link.student-test-link:hover {
    background: #b2dfdb;
}



.qr-btn {
    font-size: 0.75rem;
    padding: 3px 8px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.qr-btn:hover {
    background: #5a6fd6;
}

.no-participants {
    font-size: 0.85rem;
    color: #999;
    font-style: italic;
    padding: 6px 8px;
}

/* File Upload */
.file-hint {
    font-size: 0.8rem;
    color: #888;
    flex: 0 0 auto;
}

input[type="file"] {
    flex: 1;
    padding: 8px;
    border: 1px dashed #ccc;
    border-radius: 6px;
    background: #fafafa;
    cursor: pointer;
}

input[type="file"]:hover {
    border-color: #667eea;
    background: #f5f7ff;
}

.current-files {
    padding: 8px;
    background: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 10px;
}

.current-files:empty {
    display: none;
}

.current-files .files-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
}

.current-files .file-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 2px;
    font-size: 0.85rem;
}

.current-files .file-item .file-name {
    color: #333;
}

.current-files .file-item .file-size {
    color: #888;
    font-size: 0.75rem;
}

.current-files .file-item .remove-file {
    color: #e74c3c;
    cursor: pointer;
    font-weight: bold;
    padding: 0 4px;
}

.current-files .file-item .remove-file:hover {
    color: #c0392b;
}

/* Lesson files display in list */
.lesson-files {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #666;
    font-size: 0.85rem;
}

.lesson-files .files-icon {
    font-size: 1rem;
}

/* Textarea with button */
.textarea-with-button {
    display: flex;
    gap: 10px;
    width: 100%;
    align-items: flex-start;
}

.textarea-with-button textarea {
    flex: 1;
}

.extract-btn {
    flex: 0 0 auto;
    padding: 10px 16px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background 0.3s ease;
}

.extract-btn:hover {
    background: #219a52;
}

.extract-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.extract-btn.loading {
    background: #f39c12;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }

    .form-row input,
    .form-row select,
    .form-row button {
        width: 100%;
    }

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

    .list-item .actions {
        margin-top: 10px;
        width: 100%;
    }
}
