/* ============================================
   UrduToText - Main Stylesheet
   RTL Support, Dark Mode, Responsive Design
   ============================================ */

/* CSS Variables for Theming */
:root {
    --primary-color: #10b981; /* Green */
    --secondary-color: #3b82f6; /* Blue */
    --accent-color: #8b5cf6; /* Purple */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-card: #1f2937;
    --border-color: #374151;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Nastaliq Urdu', 'Inter', 'Arial', sans-serif;
    direction: rtl;
    text-align: right;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* Container */
.container {
    max-width: 1100px;
    margin-inline: auto;
    padding-inline: 15px;
    text-align: center;
}

/* Wrapper classes */
.wrapper,
.home-wrapper,
.page-wrapper {
    max-width: 1100px;
    margin-inline: auto;
    padding-inline: 15px;
}

/* Header & Navigation */
.header {
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .header {
    background-color: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-color);
}

/* Sidebar */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background-color: var(--bg-card);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 999;
    padding: 1rem;
    direction: rtl;
}

.sidebar.hidden {
    transform: translateX(100%);
}

.sidebar-header {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    padding: 0 0.5rem;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu-item {
    margin-bottom: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 0.9375rem;
}

.sidebar-link:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
}

.sidebar-link.active {
    background-color: var(--primary-color);
    color: white;
}

.sidebar-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.sidebar-toggle {
    position: fixed;
    right: 1rem;
    top: 80px;
    z-index: 1001;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    font-size: 1.25rem;
}

.sidebar-toggle:hover {
    background-color: #059669;
    transform: scale(1.1);
}

.sidebar-toggle.hidden {
    display: none;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

/* Main Content with Sidebar */
.main-content.with-sidebar {
    margin-right: 280px;
    transition: margin-right 0.3s ease;
}

.main-content.with-sidebar.sidebar-hidden {
    margin-right: 0;
}

.navbar {
    padding: 0.875rem 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
    gap: 1rem;
    column-gap: 1.5rem;
}

.logo {
    flex-shrink: 0;
    order: 1;
}

.nav-menu {
    order: 2;
    flex: 1;
    display: flex;
    list-style: none;
    gap: 0.25rem;
    align-items: center;
    margin-inline: auto;
    padding: 0;
    justify-content: center;
    flex-wrap: wrap;
    min-width: 0;
}

.dark-mode-toggle {
    order: 3;
    margin-left: 1rem;
    margin-right: 0;
    flex-shrink: 0;
}

/* Alias classes for compatibility (if used elsewhere) */
.ut-logo,
.logo {
    flex-shrink: 0;
}

.theme-toggle,
.dark-mode-toggle {
    flex-shrink: 0;
}

.ut-nav,
.nav-menu {
    flex: 1;
    margin-inline: auto;
    min-width: 0;
}

.ut-nav-list,
.nav-menu {
    justify-content: center;
    flex-wrap: wrap;
}

.ut-topbar-inner,
.nav-container {
    column-gap: 1.5rem;
}

.logo h1 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--primary-color);
    font-family: 'Inter', sans-serif;
}

.tagline {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 0.25rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    padding: 0.625rem 1rem;
    border-radius: var(--radius);
    transition: var(--transition);
    display: block;
    white-space: nowrap;
    font-size: 0.9375rem;
}

.nav-link:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

/* Dropdown Menu */
.nav-dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dropdown-arrow {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.nav-dropdown:hover .dropdown-arrow,
.nav-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    min-width: 240px;
    max-height: 70vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-link {
    display: block;
    padding: 0.625rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.9375rem;
    border-right: 3px solid transparent;
}

.dropdown-link:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
    border-right-color: var(--primary-color);
}

