@font-face {
    font-family: 'Ruposhi Bangla ANSI V2';
    src: url('font/Ruposhi Bangla ANSI V2.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}


@font-face {
    font-family: 'GangaSagarMJ Regular';
    src: url('font/GangaSagarMJ Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --background: #f8f9fa;
    --foreground: #262626;
    --card: #ffffff;
    --card-foreground: #262626;
    --primary: #F31E1E;
    --primary-foreground: #ffffff;
    --secondary: #141414;
    --secondary-foreground: #ffffff;
    --muted: #f3f4f6;
    --muted-foreground: #232222;
    --accent: #f3f4f6;
    --accent-foreground: #141414;
    --border: #e5e7eb;
    --input: #e5e7eb;
    --ring: #dc2626;
    --radius: 0.5rem;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.dark {
    --background: #222222;
    --foreground: #f8f9fa;
    --card: #181818;
    --card-foreground: #f8f9fa;
    --primary: #F31E1E;
    --primary-foreground: #ffffff;
    --secondary: #3e3e3e;
    --secondary-foreground: #ffffff;
    --muted: #3e3e3e;
    --muted-foreground: #d4d4d4;
    --accent: #3e3e3e;
    --accent-foreground: #ffffff;
    --border: #3e3e3e;
    --input: #353535;
    --ring: #F31E1E;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-decoration: none;
}

body {
    background-color: var(--background);
    color: var(--foreground);
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top, rgba(243, 30, 30, 0.12), transparent 30%),
        radial-gradient(circle at bottom, rgba(20, 20, 20, 0.1), transparent 28%);
    pointer-events: none;
    z-index: -1;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.3rem;
    border-radius: calc(var(--radius) + 4px);
    border: 1px solid rgba(229, 231, 235, 0.6);
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}

.dark .app-header {
    border-color: rgba(62, 62, 62, 0.8);
    background: rgba(24, 24, 24, 0.72);
}

.header-content {
    flex: 1;
    text-align: left;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0.65rem;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    background: rgba(243, 30, 30, 0.12);
    color: var(--primary);
}

header h1 {
    font-size: clamp(1.6rem, 4.4vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 0.4rem;
    color: var(--foreground);
}

.header-subtitle {
    max-width: 720px;
    font-size: 0.95rem;
    color: var(--muted-foreground);
    line-height: 1.4;
}

.header-links {
    margin-top: 0.75rem;
}

.header-link {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    background: var(--secondary);
    color: var(--secondary-foreground);
    font-size: 0.78rem;
    font-weight: 600;
}

header a,
footer a,
footer p {
    color: var(--foreground);
}

header a:hover,
footer a:hover {
    color: var(--primary);
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--foreground);
    transition: background-color 0.3s, color 0.3s;
}

.theme-toggle:hover {
    background-color: var(--accent);
}

.theme-toggle .fa-sun {
    display: none;
}

.dark .theme-toggle .fa-moon {
    display: none;
}

.dark .theme-toggle .fa-sun {
    display: inline-block;
}

.converter-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.9)),
        var(--card);
    color: var(--card-foreground);
    border-radius: calc(var(--radius) + 6px);
    padding: 1.5rem;
    box-shadow: 0 18px 70px -28px rgba(0, 0, 0, 0.28);
    margin-bottom: 2rem;
    flex: 1;
    border: 1px solid rgba(229, 231, 235, 0.72);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dark .converter-card {
    background:
        linear-gradient(180deg, rgba(24, 24, 24, 0.96), rgba(24, 24, 24, 0.9)),
        var(--card);
    border-color: rgba(62, 62, 62, 0.72);
}

.converter-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    background: rgba(243, 30, 30, 0.12);
    color: var(--foreground);
    font-size: 0.78rem;
    border: 1px solid rgba(243, 30, 30, 0.2);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.summary-icon {
    font-size: 0.72rem;
    color: var(--primary);
}

.converter-status {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-radius: calc(var(--radius) + 4px);
    background: linear-gradient(180deg, rgba(243, 30, 30, 0.1), rgba(243, 30, 30, 0.05));
    border: 1px solid rgba(243, 30, 30, 0.16);
}

.converter-status p {
    font-size: 0.92rem;
    color: var(--muted-foreground);
    line-height: 1.4;
    margin-left: auto;
    max-width: 62%;
    text-align: right;
}

.status-meta {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.24rem 0.58rem;
    border-radius: 999px;
    font-size: 0.63rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    background: var(--primary);
    color: var(--primary-foreground);
}

.status-direction {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.24rem 0.6rem;
    font-size: 0.68rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.72);
    color: var(--foreground);
    border: 1px solid rgba(229, 231, 235, 0.7);
}

