/* Footer */
.footer {
    width: 100%;
}

/* Main page grid layout */
.parent-vowel {
    display: grid;
    grid-template-columns: 1fr 8fr 1fr 300px;
    grid-template-rows: 1fr;
    grid-column-gap: 2px;
    grid-row-gap: 2px;
}

.div1-vowel {
    grid-area: 1 / 1 / 2 / 2;
}

.div2-vowel {
    grid-area: 1 / 3 / 2 / 4;
}

.div3-vowel {
    grid-area: 1 / 2 / 2 / 3;
}

.sidebar {
    grid-area: 1 / 4 / 2 / 5;
}

/* Base styles */
body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;

    margin: 0;
    padding: 0;

    min-height: 100vh;
    width: 100%;

    background: #ffffff;
}

main {
    width: 100%;
}

.icd-page-section {
    width: 100%;
    padding-top: 70px;
}

/* Main container */
.icd-container {
    width: 100%;
    max-width: none;

    padding: 15px;
    margin-top: 20px;

    display: flex;
    flex-direction: column;
    align-items: center;

    background: #ffffff;
    box-sizing: border-box;
}

/* Hero */
.icd-hero {
    width: 100%;
    text-align: center;
    margin-bottom: 12px;
}

.icd-title {
    margin: 0;
    padding: 4px 0 6px;

    color: #333;

    font-size: 34px;
    line-height: 1.2;
    font-weight: 700;
    text-align: center;
}

/* Tool card */
.icd-tool-card {
    width: 100%;

    padding: 18px;

    border: 1px solid #e2e2e2;
    border-radius: 8px;

    background-color: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);

    box-sizing: border-box;
}

/* Input area */
.icd-input-area {
    width: 100%;
    margin-top: 8px;
}

.icd-input-label {
    display: block;

    margin-bottom: 6px;

    color: #333;

    font-size: 18px;
    font-weight: bold;
}

.icd-textarea {
    width: 100%;
    height: 240px;
    min-height: 180px;

    border: 4px solid #ccc;
    border-radius: 4px;

    padding: 12px;
    margin: 0 0 12px;

    color: #222;
    background-color: #ffffff;

    font-size: 16px;
    line-height: 1.5;
    font-family: Arial, Helvetica, sans-serif;

    resize: vertical;
    box-sizing: border-box;

    box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.1);

    transition: border-color 0.3s, box-shadow 0.3s;
}

.icd-textarea:hover {
    border-color: #a9a9a9;
}

.icd-textarea:focus {
    outline: none;
    border-color: black;
    box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.2);
}

/* Buttons */
.icd-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;

    width: 100%;
    margin: 6px 0 18px;
}

.icd-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;
    padding: 10px 16px;

    border-radius: 4px;

    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;

    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.icd-button-primary {
    border: 1px solid #1a73e8;
    background-color: #1a73e8;
    color: #ffffff;
}

.icd-button-primary:hover {
    background-color: #155ec0;
    border-color: #155ec0;
    box-shadow: 0 3px 8px rgba(26, 115, 232, 0.25);
}

.icd-button-secondary {
    border: 1px solid #333;
    background-color: #ffffff;
    color: #333;
}

.icd-button-secondary:hover {
    border-color: #1a73e8;
    color: #1a73e8;
    background-color: #f3f7ff;
}

/* Results stacked layout */
.icd-results-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;

    width: 100%;
    margin-top: 8px;
}

.icd-result-panel,
.icd-table-section {
    width: 100%;

    padding: 14px;

    border: 1px solid #dcdcdc;
    border-radius: 6px;

    background-color: #fbfbfb;

    box-sizing: border-box;
}

.icd-table-section {
    margin-top: 16px;
}

.icd-panel-header {
    margin-bottom: 10px;
}

.icd-panel-header h2 {
    margin: 0 0 5px;

    color: #333;

    font-size: 20px;
    line-height: 1.3;
    font-weight: 700;
}

.icd-panel-header p {
    margin: 0;

    color: #555;

    font-size: 15px;
    line-height: 1.5;
    font-weight: 300;
}

/* Highlighted output */
.icd-highlighted-output {
    width: 100%;
    min-height: 170px;

    padding: 14px;

    border: 1px solid #ccc;
    border-radius: 4px;

    background-color: #ffffff;
    color: #222;

    font-size: 16px;
    line-height: 1.7;
    font-family: Arial, Helvetica, sans-serif;

    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;

    box-sizing: border-box;
}

/* True invisible character markers */
.icd-invisible-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 26px;
    min-height: 22px;

    margin: 0 2px;
    padding: 1px 5px;

    border: 1px solid #f2c94c;
    border-radius: 4px;

    background-color: #fff3a3;
    color: #222;

    font-size: 12px;
    line-height: 1.3;
    font-weight: 700;
    vertical-align: middle;
}