.dark-mode-toggle {
    background: var(--bg-secondary);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    padding: 0;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0;
    margin-right: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.dark-mode-toggle:hover {
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.08);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.light-icon {
    display: none;
}

[data-theme="dark"] .dark-icon {
    display: none;
}

[data-theme="dark"] .light-icon {
    display: inline;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: 0;
    margin-right: auto;
    z-index: 1001;
    position: relative;
    order: 4;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 3px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
    display: block;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
    width: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
    text-align: center;
}

.section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.section-description {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 5rem 2rem;
    background: linear-gradient(135deg, #3b82f6 0%, #10b981 100%);
    border-radius: var(--radius-lg);
    color: white;
    margin: 0 auto 4rem auto;
    position: relative;
    overflow: hidden;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.hero-title {
    font-size: 3.25rem;
    margin-bottom: 1.25rem;
    color: white;
    position: relative;
    z-index: 1;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
}

.hero-description {
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    color: rgba(255, 255, 255, 0.95);
    max-width: 750px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 1;
    line-height: 1.8;
    text-align: center;
}

.hero-buttons {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.btn-hero-primary {
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.btn-hero-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-hero-outline {
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.btn-hero-outline:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hero-note {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 0;
    position: relative;
    z-index: 1;
    font-weight: 500;
    text-align: center;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
    text-align: right;
    direction: rtl;
    width: 100%;
    max-width: 1100px;
    margin-inline: auto;
}

.tool-card {
    background-color: var(--bg-card);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    text-align: right;
    direction: rtl;
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.tool-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    direction: rtl;
    text-align: right;
}

.tool-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.tool-title {
    font-size: 1.375rem;
    margin: 0;
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
    direction: rtl;
}

.tool-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    flex-grow: 1;
    text-align: right;
    direction: rtl;
    line-height: 1.7;
    font-size: 0.9375rem;
}

.tool-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.tool-more-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

.tool-more-link:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    font-family: 'Noto Nastaliq Urdu', 'Inter', sans-serif;
}

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

.btn-primary:hover {
    background-color: #059669;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background-color: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-example {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    margin: 0.25rem;
}

.btn-example:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Form Elements */
.input-textarea,
.output-textarea,
.text-input,
.select-input,
.number-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: 'Noto Nastaliq Urdu', 'Inter', sans-serif;
    background-color: var(--bg-card);
    color: var(--text-primary);
    transition: var(--transition);
}

.input-textarea:focus,
.output-textarea:focus,
.text-input:focus,
.select-input:focus,
.number-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.input-textarea,
.output-textarea {
    min-height: 150px;
    resize: vertical;
}

.output-textarea {
    background-color: var(--bg-secondary);
}

/* Utility classes for text direction */
.is-rtl {
    direction: rtl;
    text-align: right;
}

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

.textarea-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Audio Player Section */
.audio-player-section {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.waveform-container {
    width: 100%;
    margin-bottom: 1rem;
    background-color: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem;
    min-height: 100px;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.audio-time {
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Inter', monospace;
    min-width: 100px;
}

.audio-seek-bar {
    flex: 1;
    min-width: 200px;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.audio-seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.audio-seek-bar::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

/* File Info */
.file-info {
    margin: 1rem 0;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.file-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.file-info-row span {
    font-size: 0.9375rem;
    color: var(--text-primary);
}

/* Progress Section */
.progress-section {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.progress-info span:first-child {
    font-weight: 600;
    color: var(--text-primary);
}

.progress-info span:last-child {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.125rem;
}

.progress-details {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Editor Toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    gap: 0.25rem;
    padding: 0 0.5rem;
    border-right: 1px solid var(--border-color);
}

.toolbar-group:last-child {
    border-right: none;
    margin-right: auto;
}

.toolbar-btn {
    padding: 0.5rem 0.75rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    color: var(--text-primary);
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.toolbar-btn:active {
    transform: scale(0.95);
}

/* Editor Content */
.editor-content {
    min-height: 300px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    background-color: var(--bg-card);
    font-family: 'Noto Nastaliq Urdu', 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    direction: rtl;
    text-align: right;
    outline: none;
    overflow-y: auto;
}

.editor-content:empty:before {
    content: attr(placeholder);
    color: var(--text-secondary);
    font-style: italic;
}

.editor-content:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Mobile Optimizations for Audio Tool */
@media (max-width: 768px) {
    .audio-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .audio-controls .btn {
        width: 100%;
    }
    
    .audio-time {
        text-align: center;
        width: 100%;
    }
    
    .audio-seek-bar {
        width: 100%;
        min-width: 100%;
    }
    
    .file-info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .editor-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-group {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 0.5rem 0;
        width: 100%;
        justify-content: center;
    }
    
    .toolbar-group:last-child {
        border-bottom: none;
    }
    
    .toolbar-btn {
        flex: 1;
        min-width: auto;
    }
    
    .editor-content {
        min-height: 250px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
    
    .waveform-container {
        min-height: 80px;
        padding: 0.75rem;
    }
    
    .audio-player-section {
        padding: 1rem;
    }
    
    .progress-section {
        padding: 1rem;
    }
    
    .progress-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Settings Panel */
.settings-panel {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin: 1.5rem 0;
    border: 1px solid var(--border-color);
}

.settings-title {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: var(--bg-card);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.setting-item:hover {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.setting-item span {
    font-weight: 500;
    color: var(--text-primary);
}

/* Output Header */
.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.output-header label {
    margin: 0;
    font-weight: 600;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn span {
    margin-left: 0.5rem;
}

/* Mobile Optimizations for Voice Typing */
@media (max-width: 768px) {
    .tool-controls {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .tool-controls .btn {
        width: 100%;
        justify-content: center;
        padding: 1rem;
        font-size: 1rem;
    }
    
    .tool-controls .btn span {
        display: inline-block;
        margin-left: 0.5rem;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .setting-item {
        padding: 1rem;
    }
    
    .stats-bar {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .stat-item {
        justify-content: space-between;
        width: 100%;
        padding: 0.75rem;
        background-color: var(--bg-card);
        border-radius: var(--radius);
        border: 1px solid var(--border-color);
    }
    
    .stat-label {
        font-size: 0.9375rem;
    }
    
    .stat-value {
        font-size: 1.125rem;
        font-weight: 700;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .action-buttons .btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .output-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .output-header label {
        font-size: 1rem;
    }
    
    .output-header .btn-small {
        width: 100%;
        padding: 0.75rem;
    }
    
    .output-textarea {
        min-height: 250px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 1rem;
        line-height: 1.8;
    }
    
    .settings-panel {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .settings-title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .recording-status {
        padding: 1rem;
        font-size: 0.9375rem;
        margin: 1rem 0;
    }
    
    .info-box {
        padding: 1rem;
        font-size: 0.9375rem;
    }
    
    .info-box p {
        margin-bottom: 0.75rem;
    }
    
    /* Better touch targets */
    .btn {
        min-height: 44px; /* iOS recommended touch target */
        touch-action: manipulation;
    }
    
    /* Prevent text selection on buttons during tap */
    .btn:active {
        -webkit-tap-highlight-color: transparent;
    }
}

.code-output {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    direction: ltr;
    text-align: left;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-secondary);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(16, 185, 129, 0.1);
    border-style: solid;
    transform: scale(1.02);
}

.upload-area.uploading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.upload-area.uploading::after {
    content: 'لوڈ ہو رہا ہے...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    color: var(--primary-color);
    z-index: 10;
}

.file-input {
    display: none;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.upload-icon {
    font-size: 3rem;
}

.upload-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.upload-drag-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* File Info */
.file-info {
    background-color: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.file-info p {
    margin: 0.5rem 0;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 2rem;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius);
    margin: 1rem 0;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    gap: 0.5rem;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    color: var(--primary-color);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* Info Boxes */
.info-box,
.warning-box {
    padding: 1rem;
    border-radius: var(--radius);
    margin-top: 1.5rem;
}

.info-box {
    background-color: #dbeafe;
    border-right: 4px solid var(--secondary-color);
}

[data-theme="dark"] .info-box {
    background-color: #1e3a8a;
}

.warning-box {
    background-color: #fef3c7;
    border-right: 4px solid #f59e0b;
}

[data-theme="dark"] .warning-box {
    background-color: #78350f;
}

.info-box ul,
.info-box ol {
    margin-right: 1.5rem;
    margin-top: 0.5rem;
}

.info-box li {
    margin-bottom: 0.5rem;
}

/* Grammar Issue Cards */
.grammar-issue-card {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background-color: var(--bg-card);
    margin-top: 0.75rem;
    font-size: 0.9rem;
    transition: var(--transition);
}

.grammar-issue-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.issue-row {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.issue-row:last-child {
    margin-bottom: 0;
}

.issue-row strong {
    color: var(--text-primary);
    font-weight: 600;
    margin-left: 0.5rem;
}

.error-word {
    color: #dc2626;
    font-weight: 600;
    background-color: #fee2e2;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
}

.suggested-word {
    color: #059669;
    font-weight: 500;
    background-color: #d1fae5;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
}

.issue-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

[data-theme="dark"] .error-word {
    background-color: #7f1d1d;
    color: #fca5a5;
}

[data-theme="dark"] .suggested-word {
    background-color: #064e3b;
    color: #6ee7b7;
}

/* Grammar Highlight Box */
.grammar-highlight-box {
    margin-top: 10px;
    padding: 10px;
    border-radius: 6px;
    border: 1px dashed rgba(0, 0, 0, 0.15);
    font-size: 14px;
    line-height: 1.8;
    background: rgba(0, 0, 0, 0.02);
    direction: rtl;
    text-align: right;
}

.grammar-error-highlight {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-decoration-color: #e53935;
    text-underline-offset: 3px;
    background-color: rgba(229, 57, 53, 0.06);
    cursor: help;
}

.highlight-correct {
    background: rgba(0, 200, 83, 0.12);
    border-bottom: 2px solid #00c853;
    padding: 0 2px;
    border-radius: 3px;
}

.ai-mode-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.ai-mode-toggle span {
    font-size: 13px;
}

[data-theme="dark"] .grammar-highlight-box {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .grammar-error-highlight {
    background-color: rgba(229, 57, 53, 0.15);
}

/* Tool Controls */
.tool-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.translator-controls,
.subtitle-options,
.summarizer-options,
.paraphraser-options,
.tts-controls {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.language-select-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.language-select-group label {
    font-weight: 500;
    color: var(--text-primary);
}

.copy-button-container {
    margin-top: 0.75rem;
    display: flex;
    justify-content: flex-start;
}

.option-group {
    margin-bottom: 1rem;
}

.option-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.radio-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.control-group label {
    min-width: 120px;
}

.control-group input[type="range"] {
    flex: 1;
}

/* Image Preview */
.image-preview {
    margin: 1.5rem 0;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

/* Grammar Output */
.grammar-output {
    min-height: 150px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background-color: var(--bg-card);
    direction: rtl;
}

.grammar-error {
    background-color: #fee2e2;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-decoration: underline;
    cursor: pointer;
}

[data-theme="dark"] .grammar-error {
    background-color: #7f1d1d;
}

.suggestions-box {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius);
}

.suggestions-box ul {
    list-style: none;
    margin-right: 0;
}

.suggestions-box li {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: var(--bg-card);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.suggestions-box li:hover {
    background-color: var(--primary-color);
    color: white;
}

/* PDF Tabs */
.pdf-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.pdf-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: var(--transition);
    font-family: 'Noto Nastaliq Urdu', 'Inter', sans-serif;
}

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

.pdf-tab-content {
    display: none;
}

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

/* FAQ */
.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.faq-question {
    padding: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    transition: var(--transition);
}

.faq-question:hover {
    background-color: var(--bg-secondary);
}

.faq-answer {
    padding: 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
    padding: 0 1.5rem 1.5rem;
    max-height: 500px;
}

.faq-toggle {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.faq-item.active .faq-toggle {
    transform: rotate(180deg);
}

/* Blog Grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.blog-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    cursor: pointer;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.blog-card-content {
    padding: 1.5rem;
}

.blog-card-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.blog-card-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Contact Form */
.contact-form-container {
    max-width: 600px;
    margin: 0 auto;
}

.contact-form {
    background-color: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* Content Box */
.content-box {
    background-color: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-width: 800px;
    margin: 0 auto;
}

/* Footer */
.footer {
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* Voice Typing Specific Styles */
.recording-status {
    text-align: center;
    padding: 0.75rem;
    margin: 1rem 0;
    border-radius: var(--radius);
    font-weight: 500;
    transition: var(--transition);
}

.recording-status.ready {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

.recording-status.active {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
    animation: pulse 2s infinite;
}

.recording-status.paused {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.voice-message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    text-align: center;
    animation: slideDown 0.3s ease;
}

.voice-message.success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.voice-message.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.voice-message.warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.voice-message.info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Roman Input Styling (LTR) */
.roman-input {
    direction: ltr;
    text-align: left;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Tablet Responsive */
@media (max-width: 1024px) and (min-width: 769px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero {
        padding: 4rem 2rem;
    }
}

/* Responsive Design - Mobile breakpoint increased to 1024px */
@media (max-width: 1024px) {
    .nav-container {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .logo {
        order: 1;
        flex: 1;
        min-width: 0;
        margin-left: 0;
        flex-shrink: 0;
    }
    
    .dark-mode-toggle {
        order: 2;
        margin-left: 0.5rem;
        margin-right: 0;
        position: relative;
        z-index: 10;
        flex-shrink: 0;
    }
    
    .mobile-menu-toggle {
        display: flex;
        order: 3;
        margin-left: 0;
        margin-right: 0;
    }
    
    .nav-menu {
        order: 4;
        position: fixed;
        top: 60px;
        right: -100%;
        flex-direction: column;
        background-color: var(--bg-card);
        width: 100%;
        text-align: right;
        transition: right 0.3s ease;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        padding: 1rem 0;
        gap: 0;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        border-top: 1px solid var(--border-color);
        flex: none;
        margin-inline: 0;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-link {
        display: block;
        padding: 1rem 1.5rem;
        width: 100%;
        text-align: right;
        border-radius: 0;
    }

    .nav-link:hover {
        background-color: var(--bg-secondary);
    }
    
    .nav-dropdown {
        width: 100%;
    }
    
    .dropdown-toggle {
        width: 100%;
        justify-content: space-between;
    }
    
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        border-top: 1px solid var(--border-color);
        margin: 0;
        padding: 0;
        max-height: none;
        width: 100%;
        background-color: var(--bg-secondary);
    }
    
    .dropdown-link {
        padding-right: 2.5rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        transform: translateX(100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content.with-sidebar {
        margin-right: 0;
    }

    .sidebar-toggle {
        display: none;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-description {
        font-size: 1.0625rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .btn-hero-primary,
    .btn-hero-outline {
        padding: 0.875rem 2rem;
        font-size: 1rem;
        width: 100%;
    }
    
    .tool-card-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tool-more-link {
        text-align: center;
    }
    
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        border-top: 1px solid var(--border-color);
        margin-top: 0;
        padding: 0;
    }
    
    .nav-dropdown {
        flex-direction: column;
    }
    
    .dropdown-toggle {
        width: 100%;
    }

    .stats-bar {
        flex-direction: column;
        gap: 1rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    .pdf-tabs {
        flex-direction: column;
        border-bottom: none;
    }

    .pdf-tab {
        border-bottom: 2px solid var(--border-color);
        border-radius: var(--radius);
        margin-bottom: 0.5rem;
    }

    .pdf-tab.active {
        border-bottom: 2px solid var(--primary-color);
    }
}

@media (max-width: 480px) {
    .container {
        padding-inline: 15px;
        text-align: center;
    }
    
    .wrapper,
    .home-wrapper,
    .page-wrapper {
        padding-inline: 15px;
    }
    
    .nav-container {
        padding: 0 1rem;
    }
    
    .dark-mode-toggle {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .hero {
        padding: 3.5rem 1.5rem;
    }
    
    .hero-title {
        font-size: 1.875rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .tool-card {
        padding: 1.75rem;
    }
    
    .tool-icon {
        font-size: 2rem;
    }
    
    .tool-title {
        font-size: 1.25rem;
    }
    
    .nav-menu {
        gap: 0;
    }
    
    .nav-link {
        width: 100%;
        text-align: right;
    }
}

/* Mode Selector Buttons */
.mode-selector-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Noto Nastaliq Urdu', 'Inter', sans-serif;
    min-width: 180px;
}

.mode-selector-btn:hover {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
}

.mode-selector-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.mode-selector-btn.active:hover {
    background-color: #059669;
    border-color: #059669;
}

/* Voice Mode Button */
.voice-mode-btn {
    position: relative;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    min-width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-mode-btn:hover {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.voice-mode-btn.listening {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    animation: pulse-glow 1.5s ease-in-out infinite;
}

.voice-mode-btn.listening:hover {
    background-color: #059669;
    border-color: #059669;
}

.mic-icon {
    display: inline-block;
    transition: var(--transition);
}

.voice-mode-btn.listening .mic-icon {
    animation: mic-pulse 1s ease-in-out infinite;
}

/* Listening Indicator - Glowing Dot */
.listening-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: transparent;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.voice-mode-btn.listening .listening-indicator {
    opacity: 1;
    background-color: #ff4444;
    animation: listening-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.8);
}

/* Listening Indicator - Wave Animation Alternative */
.voice-mode-btn.listening::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    opacity: 0;
    animation: wave-ripple 1.5s ease-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

@keyframes mic-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes listening-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

@keyframes wave-ripple {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 150%;
        height: 150%;
        opacity: 0;
    }
}

/* Input Wrapper for Voice Typing Button */
.input-wrapper {
    position: relative;
    width: 100%;
}

/* Voice Typing Button */
.voice-typing-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.voice-typing-btn:hover {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.voice-typing-btn.listening {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    animation: voice-typing-pulse 1.5s ease-in-out infinite;
}

.voice-typing-btn.listening:hover {
    background-color: #059669;
    border-color: #059669;
}

.voice-typing-icon {
    display: inline-block;
    transition: var(--transition);
}

.voice-typing-btn.listening .voice-typing-icon {
    animation: voice-typing-icon-pulse 1s ease-in-out infinite;
}

/* Voice Typing Indicator */
.voice-typing-indicator {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: transparent;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.voice-typing-btn.listening .voice-typing-indicator {
    opacity: 1;
    background-color: #ff4444;
    animation: voice-typing-indicator-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.8);
}

@keyframes voice-typing-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

@keyframes voice-typing-icon-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

@keyframes voice-typing-indicator-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.3);
    }
}

/* Print Styles for PDF Export */
@media print {
    .header,
    .footer,
    .action-buttons,
    .tool-controls {
        display: none;
    }

    .section {
        display: block !important;
    }

    body {
        background: white;
        color: black;
    }

    .tool-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ============================================
   Modern Roman↔Urdu Converter UI
   Glassmorphism Design with Dark Theme
   ============================================ */

/* Converter Card - Glassmorphism */
.converter-card {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .converter-card {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.converter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}

/* Converter Header */
.converter-header {
    text-align: center;
    margin-bottom: 2rem;
}

.converter-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.converter-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Mode Toggle - Pill Style */
.mode-toggle-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.mode-toggle-pill {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    gap: 4px;
}

[data-theme="dark"] .mode-toggle-pill {
    background: rgba(0, 0, 0, 0.3);
}

.mode-toggle-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Nastaliq Urdu', 'Inter', sans-serif;
    position: relative;
    z-index: 1;
}

.mode-toggle-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transform: scale(1.02);
}

.mode-toggle-btn:not(.active):hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.voice-mode-btn-modern {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.voice-mode-btn-modern:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.voice-mode-btn-modern .mic-icon {
    font-size: 1.25rem;
}

/* Text Areas Container */
.textareas-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .textareas-container {
        grid-template-columns: 1fr;
    }
}

.textarea-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.textarea-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    direction: rtl;
}

.textarea-inner-wrapper {
    position: relative;
}

.textarea-modern {
    width: 100%;
    min-height: 200px;
    padding: 1.25rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.6;
    transition: all 0.3s ease;
    resize: vertical;
    font-family: 'Noto Nastaliq Urdu', 'Inter', sans-serif;
}

[data-theme="dark"] .textarea-modern {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}

.input-textarea-modern {
    direction: ltr;
    text-align: left;
    padding-right: 60px;
    font-family: 'Inter', system-ui, sans-serif;
}

.output-textarea-modern {
    direction: rtl;
    text-align: right;
    font-family: 'Noto Nastaliq Urdu', sans-serif;
}

.textarea-modern:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .textarea-modern:focus {
    background: rgba(0, 0, 0, 0.4);
}

.textarea-modern::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Voice Typing Button */
.voice-typing-btn-modern {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.voice-typing-btn-modern:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.voice-typing-btn-modern .voice-typing-icon {
    font-size: 1.125rem;
}

/* Emotion Note */
.emotion-note-modern {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: right;
    direction: rtl;
}

.emotion-note-modern strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Action Buttons */
.action-buttons-modern {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-modern {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Noto Nastaliq Urdu', 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-modern:hover::before {
    width: 300px;
    height: 300px;
}

.btn-modern span {
    position: relative;
    z-index: 1;
}

.btn-primary-modern {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-primary-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-secondary-modern {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary-modern:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Auto Toggle */
.auto-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.auto-toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 26px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.auto-toggle-label input[type="checkbox"]:checked + .toggle-slider {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.auto-toggle-label input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(-24px);
}

.toggle-text {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Dictionary Correction Section */
.dictionary-correction-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.correction-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-align: right;
    direction: rtl;
}

.correction-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .correction-inputs {
        grid-template-columns: 1fr;
    }
}

.correction-input {
    padding: 0.875rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all 0.3s ease;
}

[data-theme="dark"] .correction-input {
    background: rgba(0, 0, 0, 0.3);
}

.correction-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.btn-save-word {
    width: 100%;
    margin-top: 0.5rem;
}

.saved-message {
    margin-top: 1rem;
    padding: 0.875rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 12px;
    text-align: center;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Info Box */
.info-box-modern {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: right;
    direction: rtl;
}

.info-box-modern p {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.info-box-modern p:last-child {
    margin-bottom: 0;
}

.info-box-modern strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .converter-card {
        padding: 1.5rem;
        margin: 1rem;
    }

    .converter-title {
        font-size: 1.75rem;
    }

    .converter-subtitle {
        font-size: 0.875rem;
    }

    .mode-toggle-btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }

    .action-buttons-modern {
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn-modern {
        width: 100%;
    }
}

