:root {
    --background-color: #000;
    --text-color: #fff;
    --border-color: #333;
    --accent-color: #fff;
    --button-bg: #1a1a1a;
    --button-hover-bg: #2a2a2a;
    --input-bg: #1c1c1c;
    --result-bg: #111;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('assets/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('assets/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

html, body {
    width: 100%;
    overflow-x: hidden;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 16px;
}

.container {
    width: 90%;
    max-width: 600px;
    margin: auto;
    flex: 1;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.settings {
    margin-top: 2rem;
    text-align: right;
}

.label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin: 0.75rem 0 0.5rem;
    text-align: right;
}

.hint {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.65;
    line-height: 1.6;
}

input,
textarea,
select {
    width: 100%;
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    font-family: "SF Mono", "Consolas", "Menlo", monospace;
    font-size: 0.9rem;
    box-sizing: border-box;
    direction: ltr;
}

select {
    direction: rtl !important;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
}

#cryptoPassword {
    margin-bottom: 1rem;
}

.tabs {
    display: flex;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

.tab-button {
    background: none;
    border: none;
    color: var(--text-color);
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.7;
    position: relative;
}

.tab-button.active {
    opacity: 1;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

#encode-input,
#decode-input {
    min-height: 200px;
    resize: vertical;
}

.result-box {
    margin-top: 0.5rem;
    background-color: var(--result-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    min-height: 100px;
    text-align: left;
}

.result-box pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: "SF Mono", "Consolas", "Menlo", monospace;
    font-size: 0.9rem;
}

.encode-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

#encode-copy {
    flex: 1;
    height: 48px;
}

#encode-regenerate {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

button {
    background-color: var(--button-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

button:not(:disabled):hover {
    background-color: var(--button-hover-bg);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#decode-copy {
    width: 100%;
    margin-top: 1rem;
    height: 48px;
}

#install-btn {
    margin: 0.5rem 0;
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 400;
    background: transparent;
    color: #aaa;
    border: 1px dashed #444;
    border-radius: 999px;
    opacity: 0.7;
}

#install-btn:hover {
    opacity: 1;
    color: #fff;
    border-color: #666;
}

.footer {
    position: sticky;
    bottom: 0;
    max-width: 600px;
    margin: 1rem auto 0;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    background-color: var(--background-color);
    font-size: 0.85rem;
    opacity: 0.8;
    box-sizing: border-box;
    width: 100%;
}

.footer img {
    width: 22px;
    height: 22px;
    filter: invert(1);
}

.dir-rtl {
    direction: rtl;
    text-align: right;
}

.dir-ltr {
    direction: ltr;
    text-align: left;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin: 2rem 0 1rem 0;
    direction: rtl;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.feature-item {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s;
}

.feature-item:hover {
    border-color: var(--accent-color);
}

.feature-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.feature-text {
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    color: var(--text-color);
}

.feature-sub {
    font-size: 0.7rem;
    opacity: 0.6;
    line-height: 1.4;
}

@media (max-width: 480px) {
    .features-grid {
        grid-template-columns: 1fr;
    }

    .feature-item {
        display: grid;
        grid-template-columns: min-content 1fr;
        grid-template-rows: auto auto;
        grid-template-areas:
            "icon title"
            "icon sub";

        gap: 0 0.75rem;
        padding: 0.75rem 1rem;
        text-align: right;
        align-items: center;
    }

    .feature-icon {
        grid-area: icon;
        margin: 0;
        font-size: 1.8rem;
        display: flex;
        align-items: center;
        height: 100%;
    }

    .feature-text {
        grid-area: title;
        margin: 0;
        align-self: end;
    }

    .feature-sub {
        grid-area: sub;
        margin: 0;
        align-self: start;
        padding-top: 2px;
    }
}

button,
input,
select,
textarea {
    font-family: inherit;
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 0.85rem center;
    background-size: 1rem;
    padding-left: 2.5rem;
    cursor: pointer;
}

.header-hint{
    color: #fff865;
}