/* ================================================
   Corrector CB 6è — Styles
   Design inspired by informeflaix.com
   ================================================ */

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

/* -- App Wrapper -- */
.cb-app-wrapper {
    /* Break out of WordPress theme container */
    width: 100vw !important;
    max-width: 100vw !important;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw !important;
    margin-right: -50vw !important;
    padding: 0 !important;
    box-sizing: border-box;
}

/* Inner wrapper to center content */
.cb-app-inner {
    max-width: 1200px;
    margin: 30px auto 60px;
    padding: 0 24px;
    font-family: -apple-system, system-ui, 'Segoe UI', Helvetica, Arial, sans-serif;
    color: #222;
}

/* -- Cards -- */
.cb-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
    margin-bottom: 20px;
    overflow: hidden;
}

/* -- Header Card -- */
.cb-header-card {
    background: linear-gradient(135deg, #f0f7f8 0%, #dff0f4 100%);
    border-left: 5px solid #107c8a;
    padding: 28px 32px;
}

.cb-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.cb-header-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cb-header-icon {
    font-size: 2.4em;
}

.cb-header-card h1 {
    font-size: 1.7em;
    font-weight: 700;
    color: #107c8a;
    margin: 0;
    line-height: 1.2;
}

.cb-header-subtitle {
    font-size: 0.95em;
    color: #555;
    margin-top: 4px;
}

/* -- Config Button -- */
.cb-btn-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    border: none;
    background: #107c8a;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.cb-btn-icon:hover {
    background: #0d6670;
    transform: scale(1.05);
}

/* -- Modal -- */
.cb-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cb-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
}

.cb-modal-content {
    position: relative;
    background: #fff;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: cb-modal-in 0.3s ease;
}

@keyframes cb-modal-in {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.cb-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 16px;
    border-bottom: 1px solid #eee;
}

.cb-modal-header h2 {
    font-size: 1.3em;
    color: #222;
    margin: 0;
}

.cb-btn-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    color: #666;
    font-size: 1.4em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.cb-btn-close:hover {
    background: #e0e0e0;
}

.cb-modal-body {
    padding: 24px 28px 28px;
}

/* -- Info Box -- */
.cb-info-box {
    background: linear-gradient(135deg, #e8f4fd 0%, #dff0f4 100%);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid #c8e6f0;
}

.cb-info-box p {
    font-size: 0.95em;
    line-height: 1.6;
    color: #333;
}

.cb-steps {
    margin-top: 12px;
}

.cb-steps ol {
    padding-left: 20px;
    margin-top: 8px;
}

.cb-steps li {
    font-size: 0.9em;
    line-height: 1.6;
    color: #444;
    margin-bottom: 4px;
}

.cb-steps a {
    color: #107c8a;
    font-weight: 600;
    text-decoration: none;
}

.cb-steps a:hover {
    text-decoration: underline;
}

/* -- Form Groups -- */
.cb-form-group {
    margin-bottom: 20px;
}

.cb-form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.95em;
    color: #333;
    margin-bottom: 8px;
}

.cb-input-row {
    display: flex;
    gap: 8px;
}

.cb-input-row input[type="password"],
.cb-input-row input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-size: 1em;
    transition: border-color 0.2s;
    outline: none;
}

.cb-input-row input:focus {
    border-color: #107c8a;
}

.cb-btn-secondary {
    padding: 10px 16px;
    border: 2px solid #ddd;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    font-size: 1.1em;
    transition: all 0.2s;
}

.cb-btn-secondary:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

/* -- Model List -- */
.cb-model-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cb-model-category {
    margin-top: 12px;
    margin-bottom: 4px;
}

.cb-model-category:first-child {
    margin-top: 0;
}

