@font-face {
    font-family: 'DM_Sans';
    src: url('./assets/fonts/DM_Sans/DMSans-VariableFont_opsz\,wght.ttf');
}

:root {
    --primary-bg: #F2F2F7;
    --text-color: #12131A;
    --textarea-bg: #E4E4EF;
    --checkbox-border: #12131A;
    --see-more-color: #12131A;
    --moon-icon-bg: #E4E4EF;
    --moon-icon-border: #D0D0D7;
}

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

body {
    padding: 1rem;
    background-color: var(--primary-bg);
    color: var(--text-color);
}

/* Dark mode styles */
.dark-mode {
    --primary-bg: #12131A;
    --text-color: #FFFFFF;
    --textarea-bg: #2A2B37;
    --checkbox-border: #FFFFFF;
    --see-more-color: #FFFFFF;
    --moon-icon-bg: #2A2B37;
    --moon-icon-border: #3A3A4A;
    --bar-bg-color: #21222C;
    --bar-fill-color: #BB86FC;
}

.dark-mode #text-input {
    background-color: var(--textarea-bg);
    color: white;
}

.dark-mode .moon-icon {
    background-color: var(--moon-icon-bg);
    border: 1px solid var(--moon-icon-border);
}

.dark-mode .see-more-btn {
    color: var(--see-more-color);
}

.dark-mode .bar-container {
    background-color: var(--bar-bg-color);
}

.dark-mode .bar {
    background-color: var(--bar-fill-color);
}

/* header */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.06rem 0;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-items: center;
    padding: 0.4rem;
    border-radius: 0.4rem;
    border: none;
}

.theme-toggle>img {
    width: 20px;
    height: 20px;
}

.moon-icon {
    padding: 0.5rem;
    background-color: var(--moon-icon-bg);
    border-radius: 20%;
    border: 1px solid var(--moon-icon-border);
}

/* card header */
.card-header h1 {
    font-size: 40px;
    text-align: center;
    letter-spacing: -1px;
    font-weight: bold;
    line-height: 100%;
    margin: 2.5rem 0;
}

#text-input {
    width: 100%;
    padding: 0.5rem;
    resize: none;
    border-radius: 0.75rem;
    background-color: var(--textarea-bg);
    height: 200px;
    margin-bottom: 1rem;
    border: 1px solid var(--textarea-bg);
}

#text-input:focus {
    outline: none;
    border-color: #C27CF8;
    box-shadow: 0 0 0 2px rgba(194, 124, 248, 0.3);
}

/* Error state */
#text-input.error {
    border: 2px solid #FE8159 !important;
    box-shadow: 0 0 0 2px rgba(254, 129, 89, 0.3) !important;
}

.textarea-glow {
    border-color: #C27CF8 !important;
    box-shadow: 0 0 0 2px rgba(194, 124, 248, 0.3) !important;
}

.dark-mode .textarea-glow {
    border-color: #D3A0FA !important;
    box-shadow: 0 0 0 2px rgba(211, 160, 250, 0.3) !important;
}

#text-input::placeholder,
#text-input {
    font-size: 1.25rem;
    line-height: 140%;
    letter-spacing: -0.6px;
}

.card-body {
    font-size: 20px;
    line-height: 140%;
    letter-spacing: -0.6px;
}

.options>div {
    display: flex;
    align-items: start;
    margin-bottom: 1rem;
}

.options {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    width: 100%;
    flex-direction: column;
}

.options input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1rem;
    height: 1rem;
    border: 1px solid var(--checkbox-border);
    border-radius: 4px;
    margin-right: 0.7rem;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.options input[type="checkbox"]:checked {
    background-color: #D3A0FA;
    border-color: #D3A0FA;
    box-shadow: 0 0 0 2px rgba(194, 124, 248, 0.3);
}

.options input[type="checkbox"]:checked::after {
    content: "✓";
    color: #000000;
    font-weight: 900;
    font-size: 0.9rem;
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: "Arial", sans-serif;
}

/* Character Limit Button */
.char-limit-style {
    width: 55px;
    height: 29px;
    border-color: #404254;
    border-radius: 8px;
    background-color: #FFFFFF;
    font-size: 1rem;
    font-weight: 300;
    text-align: center;
    margin-left: 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    margin-top: -8px;
}

.options-group.character {
    display: flex;
    align-items: center;
}

