/* =========================================================
   TEXT COMPARE
   CharacterCounter.com
========================================================= */

.text-compare-main {
    width: 100%;
    background: #ffffff;
}

.text-compare-section {
    width: 100%;
    padding: 68px 20px 70px;
}

.text-compare-layout {
    display: grid;
    grid-template-columns: minmax(0, 760px) 300px;
    gap: 40px;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    align-items: stretch;
}

.text-compare-main-column {
    min-width: 0;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.tool-header {
    margin-bottom: 26px;
}

.tool-header h1 {
    margin: 0 0 12px;
    color: #202124;
    font-size: 36px;
    font-weight: 700;
    line-height: 1.2;
}

.tool-intro {
    max-width: 760px;
    margin: 0;
    color: #5f6368;
    font-size: 17px;
    line-height: 1.6;
}

.compare-tool {
    width: 100%;
}

.compare-settings {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.compare-settings-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #dadce0;
}

.compare-settings legend {
    margin: 0 0 9px;
    padding: 0;
    color: #202124;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.compare-mode-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.compare-mode-option {
    position: relative;
    cursor: pointer;
}

.compare-mode-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.compare-mode-option span {
    min-height: 40px;
    padding: 8px 14px;
    display: inline-flex;
    align-items: center;
    border: 1px solid #dadce0;
    border-radius: 6px;
    color: #3c4043;
    background: #ffffff;
    font-size: 14px;
    font-weight: 600;
}

.compare-mode-option input:checked + span {
    border-color: #1a73e8;
    color: #174ea6;
    background: #e8f0fe;
}

.compare-mode-option input:focus-visible + span {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

.compare-extra-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    margin-top: 13px;
}

.compare-extra-options label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #3c4043;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    user-select: none;
}

.compare-extra-options input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: #1a73e8;
}

.compare-extra-options input:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

.settings-note {
    margin: 10px 0 0;
    color: #5f6368;
    font-size: 13px;
    line-height: 1.5;
}

.text-input-grid,
.text-highlight-layout {
    display: grid;
    width: 100%;
}

.text-input-grid {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 12px;
    align-items: stretch;
}

.text-highlight-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.text-input-section,
.highlight-section {
    min-width: 0;
}

.swap-button {
    display: inline-flex;
    align-items: center;
    justify-self: center;
    align-self: center;
    gap: 6px;
    min-width: 72px;
    padding: 8px 9px;
    white-space: nowrap;
}

.swap-button i {
    font-size: 17px;
    line-height: 1;
}

.word-output-title {
    margin: 0 0 10px;
    color: #202124;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
}

.textarea-wrapper {
    position: relative;
    width: 100%;
}

.text-compare-textarea {
    display: block;
    width: 100%;
    height: 330px;
    min-height: 100px;
    padding: 16px 16px 58px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    background: #ffffff;
    color: #202124;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-compare-textarea::placeholder {
    color: #80868b;
    opacity: 1;
}

.text-compare-textarea:hover {
    border-color: #bdc1c6;
}

.text-compare-textarea:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 1px #1a73e8;
}

.textarea-actions {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: flex;
    gap: 7px;
}

.textarea-action-button {
    min-width: 62px;
    padding: 7px 11px;
    border: 1px solid rgba(218, 220, 224, 0.9);
    border-radius: 5px;
    background: rgba(248, 249, 250, 0.94);
    color: #3c4043;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.textarea-action-button:hover:not(:disabled) {
    border-color: #bdc1c6;
    background: #f1f3f4;
}

.textarea-action-button:active:not(:disabled) {
    background: #e8eaed;
}

.textarea-action-button:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

.textarea-action-button:disabled {
    color: #9aa0a6;
    cursor: not-allowed;
}

.text-input-stats {
    min-height: 32px;
    padding: 7px 2px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 17px;
    color: #5f6368;
    font-size: 13px;
    line-height: 1.4;
}

