@font-face {
    font-family: 'AnuScript';
    src: url('fonts/anuscript1.woff2') format('woff2'),
        url('fonts/anuscript1.woff') format('woff'),
        url('fonts/anuscript1.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-color: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary-color: #38bdf8;
    --text-color: #f1f5f9;
    --text-dim: #94a3b8;
    --accent: #818cf8;
    --textarea-bg: rgba(15, 23, 42, 0.5);
}

body.light-mode {
    --bg-color: #f1f5f9;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
    --primary-color: #0284c7;
    --text-color: #0f172a;
    --text-dim: #475569;
    --accent: #4f46e5;
    --textarea-bg: #f9f9f9;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: radial-gradient(circle at top left, #1e1b4b, #0f172a 50%);
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.light-mode {
    background: radial-gradient(circle at top left, #e2e8f0, #f1f5f9 50%);
}

.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    width: 100%;
    max-width: 1000px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

header {
    text-align: center;
    margin-bottom: 40px;
}

.branding {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.app-logo {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.app-name {
    font-family: 'Ramabhadra', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--primary-color);
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 20px;
}

.header-top h1 {
    margin-bottom: 0;
    font-size: 1.5rem;
    font-weight: 400;
    opacity: 0.8;
}

.theme-toggle {
    position: absolute;
    right: 0;
}

.header-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 99px;
    border: 1px solid var(--glass-border);
}

/* Toggle Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(18px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.input-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

#record-btn.recording {
    color: #ef4444;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.toggle-container.mini {
    padding: 4px 10px;
    font-size: 0.7rem;
    gap: 6px;
}

.switch.mini {
    width: 32px;
    height: 18px;
}

.switch.mini .slider:before {
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
}

.switch.mini input:checked+.slider:before {
    transform: translateX(14px);
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.highlight {
    background: linear-gradient(90deg, var(--primary-color), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-dim);
}

.upload-area {
    border: 2px dashed var(--glass-border);
    border-radius: 20px;
    margin-bottom: 30px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: rgba(15, 23, 42, 0.2);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(56, 189, 248, 0.05);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: var(--text-dim);
}

.upload-content svg {
    color: var(--primary-color);
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.3));
}

.status-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.hidden {
    display: none !important;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.progress-bar {
    width: 100%;
    max-width: 300px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
    overflow: hidden;
}

#progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent));
    transition: width 0.3s ease;
}

.converter-grid {
    display: grid;
    grid-template-columns: 1fr 60px 1fr;
    gap: 0;
    margin-bottom: 30px;
}

.input-section,
.output-section {
    display: flex;
    flex-direction: column;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

textarea {
    width: 100%;
    height: 350px;
    background: var(--textarea-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    color: var(--text-color);
    font-size: 1.1rem;
    line-height: 1.6;
    resize: none;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.1);
}

#unicode-input {
    font-family: 'Ramabhadra', 'Inter', sans-serif;
}

#anu-output {
    font-family: 'AnuScript', sans-serif;
    color: #e40c0c;
    /* Goldish color for visibility */
}

.divider {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.arrow {
    width: 30px;
    height: 30px;
    border-top: 2px solid var(--glass-border);
    border-right: 2px solid var(--glass-border);
    transform: rotate(45deg);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
}

/* Export Dropdown */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-menu {
    position: absolute;
    right: 0;
    top: 40px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 100;
    min-width: 140px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.export-menu button {
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 8px 12px;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    width: 100%;
}

.export-menu button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
}

footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent);
    color: #fff;
    padding: 12px 24px;
    border-radius: 99px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

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

    .divider {
        height: 60px;
    }

    .arrow {
        transform: rotate(135deg);
    }
}