/* Textmode selector styles */
.textinspector-tools-wrapper .textmode-selector-row {
    display: flex;
    gap: 16px;
    margin: 12px 0 0 0;
    align-items: center;
    justify-content: flex-start;
}
.textinspector-tools-wrapper .textmode-radio {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1em;
    position: relative;
    margin-right: 8px;
}
.textinspector-tools-wrapper .textmode-radio input[type="radio"] {
    opacity: 0;
    position: absolute;
    width: 0;
    height: 0;
}
.textinspector-tools-wrapper .textmode-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #F5C43D;
    border-radius: 50%;
    margin-right: 7px;
    background: #fff;
    display: inline-block;
    position: relative;
    transition: border-color 0.2s;
}
.textinspector-tools-wrapper .textmode-radio input[type="radio"]:checked + .textmode-custom {
    background: #F5C43D;
    box-shadow: 0 0 0 2px #F5C43D33;
}

.ti-tool-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}    
.ti-tool-column{
    flex-direction: column;
}
/* Restart analysis button styled like analyse button */
.textinspector-tools-wrapper .restart-analysis-btn.analyse-form-btn {
    background: #F5C43D;
    color: #2A3654;
    font-weight: 600;
    border: none;
    border-radius: 24px;
    padding: 6px 12px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
    width: 200px;
    align-self: center;
    display: block;
    margin-left: auto;
    margin-right: auto;
}
.textinspector-tools-wrapper .restart-analysis-btn.analyse-form-btn:hover,
.textinspector-tools-wrapper .restart-analysis-btn.analyse-form-btn:focus {
    background: #F8D682;
    color: #2A3654;
}
/* Blur effect for dashboard when spinner is active */
.textinspector-tools-wrapper .dashboard.blurred {
    filter: blur(4px);
    pointer-events: none;
    user-select: none;
    transition: filter 0.2s;
}
/* CEFR Level Row Styles */
.textinspector-tools-wrapper .dashboard-item-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 10px;
}

.textinspector-tools-wrapper .cefr-level-row {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1px;
}

.textinspector-tools-wrapper .cefr-level-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    justify-content: flex-start;
}

.textinspector-tools-wrapper .cefr-level-box.matching .cefr-level-score {
    background-color: var(--cefr-level-dashboard-color-accent);
}

.textinspector-tools-wrapper .cefr-level-score {
    border: 1px solid #bbb;
    border-radius: 6px;
    padding: 5px 0px;
    font-weight: 600;
    margin-right: 4px;
    background: #fff;
    min-width: 2.5em;
    text-align: center;
    font-size: 14px;
}
.textinspector-tools-wrapper .cefr-level-title {
    text-align: center;
}
/* Hide dashboard by default */
.textinspector-tools-wrapper .dashboard.is-hidden {
    display: none !important;
}

:root {
    --cefr-level-dashboard-color-accent: #FEF9C2;
}

/* Spinner overlay styles */
.textinspector-tools-wrapper .spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.35); /* semi-transparent so blur is visible */
    pointer-events: all;
}
.textinspector-tools-wrapper .spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #F5C43D;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.textinspector-tools-wrapper {
    position: relative;
    margin: 0 auto;
    padding: 10px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 16px;
}
.textinspector-tools-wrapper.masked {
    pointer-events: none;
    user-select: none;
}

.textinspector-tools-wrapper p {
    margin: auto;
}
.textinspector-tools-wrapper .submitted-text-wrapper {
    background: transparent;
    border-radius: 8px 0 0 8px;
    width: 50%;
    min-width: 0;
    box-sizing: border-box;
    margin-right: 0;
    display: flex;
    align-items: flex-start;
    flex-direction: column;
}
.textinspector-tools-wrapper .submitted-text {
    font-size: 14px;
    color: #2A3654;
    margin: 0;
    word-break: break-word;
    width: 100%;
}

.textinspector-tools-wrapper .submitted-text,
.textinspector-tools-wrapper .analyse-form textarea {
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #73767D;
    width: auto;
}