/* True invisible character marker colors */
.icd-zero-width-mark {
    background-color: #fff3a3;
    border-color: #f2c94c;
}

.icd-hidden-format-mark {
    background-color: #ffe9d6;
    border-color: #ff9f43;
}

.icd-hidden-space-mark {
    background-color: #eaf2ff;
    border-color: #9fc2ff;
}

.icd-hidden-control-mark {
    background-color: #f3e8ff;
    border-color: #b47cff;
}

/* Light gray visual guides for normal formatting */
.icd-format-guide {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 18px;
    min-height: 18px;

    margin: 0 1px;
    padding: 0 4px;

    border: 1px solid #d8d8d8;
    border-radius: 3px;

    background-color: #f4f4f4;
    color: #777;

    font-size: 10px;
    line-height: 1.2;
    font-weight: 600;
    vertical-align: middle;
}

.icd-space-guide {
    min-width: 10px;
    padding: 0 3px;
}

.icd-tab-guide {
    min-width: 28px;
}

.icd-newline-guide {
    min-width: 24px;
}

/* Backward-compatible classes in case old JS still references them */
.icd-space-mark {
    background-color: #f4f4f4;
    border-color: #d8d8d8;
    color: #777;
}

.icd-tab-mark {
    background-color: #f4f4f4;
    border-color: #d8d8d8;
    color: #777;
}

.icd-line-break-mark {
    background-color: #f4f4f4;
    border-color: #d8d8d8;
    color: #777;
}

/* Character list */
.icd-character-list {
    width: 100%;
    min-height: 120px;

    padding: 10px;

    border: 1px solid #ccc;
    border-radius: 4px;

    background-color: #ffffff;

    box-sizing: border-box;
}

.icd-character-item {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 12px;

    padding: 9px 10px;
    margin-bottom: 8px;

    border: 1px solid #e0e0e0;
    border-radius: 4px;

    background-color: #ffffff;

    font-size: 15px;
    line-height: 1.4;
}

.icd-character-item:last-child {
    margin-bottom: 0;
}

.icd-character-main {
    display: flex;
    align-items: center;

    gap: 10px;
}

.icd-character-name {
    color: #222;
    font-weight: 700;
}

.icd-character-meta {
    color: #555;
    font-size: 13px;
}

.icd-character-count {
    min-width: 34px;

    padding: 4px 8px;

    border-radius: 999px;

    background-color: #1a73e8;
    color: #ffffff;

    font-size: 13px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

/* Stats */
.icd-stats-grid,
.icd-stats-grid-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;

    width: 100%;
    margin: 16px 0 18px;

    border: 1px solid black;
    border-radius: 5px;

    overflow: hidden;
}

.icd-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-width: 0;
    min-height: 82px;
    padding: 8px 8px;

    text-align: center;
    background-color: #ffffff;

    border-right: 1px solid black;

    box-sizing: border-box;
}

.icd-stat-card:last-child {
    border-right: none;
}

.icd-stat-label {
    display: block;

    margin-bottom: 6px;

    color: #333;

    font-size: 18px;
    line-height: 1.35;
    font-weight: 600;
}

.icd-stat-label-large {
    font-size: 19px;
    font-weight: 600;
}

.icd-stat-number {
    display: block;

    color: #1a73e8;

    font-size: 36px;
    line-height: 1.05;
    font-weight: 700;
}

/* Table */
.icd-table-wrapper {
    width: 100%;
    overflow-x: auto;

    border: 1px solid #ddd;
    border-radius: 4px;

    background-color: #ffffff;
}

.icd-table {
    width: 100%;
    min-width: 620px;

    border-collapse: collapse;

    background-color: #ffffff;
    color: #222;

    font-size: 15px;
}

.icd-table th,
.icd-table td {
    padding: 10px;

    border-bottom: 1px solid #e4e4e4;

    text-align: left;
    vertical-align: middle;
}

.icd-table th {
    background-color: #f3f7ff;
    color: #333;

    font-weight: 700;
}

.icd-table tr:last-child td {
    border-bottom: none;
}

.icd-table-code {
    display: inline-block;

    padding: 3px 7px;

    border: 1px solid #ddd;
    border-radius: 4px;

    background-color: #f7f7f7;

    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 13px;
}

.icd-visible-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 30px;
    min-height: 24px;

    padding: 2px 7px;

    border: 1px solid #d0d0d0;
    border-radius: 4px;

    background-color: #f9f9f9;

    font-weight: 700;
}

/* Sample test text */
.icd-sample-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 10px;

    width: 100%;
    margin: 8px 0 6px;
}

.icd-sample-title {
    color: #333;

    font-size: 16px;
    line-height: 1.4;
    font-weight: 700;
}