.text-input-stats strong {
    color: #202124;
    font-weight: 600;
}

.compare-action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-top: 13px;
}

.tool-button {
    min-height: 42px;
    padding: 9px 15px;
    border: 1px solid #dadce0;
    border-radius: 6px;
    background: #ffffff;
    color: #3c4043;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tool-button:hover {
    border-color: #bdc1c6;
    background: #f8f9fa;
}

.tool-button:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

.tool-button-primary {
    border-color: #1a73e8;
    background: #1a73e8;
    color: #ffffff;
}

.tool-button-primary:hover {
    border-color: #1558b0;
    background: #1558b0;
    color: #ffffff;
}

.tool-button-text {
    border-color: transparent;
    color: #1a73e8;
    background: transparent;
}

.tool-button-text:hover {
    border-color: transparent;
    color: #1558b0;
    background: #f1f6fe;
}

.compare-live-status {
    min-height: 20px;
    margin: 8px 0 0;
    color: #5f6368;
    font-size: 13px;
    line-height: 1.5;
}

.comparison-placeholder {
    margin-top: 8px;
    padding: 14px 16px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    background: #fafafa;
    color: #5f6368;
    font-size: 14px;
    line-height: 1.5;
}

.comparison-placeholder p {
    margin: 0;
}

.comparison-placeholder[hidden] {
    display: none;
}

.compare-results {
    margin-top: 18px;
}

.compare-results[hidden] {
    display: none;
}

.results-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 13px;
}

.results-heading h2 {
    margin: 0 0 3px;
    color: #202124;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
}

.results-heading p {
    margin: 0;
    color: #5f6368;
    font-size: 14px;
    line-height: 1.5;
}

.diff-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 15px;
    color: #3c4043;
    font-size: 13px;
    white-space: nowrap;
}

.diff-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-swatch {
    width: 12px;
    height: 12px;
    display: inline-block;
    border-radius: 2px;
}

.swatch-removed {
    background: #f4cccc;
}

.swatch-added {
    background: #c6e7c8;
}

.change-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    margin: 18px 0 0;
}

.summary-card {
    min-width: 0;
    min-height: 68px;
    padding: 9px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid #dadce0;
    border-radius: 7px;
    background: #ffffff;
}

.summary-card strong {
    color: #1a73e8;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.summary-card span {
    margin-top: 4px;
    color: #5f6368;
    font-size: 12px;
    line-height: 1.3;
}

.summary-added strong {
    color: #188038;
}

.summary-removed strong {
    color: #c5221f;
}

.highlight-section .word-output-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
}

.diff-label {
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
}

.diff-label-removed {
    color: #a50e0e;
    background: #fce8e6;
}

.diff-label-added {
    color: #137333;
    background: #e6f4ea;
}

.highlighted-text {
    width: 100%;
    height: 330px;
    min-height: 110px;
    overflow: auto;
    padding: 16px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    background: #fafafa;
    color: #202124;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.highlighted-text mark {
    padding: 1px 2px;
    border-radius: 3px;
    color: #202124;
    font-weight: 600;
}

.change-removed {
    background: #f4cccc;
}

.change-added {
    background: #c6e7c8;
}

.related-tool-callout {
    margin: 26px 0 34px;
    padding: 13px 15px;
    border: 1px solid #dadce0;
    border-radius: 7px;
    background: #f8f9fa;
    color: #3c4043;
    font-size: 14px;
    line-height: 1.55;
}

.related-tool-row + .related-tool-row {
    margin-top: 7px;
}

.related-tool-callout strong {
    color: #202124;
    font-weight: 600;
}

.related-tool-callout a,
.text-compare-content a {
    color: #1a73e8;
    text-decoration: none;
}

.related-tool-callout a:hover,
.related-tool-callout a:focus,
.text-compare-content a:hover,
.text-compare-content a:focus {
    color: #1558b0;
    text-decoration: underline;
}