.cb-model-category-label {
    font-size: 0.82em;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cb-model-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.cb-model-option:hover {
    background: #eef6f7;
}

.cb-model-option:has(input:checked) {
    background: #e8f4f6;
    border-color: #107c8a;
}

.cb-model-option input[type="radio"] {
    accent-color: #107c8a;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.cb-model-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cb-model-name {
    font-weight: 600;
    font-size: 0.95em;
    color: #222;
}

.cb-model-desc {
    font-size: 0.8em;
    color: #777;
}

/* -- Primary Button -- */
.cb-btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #107c8a 0%, #0d6670 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    margin-top: 8px;
}

.cb-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(16, 124, 138, 0.3);
}

.cb-config-status {
    text-align: center;
    margin-top: 12px;
    font-size: 0.9em;
    color: #107c8a;
    font-weight: 500;
    min-height: 1.4em;
}

/* -- Form Card -- */
.cb-form-card {
    padding: 32px;
}

.cb-section {
    margin-bottom: 28px;
}

.cb-section:last-child {
    margin-bottom: 0;
}

.cb-section-title {
    font-size: 1.1em;
    font-weight: 700;
    color: #333;
    margin-bottom: 14px;
}

.cb-section-center {
    text-align: center;
}

/* -- Upload Area -- */
.cb-upload-area {
    border: 3px dashed #ccc;
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafbfc;
}

.cb-upload-area:hover,
.cb-upload-area.drag-over {
    border-color: #107c8a;
    background: #eef6f7;
}

.cb-upload-icon {
    font-size: 3em;
    margin-bottom: 12px;
    opacity: 0.7;
}

.cb-upload-text {
    font-size: 1em;
    color: #555;
    font-weight: 500;
}

.cb-upload-hint {
    font-size: 0.8em;
    color: #999;
    margin-top: 6px;
}

.cb-preview-img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    object-fit: contain;
}

.cb-btn-remove-img {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(220, 53, 69, 0.9);
    color: #fff;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.cb-btn-remove-img:hover {
    background: rgba(200, 35, 51, 1);
    transform: scale(1.1);
}

/* -- Textarea -- */
.cb-textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid #ddd;
    border-radius: 14px;
    font-size: 0.95em;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
    outline: none;
    line-height: 1.6;
    min-height: 120px;
}

.cb-textarea:focus {
    border-color: #107c8a;
}

/* -- Evaluate Button -- */
.cb-btn-evaluate {
    padding: 16px 48px;
    background: linear-gradient(135deg, #2a7f62 0%, #1a6b50 100%);
    color: #fff;
    border: none;
    border-radius: 16px;
    font-size: 1.15em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.cb-btn-evaluate:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(42, 127, 98, 0.35);
}

.cb-btn-evaluate:disabled {
    background: #bbb;
    cursor: not-allowed;
    opacity: 0.7;
}

.cb-btn-evaluate-icon {
    font-size: 1.2em;
}

.cb-evaluate-status {
    margin-top: 12px;
    font-size: 0.9em;
    color: #888;
    min-height: 1.4em;
}

/* -- Loading animation -- */
.cb-btn-evaluate.loading {
    position: relative;
    pointer-events: none;
}

.cb-btn-evaluate.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cb-spin 0.7s linear infinite;
    margin-left: 8px;
}

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

/* -- Results Card -- */
.cb-results-card {
    padding: 32px;
}

/* -- Alert -- */
.cb-alert {
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.92em;
    line-height: 1.5;
    margin-bottom: 24px;
    font-weight: 500;
}

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

.cb-alert.danger {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

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

/* -- Total Score -- */
.cb-total-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 24px 0 32px;
}

.cb-total-score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #107c8a, #0d6670);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 30px rgba(16, 124, 138, 0.25);
    margin-bottom: 12px;
    transition: all 0.5s ease;
}