/* Analyse button styles */
.textinspector-tools-wrapper .analyse-form button[type="submit"] {
    background: #F5C43D;
    color: #2A3654;
    font-weight: 600;
    border: none;
    border-radius: 24px;
    padding: 6px 12px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
    width: 200px;
    align-self: center;
}
.textinspector-tools-wrapper .analyse-form button[type="submit"]:hover,
.textinspector-tools-wrapper .analyse-form button[type="submit"]:focus {
    background: #F8D682;
    color: #2A3654;
}

/* Dashboard styles */
.textinspector-tools-wrapper .dashboard {
    width: 100%;
    display: block;
    background: transparent;
    border-radius: 0 8px 8px 0;
}
.textinspector-tools-wrapper .dashboard-block {
    width: 100%;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.textinspector-tools-wrapper .dashboard-flex {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
}
.textinspector-tools-wrapper .dashboard-item {
    flex: 1 1 0;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #5C5C5C;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
}
.textinspector-tools-wrapper .dashboard-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 4px;
    word-break: break-word;
}
.textinspector-tools-wrapper .dashboard-label {
    font-size: 1em;
    color: #444;
    margin: auto 0px;
}

.textinspector-tools-wrapper .dashboard-cefr-level{
    background: var(--cefr-level-dashboard-color-accent);
    padding: 4px;
    border-radius: 5px;
    text-align: center;
    border: 1px solid #bbb;
}

/* Dashboard table styles */
.textinspector-tools-wrapper .dashboard-table-wrapper {
    width: 100%;
}
.textinspector-tools-wrapper .dashboard-table {
    width: 100%;
    border-collapse: collapse;
}
.textinspector-tools-wrapper .dashboard-table th,
.textinspector-tools-wrapper .dashboard-table td {
    padding: 2px 10px;
    text-align: left;
    font-size: 0.98em;
}
.textinspector-tools-wrapper .dashboard-table th {
    background: #f6f6f6;
    font-weight: 600;
}

/* Layout for the main wrapper */
.textinspector-tools-wrapper .row-top {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
}
.textinspector-tools-wrapper .analyse-form,
.textinspector-tools-wrapper .dashboard,
.textinspector-tools-wrapper .submitted-text-wrapper {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.textinspector-tools-wrapper .analyse-form {
    border-radius: 8px 0 0 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Results section: full width below */
.textinspector-tools-wrapper .results-section {
    width: 100%;
    margin-top: 0;
}
.textinspector-tools-wrapper .analysis-result {
    margin-top: 0;
}

/* Misc styles */
.textinspector-tools-wrapper .full-width {
    width: 100%;
    box-sizing: border-box;
}
.textinspector-tools-wrapper .word-count-row {
    margin: 8px 0 16px 0;
    color: #666;
    font-size: 0.8em;
    display: flex;
    flex-direction: row;
    gap: 5px;
    align-items: flex-end;
    justify-content: flex-end;
}
.textinspector-tools-wrapper .scorecard-desc {
    margin: 18px 0 12px 0;
    font-size: 1.05em;
    color: #333;
}
.textinspector-tools-wrapper .statistics-title {
    margin-top: 32px;
    margin-bottom: 8px;
    font-size: 1.2em;
    color: #1a3a5d;
}

@media (max-width: 1080px) {
    .textinspector-tools-wrapper .row-top {
        flex-direction: column;
    }
}
@media (max-width: 900px) {
    
    .textinspector-tools-wrapper .dashboard-block {
        display: flex;
        flex-direction: column;
    }
    .textinspector-tools-wrapper .dashboard-flex {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    .textinspector-tools-wrapper .dashboard-table-wrapper {
        width: 100%;
    }
    .textinspector-tools-wrapper .analyse-form,
    .textinspector-tools-wrapper .dashboard,
    .textinspector-tools-wrapper .submitted-text-wrapper {
        width: 100%;
        min-width: 0;
        border-radius: 8px;
        border: none;
    }
}

@media (max-width: 500px) {

    .textinspector-tools-wrapper .dashboard-item.dashboard-cefr-level-item {
        flex-direction: row;
        justify-content: space-evenly;
    }
    .textinspector-tools-wrapper .cefr-level-row {
        display: flex;
        flex-direction: column-reverse;
    }
    .textinspector-tools-wrapper .cefr-level-box {
        font-size: 10px;
    }
}