.text-compare-content {
    color: #3c4043;
}

.text-compare-content h2 {
    margin: 38px 0 13px;
    color: #202124;
    font-size: 25px;
    font-weight: 700;
    line-height: 1.3;
}

.text-compare-content h2:first-child {
    margin-top: 0;
}

.text-compare-content h3 {
    margin: 27px 0 8px;
    color: #202124;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.4;
}

.text-compare-content p {
    margin: 0 0 17px;
    color: #3c4043;
    font-size: 16px;
    line-height: 1.72;
}

.text-compare-content strong {
    color: #202124;
    font-weight: 600;
}

#sidebar {
    width: 300px;
    min-width: 300px;
    min-height: 600px;
    align-self: stretch;
    position: relative;
}

/* =========================================================
   RESPONSIVE LAYOUT
========================================================= */

@media only screen and (max-width: 1100px) {
    .text-compare-layout {
        grid-template-columns: minmax(0, 1fr) 300px;
        gap: 28px;
    }
}

@media only screen and (max-width: 992px) {
    .text-compare-section {
        padding-top: 82px;
    }

    .text-compare-layout {
        display: block;
        max-width: 760px;
    }

    #sidebar {
        display: none;
    }

    .tool-header h1 {
        font-size: 32px;
    }
}

@media only screen and (max-width: 800px) {
    .text-input-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .text-highlight-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .highlighted-text {
        height: auto;
        min-height: 180px;
        max-height: 400px;
    }
}

@media only screen and (max-width: 700px) {
    .text-compare-section {
        padding: 82px 16px 55px;
    }

    .tool-header {
        margin-bottom: 24px;
    }

    .tool-header h1 {
        font-size: 30px;
    }

    .tool-intro {
        font-size: 16px;
    }

    .text-compare-textarea {
        height: 300px;
    }

    .text-compare-content h2 {
        margin-top: 32px;
        font-size: 22px;
    }

    .text-compare-content h3 {
        margin-top: 24px;
        font-size: 18px;
    }
}

@media only screen and (max-width: 520px) {
    .text-compare-section {
        padding: 82px 14px 48px;
    }

    .tool-header h1 {
        font-size: 28px;
    }

    .tool-intro {
        font-size: 15px;
        line-height: 1.6;
    }

    .compare-extra-options {
        gap: 9px 16px;
    }

    .compare-extra-options label {
        font-size: 13px;
    }

    .word-output-title {
        margin-bottom: 8px;
        font-size: 19px;
    }

    .text-compare-textarea {
        height: 270px;
        min-height: 90px;
        padding: 14px 14px 58px;
        font-size: 16px;
    }

    .textarea-actions {
        right: 8px;
        bottom: 8px;
    }

    .textarea-action-button {
        padding: 7px 10px;
    }

    .text-input-stats {
        gap: 6px 14px;
        font-size: 12px;
    }

    .compare-action-row {
        gap: 7px;
    }

    .tool-button {
        min-height: 40px;
        padding: 8px 11px;
        font-size: 13px;
    }

    .results-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .results-heading h2 {
        font-size: 21px;
    }

    .change-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .summary-card {
        min-height: 64px;
        padding: 8px 9px;
    }

    .summary-card strong {
        font-size: 19px;
    }

    .highlighted-text {
        min-height: 130px;
        max-height: 320px;
        padding: 14px;
        font-size: 15px;
    }

    .related-tool-callout {
        margin: 24px 0 30px;
        padding: 12px 13px;
        font-size: 13.5px;
    }

    .text-compare-content p {
        font-size: 15.5px;
    }
}

@media only screen and (max-width: 360px) {
    .text-compare-section {
        padding-left: 12px;
        padding-right: 12px;
    }

    .tool-header h1 {
        font-size: 26px;
    }

    .compare-mode-options {
        gap: 6px;
    }

    .compare-mode-option span {
        min-height: 38px;
        padding: 7px 10px;
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}