.cb-total-score-value {
    font-size: 2.4em;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.cb-total-score-max {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.cb-total-score-label {
    font-size: 1em;
    font-weight: 600;
    color: #555;
}

/* Score colors based on performance */
.cb-total-score-circle.score-low {
    background: linear-gradient(135deg, #dc3545, #c82333);
    box-shadow: 0 8px 30px rgba(220, 53, 69, 0.25);
}

.cb-total-score-circle.score-mid {
    background: linear-gradient(135deg, #e8a317, #d4930e);
    box-shadow: 0 8px 30px rgba(232, 163, 23, 0.25);
}

.cb-total-score-circle.score-high {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    box-shadow: 0 8px 30px rgba(40, 167, 69, 0.25);
}

/* -- Individual Scores -- */
.cb-scores-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cb-score-item {
    background: #f8f9fa;
    border-radius: 14px;
    padding: 20px;
    transition: all 0.3s;
}

.cb-score-item:hover {
    background: #f0f4f5;
}

.cb-score-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cb-score-label {
    font-weight: 600;
    font-size: 1em;
    color: #333;
}

.cb-score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 32px;
    border-radius: 10px;
    background: #107c8a;
    color: #fff;
    font-weight: 700;
    font-size: 0.95em;
    padding: 0 10px;
}

.cb-score-badge.score-0 {
    background: #dc3545;
}

.cb-score-badge.score-1 {
    background: #e8a317;
}

.cb-score-badge.score-2 {
    background: #28a745;
}

/* -- Score Bar -- */
.cb-score-bar {
    height: 8px;
    border-radius: 4px;
    background: #e0e0e0;
    overflow: hidden;
    margin-bottom: 10px;
}

.cb-score-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #107c8a, #28a745);
    transition: width 0.8s ease;
}

.cb-score-comment {
    font-size: 0.88em;
    color: #666;
    line-height: 1.6;
}

/* -- Feedback Section -- */
.cb-feedback-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 2px solid #eee;
}

.cb-feedback-section h3 {
    font-size: 1.05em;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}

.cb-feedback-text {
    font-size: 0.92em;
    color: #555;
    line-height: 1.7;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    white-space: pre-wrap;
}

/* -- Transcription Section -- */
.cb-transcription-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.cb-transcription-section h3 {
    font-size: 1.05em;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
}

.cb-transcription-text {
    font-size: 0.92em;
    color: #555;
    line-height: 1.7;
    background: #f0f7f8;
    border-radius: 12px;
    padding: 20px;
    white-space: pre-wrap;
    border-left: 4px solid #107c8a;
}

/* -- Empty State -- */
.cb-empty-card {
    text-align: center;
    color: #8da2b5;
    padding: 60px 20px;
    margin-top: 20px;
}
.cb-empty-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* -- Language Toggle -- */
.cb-language-toggle {
    display: inline-flex;
    background: #f0f4f8;
    border-radius: 8px;
    padding: 4px;
    border: 1px solid #dce4ec;
    margin-bottom: 10px;
}
.cb-language-toggle input[type="radio"] {
    display: none;
}
.cb-language-toggle label {
    padding: 10px 24px;
    cursor: pointer;
    border-radius: 6px;
    font-weight: 500;
    color: #5d6778;
    transition: all 0.2s;
    user-select: none;
}
.cb-language-toggle input[type="radio"]:checked + label {
    background: #107c8a;
    color: white;
    box-shadow: 0 2px 4px rgba(16, 124, 138, 0.2);
}

.cb-empty-content p {
    font-size: 0.95em;
    line-height: 1.6;
}

/* -- Responsive -- */
@media (max-width: 640px) {
    .cb-app-wrapper {
        padding: 0 12px;
        margin-top: 16px;
    }

    .cb-card {
        border-radius: 14px;
    }

    .cb-header-card {
        padding: 20px;
    }

    .cb-header-card h1 {
        font-size: 1.3em;
    }

    .cb-header-icon {
        font-size: 1.8em;
    }

    .cb-form-card,
    .cb-results-card {
        padding: 20px;
    }

    .cb-btn-evaluate {
        width: 100%;
        justify-content: center;
    }

    .cb-total-score-circle {
        width: 100px;
        height: 100px;
    }

    .cb-total-score-value {
        font-size: 2em;
    }

    .cb-modal-content {
        width: 95%;
        margin: 10px;
    }

    .cb-modal-header,
    .cb-modal-body {
        padding-left: 20px;
        padding-right: 20px;
    }
}