.icd-sample-copy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 34px;
    padding: 7px 12px;

    border: 1px solid #333;
    border-radius: 4px;

    background-color: #ffffff;
    color: #333;

    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;

    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.icd-sample-copy-button:hover {
    border-color: #1a73e8;
    color: #1a73e8;
    background-color: #f3f7ff;
}

.icd-sample-text {
    width: 100%;
    min-height: 150px;

    padding: 12px;
    margin: 8px 0 14px;

    border: 2px solid #ccc;
    border-radius: 4px;

    background-color: #f9f9f9;
    color: #222;

    font-size: 16px;
    line-height: 1.5;
    font-family: Arial, Helvetica, sans-serif;

    resize: vertical;
    box-sizing: border-box;

    cursor: text;
}

.icd-sample-text:focus {
    outline: none;
    border-color: black;
    box-shadow: 1px 1px 6px rgba(0, 0, 0, 0.15);
}

/* Article/content styling */
.text {
    width: 100%;
    padding: 5px;
    box-sizing: border-box;
}

.icd-article {
    margin-top: 20px;
}

.parent-vowel p {
    margin-bottom: 20px;

    font-size: 18px;
    line-height: 1.6;
    font-weight: 300;
}

.parent-vowel p a {
    color: #1a73e8;
}

.parent-vowel h2,
.parent-vowel h3 {
    margin-bottom: 20px;
}

.icd-article h2 {
    margin-top: 28px;
    color: #333;
}

.icd-article h2:first-child {
    margin-top: 10px;
}

/* Desktop width limit */
@media (min-width: 1200px) {
    .div3-vowel {
        max-width: 900px;
    }
}

/* Medium desktop/tablet with sidebar */
@media (max-width: 1200px) {
    .parent-vowel {
        display: grid;
        grid-template-columns: 1fr 300px;
        grid-template-rows: 1fr;
        grid-column-gap: 2px;
        grid-row-gap: 2px;
    }

    .div1-vowel {
        display: none;
    }

    .div2-vowel {
        display: none;
    }

    .div3-vowel {
        grid-area: 1 / 1 / 2 / 2;
    }

    .sidebar {
        grid-area: 1 / 2 / 2 / 3;
    }
}

/* Tablet and small screens */
@media (max-width: 992px) {
    .parent-vowel {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        grid-column-gap: 0;
        grid-row-gap: 0;
    }

    .div3-vowel {
        grid-area: 1 / 1 / 2 / 2;
    }

    .sidebar {
        display: none;
    }
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .icd-page-section {
        padding-top: 55px;
    }

    .icd-container {
        padding: 15px;
    }

    .icd-title {
        font-size: 30px;
    }

    .icd-tool-card {
        padding: 12px;
        box-shadow: none;
    }

    .icd-textarea {
        height: 210px;
        min-height: 160px;
    }

    .icd-actions {
        flex-direction: column;
    }

    .icd-button {
        width: 100%;
    }

    .icd-panel-header h2 {
        font-size: 19px;
    }

    .icd-highlighted-output {
        min-height: 130px;
        font-size: 15px;
        line-height: 1.6;
    }

    .icd-character-list {
        min-height: 110px;
        font-size: 15px;
        line-height: 1.6;
    }

    .icd-character-item {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .icd-character-main {
        align-items: flex-start;
    }

    .icd-character-count {
        align-self: flex-start;
    }

    .icd-stats-grid,
    .icd-stats-grid-two {
        grid-template-columns: 1fr;
    }

    .icd-stat-card {
        min-height: 76px;

        border-right: none;
        border-bottom: 1px solid black;
    }

    .icd-stat-card:last-child {
        border-bottom: none;
    }

    .icd-stat-label,
    .icd-stat-label-large {
        font-size: 18px;
    }

    .icd-stat-number {
        font-size: 34px;
    }

    .icd-sample-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .icd-sample-copy-button {
        width: 100%;
    }

    .icd-sample-text {
        min-height: 140px;
        font-size: 15px;
    }

    .parent-vowel p {
        font-size: 17px;
    }
}

/* Very small screens */
@media (max-width: 400px) {
    .icd-container {
        padding: 10px;
    }

    .icd-title {
        font-size: 28px;
    }

    .icd-tool-card {
        padding: 10px;
    }

    .icd-textarea {
        height: 180px;
        min-height: 140px;
    }

    .text {
        padding: 5px;
    }

    .icd-highlighted-output,
    .icd-character-list,
    .icd-result-panel,
    .icd-table-section {
        padding: 10px;
    }

    .icd-table {
        min-width: 560px;
        font-size: 14px;
    }

    .icd-table th,
    .icd-table td {
        padding: 8px;
    }

    .icd-sample-text {
        min-height: 130px;
    }
}