.char-limit-style::-webkit-inner-spin-button,
.char-limit-style::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#error-message {
    display: none;
    padding-top: 1px;
    font-size: 0.85rem;
    color: #DA3701;
    font-weight: 500;
    padding-left: 1rem;
    padding-bottom: 1rem;
}

.results {
    margin-top: 2.5rem;
}

.result-cards {
    display: grid;
    width: 100%;
    gap: 1rem;
}

.result-card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: start;
    padding: 1.7rem 1.25rem;
    border-radius: 0.75rem;
    justify-content: center;
    background-color: #f2f2f7;
}

.result-card h2 {
    font-size: 40px;
    line-height: 100%;
    letter-spacing: -1px;
    color: #000;
}

.result-card p {
    font-size: 20px;
    line-height: 140%;
    letter-spacing: -0.6px;
    z-index: 5;
    color: #000;
}

.result-card.characters {
    background-color: #D3A0FA;
}

.result-card.word {
    background-color: #FF9F00;
}

.result-card.sentence {
    background-color: #FE8159;
}

.character-svg,
.word-svg,
.sentence-svg {
    position: absolute;
    top: 10;
    right: -50px;
}

/* Letter density and percentages */
.letter-density {
    margin-top: 1.5rem;
}

.letter-density h3 {
    margin-bottom: 1.25rem;
}

.letter-density-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.75rem;
}

.letter {
    font-size: 1.1rem;
    min-width: 20px;
}


.bar-container {
    min-width: 100%;
    width: 100%;
    flex: 1;
    background-color: #dcdce4;
    border-radius: 8px;
    overflow: hidden;
    height: 12px;
    position: relative;
}

.bar {
    height: 100%;
    width: 0%;
    background-color: #D3A0FA;
    border-radius: 4px 0 0 4px;
}

.letter-density-item .percentage {
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* See More See Less Button */
.see-more-btn {
    font-weight: 5.25rem;
    display: none;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    margin-top: 8px;
}


.see-more-btn .btn-icon {
    width: 12px;
    height: 7px;
    transition: transform 0.3s ease;
    fill: currentColor;
}

.see-more-btn.active .btn-icon {
    transform: rotate(180deg);
}


/* Media Queries for tablet*/
@media screen and (min-width: 600px) and (max-width: 1024px) {
    body {
        padding: 2rem;
    }

    .card-header h1 {
        font-size: 64px;
        padding: 0 6.06rem;
        text-align: center;
        letter-spacing: -1px;
        font-weight: bold;
        line-height: 100%;
        margin: 2.5rem 0;
    }

    #text-input {
        padding: 1.25rem;
    }

    .options {
        display: flex;
        justify-content: space-between;
        flex-direction: row;
    }

    .options-group {
        display: flex;
        align-items: center;
    }

    .options-group.exclude {
        margin-right: 1.25rem;
    }

    .card-body {
        font-size: 1rem;
        line-height: 130%;
        letter-spacing: -0.6px;
    }

    .result-cards {
        grid-template-columns: repeat(3, 1fr);
    }

    .result-card h2 {
        font-size: 64px;
        line-height: 100%;
        letter-spacing: -1px;
    }

    .letter-density h3 {
        font-size: 24px;
        line-height: 130%;
        letter-spacing: -1px;
    }
}

/* Media queries for desktop*/
@media screen and (min-width: 1024px) {
    body {
        max-width: 990px;
        margin: 0 auto;
    }

    .card-body {
        font-size: 1rem;
        line-height: 130%;
        letter-spacing: -0.6px;
    }

    .card-header h1 {
        font-size: 64px;
        padding: 0 9.06rem;
        text-align: center;
        letter-spacing: -1px;
        font-weight: bold;
        line-height: 100%;
        margin: 2.5rem 0;
    }

    #text-input {
        padding: 1.25rem;
    }

    .options {
        display: flex;
        justify-content: space-between;
        flex-direction: row;
    }

    .options-group {
        display: flex;
        align-items: center;
    }

    .options-group.exclude {
        margin-right: 1.25rem;
    }

    .result-cards {
        grid-template-columns: repeat(3, 1fr);
    }

    .result-card {
        padding: 1.66rem 1rem;
    }

    .result-card h2 {
        font-size: 64px;
        line-height: 100%;
        letter-spacing: -1px;
    }

    .options>div {
        flex-direction: row;
    }
}