.dark .status-direction {
    background: rgba(20, 20, 20, 0.72);
    border-color: rgba(62, 62, 62, 0.8);
}

.converter-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.textarea-container {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.58)),
        rgba(255, 255, 255, 0.38);
    border-radius: calc(var(--radius) + 4px);
    padding: 0.9rem;
    border: 1px solid rgba(229, 231, 235, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.dark .textarea-container {
    background:
        linear-gradient(180deg, rgba(40, 40, 40, 0.78), rgba(30, 30, 30, 0.62)),
        rgba(24, 24, 24, 0.6);
    border-color: rgba(62, 62, 62, 0.8);
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.editor-title-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
}

label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--foreground);
    text-align: left;
}

.editor-subtitle {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--primary);
}

.editor-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.72rem;
    color: var(--muted-foreground);
    background: var(--muted);
    border-radius: 999px;
    padding: 0.22rem 0.5rem;
}

.editor-count {
    font-weight: 700;
    color: var(--foreground);
}

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

textarea {
    width: 100%;
    min-height: 220px;
    padding: 0.9rem 0.95rem;
    border: 1px solid var(--input);
    border-radius: calc(var(--radius) + 2px);
    background-color: var(--background);
    color: var(--foreground);
    font-size: 1.3rem;
    resize: vertical;
    transition: border-color 0.3s, box-shadow 0.2s, transform 0.2s;
    line-height: 1.55;
}

textarea:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
    transform: translateY(-1px);
}

.unicode-textarea {
    font-family: 'Noto Sans Bengali', sans-serif;
}

.bijoy-textarea {
    font-family: 'Ruposhi Bangla ANSI V2', 'GangaSagarMJ Regular', sans-serif;
    font-size: 1.5rem;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.86);
    color: var(--foreground);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background-color 0.2s, transform 0.2s;
    z-index: 10;
    box-shadow: var(--shadow);
}

.textarea-wrapper:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background-color: var(--primary);
    color: var(--primary-foreground);
    transform: translateY(-1px);
}

.copy-btn.copied {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    padding: 0.78rem 1.3rem;
    border: none;
    border-radius: calc(var(--radius) + 4px);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.3s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 10px 22px -16px rgba(0, 0, 0, 0.55);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.bijoy-btn {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

.bijoy-btn:hover {
    background-color: #b91c1c;
}

.unicode-btn {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
}

.unicode-btn:hover {
    background-color: #101010;
}

.reset-btn {
    background-color: var(--muted);
    color: var(--foreground);
}

.reset-btn:hover {
    background-color: var(--accent);
}

.mobile-tabs {
    display: none;
    margin-bottom: 1.5rem;
}

.tab-buttons {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.tab-button {
    flex: 1;
    padding: 0.75rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--muted-foreground);
    transition: color 0.3s, border-color 0.3s;
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-pane {
    display: none;
}

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

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--secondary);
    color: var(--secondary-foreground);
    padding: 0.8rem 1.1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

footer {
    text-align: center;
    padding: 1rem 0;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--muted);
}

::-webkit-scrollbar-thumb {
    background: var(--muted-foreground);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--foreground);
}

@media (max-width: 768px) {
    .container {
        padding: 1rem 0.8rem 1.5rem;
    }

    .app-header {
        align-items: flex-start;
        padding: 1rem;
    }

    .converter-card {
        padding: 1rem;
    }

    .converter-layout {
        display: none;
    }

    .mobile-tabs {
        display: block;
    }

    .converter-summary {
        display: grid;
        grid-template-columns: 1fr;
    }

    .converter-status {
        flex-direction: column;
        align-items: flex-start;
    }

    .converter-status p {
        margin-left: 0;
        max-width: 100%;
        text-align: left;
    }

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

    .button-group {
        flex-direction: column;
    }

    .copy-btn {
        opacity: 1;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}