/* Import Google Fonts for proper Devanagari rendering */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Tiro+Devanagari+Hindi:ital@0;1&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+Devanagari:wght@400;500;600;700&display=swap');

/* Force proper Devanagari rendering for all Hindi text */
*[lang="hi"], *[lang="sa"], .hindi-text, [class*="hindi"], [id*="hindi"] {
    font-family: 'Tiro Devanagari Hindi', 'Noto Serif Devanagari', 'Noto Sans Devanagari', 'Mangal', 'Arial Unicode MS', sans-serif !important;
    font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1 !important;
    font-variant-ligatures: common-ligatures !important;
    text-rendering: optimizeLegibility !important;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--c-bg-subtle) 0%, var(--c-border) 50%, #dee2e6 100%);
    min-height: 100vh;
    color: var(--c-text);
    line-height: 1.6;
}


.container {
    max-width: 90%;
    margin: 0 auto;
    padding: 15px;
}

header {
    margin-bottom: 20px;
    color: var(--c-text);
    background: linear-gradient(135deg, #ffffff 0%, var(--c-bg-subtle) 50%, var(--c-border) 100%);
    padding: 12px 15px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    position: relative;
    overflow: visible;
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    position: relative;
    min-height: 60px;
    gap: 15px;
}
/* If header is in row layout, stack title and subtitle and center them visually */

    .header-top .logo-section {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .header-top .logo-section h1 {
        text-align: center !important;
    }

.logo-section {
    text-align: center;
    flex: 1;
    max-width: 100%;
}

.auth-section {
    position: absolute;
    top: 0;
    right: 15px;
    flex: 0 0 auto;
    max-width: none;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    z-index: 100;
    transform: none;
}

/* Quick Navigation */
.quick-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    color: var(--c-text);
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    border: 2px solid transparent;
    font-size: 14px;
    cursor: pointer;
    position: relative;
    font-family: inherit;
}

button.quick-nav-btn {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.quick-nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border-color: #ffd700;
}

.quick-nav-btn.active {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: var(--c-text);
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.3);
    border-color: #f0c800;
}

.quick-nav-text {
    font-size: 14px;
    white-space: nowrap;
}

.admin-link {
    margin-left: 20px;
}

/* Top Navigation Styles (compact variant) */
.top-nav {
    display: flex;
    justify-content: center;
    gap: 8px; /* slightly tighter */
    margin: 12px auto 4px;
    padding: 4px 8px; /* reduced vertical padding for lower height */
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    max-width: fit-content;
    position: relative;
    z-index: 10;
    flex-wrap: nowrap;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 215, 0, 0.15);
    white-space: nowrap;
    line-height: 1; /* tighten line height */
}

/* Ensure top-nav buttons stay inline and compact */
.top-nav .quick-nav-btn {
    display: inline-flex !important;
    flex-shrink: 0;
    padding: 4px 8px !important; /* compact button padding */
    font-size: 12px !important;
    height: auto !important;
    min-height: 28px !important;
    align-items: center !important;
}

.top-nav .quick-nav-text {
    font-size: 12px !important;
}

.settings-icon {
    display: inline-block;
    font-size: 1.5rem;
    color: var(--c-danger);
    text-decoration: none;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    background: transparent;
    border: none;
}

.settings-icon:hover {
    background: transparent;
    border: none;
    transform: scale(1.1);
    opacity: 0.8;
}

/* Authentication Styles */
.auth-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    /* Grid positioning handled by parent */
}

.user-info {
    position: relative;
    display: flex;
    align-items: center;
    z-index: 1001;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid rgba(231, 76, 60, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-profile:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(231, 76, 60, 0.3);
}

.user-name {
    font-weight: 600;
    color: var(--c-text);
    font-size: 0.85rem;
}

.dropdown-arrow {
    font-size: 0.7rem;
    color: var(--c-text-muted);
    transition: transform 0.3s ease;
}

.user-profile:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border: 1px solid rgba(231, 76, 60, 0.1);
    min-width: 280px;
    z-index: 10000;
    animation: dropdownFadeIn 0.2s ease-out;
}

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

.dropdown-header {
    padding: 16px;
    border-bottom: 1px solid rgba(231, 76, 60, 0.1);
}

.user-info-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.dropdown-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(231, 76, 60, 0.3);
}

.user-details {
    flex: 1;
}

.user-name-full {
    font-weight: 600;
    color: var(--c-text);
    font-size: 1rem;
    margin-bottom: 4px;
}

.user-email {
    font-size: 0.85rem;
    color: var(--c-text-muted);
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(231, 76, 60, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(231, 76, 60, 0.1);
}

.status-icon {
    font-size: 1.1rem;
}

.status-text {
    font-size: 0.9rem;
    color: var(--c-text);
    font-weight: 500;
}

.ai-status.granted {
    background: rgba(39, 174, 96, 0.05);
    border-color: rgba(39, 174, 96, 0.2);
}

.ai-status.granted .status-icon {
    color: var(--c-success);
}

.ai-status.requested {
    background: rgba(243, 156, 18, 0.05);
    border-color: rgba(243, 156, 18, 0.2);
}

.ai-status.requested .status-icon {
    color: #f39c12;
}

.library-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(231, 76, 60, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(231, 76, 60, 0.1);
}

.library-status.granted {
    background: rgba(39, 174, 96, 0.05);
    border-color: rgba(39, 174, 96, 0.2);
}

.library-status.granted .status-icon {
    color: var(--c-success);
}

.dropdown-divider {
    height: 1px;
    background: rgba(231, 76, 60, 0.1);
    margin: 0;
}

.dropdown-menu {
    padding: 8px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.95rem;
    color: var(--c-text);
}

.dropdown-item:hover {
    background: rgba(231, 76, 60, 0.05);
}

.dropdown-item .item-icon {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.dropdown-item .item-text {
    flex: 1;
    font-weight: 500;
}

.dropdown-item .item-status {
    font-size: 0.8rem;
    color: var(--c-text-muted);
    font-weight: normal;
}

.ai-access-item {
    position: relative;
}

.logout-item:hover {
    background: rgba(231, 76, 60, 0.1);
    color: var(--c-danger-strong);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.google-login-btn, .logout-btn, .ai-request-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.google-login-btn {
    background: #4285f4;
    color: white;
    border: 2px solid #4285f4;
}

.google-login-btn:hover {
    background: #357ae8;
    border-color: #357ae8;
    transform: translateY(-1px);
}

.logout-btn {
    background: var(--c-danger);
    color: white;
    border: 2px solid var(--c-danger);
}

.logout-btn:hover {
    background: var(--c-danger-strong);
    border-color: var(--c-danger-strong);
    transform: translateY(-1px);
}

.ai-request-btn {
    background: #f39c12;
    color: white;
    border: 2px solid #f39c12;
    font-size: 0.8rem;
    padding: 6px 12px;
}

.ai-request-btn:hover {
    background: #e67e22;
    border-color: #e67e22;
    transform: translateY(-1px);
}

.ai-request-btn.requested {
    background: var(--c-success);
    border-color: var(--c-success);
    cursor: default;
}

.ai-request-btn.requested:hover {
    background: var(--c-success);
    border-color: var(--c-success);
    transform: none;
}

.ai-restricted-notice {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 10px 0;
    text-align: center;
    color: #856404;
}

.ai-restricted-notice .notice-text {
    font-size: 0.85rem;
    line-height: 1.3;
    display: block;
}

.ai-restricted-notice a {
    color: var(--c-danger);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dotted var(--c-danger);
}

.ai-restricted-notice a:hover {
    color: var(--c-danger-strong);
    border-bottom: 1px solid var(--c-danger-strong);
}

.ai-restricted-notice h4 {
    margin-bottom: 10px;
    color: #856404;
    font-weight: 600;
}

.ai-restricted-notice p {
    margin: 5px 0;
    font-size: 0.9rem;
}

.logo-section h1 {
    font-size: 1.8rem;
    margin-bottom: 3px;
    color: var(--c-text);
    font-weight: 700;
    letter-spacing: 0.3px;
}

.subtitle {
    font-size: 0.95rem;
    font-weight: 400;
    margin-bottom: 0;
    color: var(--c-text-muted);
    font-style: italic;
}

.mission-statement {
    margin: 8px 0 0 0;
    padding: 10px 12px;
    background: rgba(231, 76, 60, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(231, 76, 60, 0.2);
    text-align: center;
}

.spiritual-intro {
    font-size: 1rem;
    margin-bottom: 0;
    font-weight: 500;
    color: var(--c-text);
    line-height: 1.4;
}

.spiritual-intro strong {
    color: var(--c-danger);
    font-weight: 700;
}

.tech-description {
    font-size: 1rem;
    color: var(--c-text-muted);
    line-height: 1.5;
}

.divine-quote {
    margin-top: 20px;
}

.divine-quote blockquote {
    font-size: 1.1rem;
    font-style: italic;
    color: var(--c-text);
    text-shadow: none;
    margin: 0;
    padding: 15px 20px;
    border-left: 4px solid var(--c-danger);
    background: rgba(231, 76, 60, 0.05);
    border-radius: 5px;
}

.input-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.upload-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid var(--c-border);
}

.text-input-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid var(--c-border);
}


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

.input-label,
.output-label {
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 8px;
    font-size: 14px;
}

#hindiInput {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    background: var(--c-bg-subtle);
}

#hindiInput:focus {
    outline: none;
    border-color: var(--c-danger);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.hindi-output {
    min-height: 50px;
    padding: 12px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 18px;
    background: var(--c-bg-subtle);
    display: flex;
    align-items: center;
    direction: ltr;
    text-align: left;
    color: var(--c-text);
}

.suggestions-container {
    margin-top: 8px;
    background: #fff;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
}

.suggestions-label {
    font-size: 12px;
    color: var(--c-text-muted);
    padding: 8px 12px;
    border-bottom: 1px solid #e0e6ed;
    background: var(--c-bg-subtle);
}

.suggestions-list {
    padding: 4px 0;
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
    font-family: 'Noto Sans Devanagari', sans-serif;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f1f3f4;
}

.suggestion-item:hover,
.suggestion-item.active {
    background-color: var(--c-danger);
    color: #fff;
}

.suggestion-item:last-child {
    border-bottom: none;
}

/* Hindi suggestion dropdown for textareas */
.hindi-suggestions-dropdown {
    position: absolute !important;
    background: #fff !important;
    max-height: 200px !important;
    overflow-y: auto !important;
    z-index: 1000 !important;
    font-family: 'Noto Sans Devanagari', sans-serif !important;
    font-size: 14px !important;
}

.hindi-suggestions-dropdown .suggestion-item {
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
    color: var(--c-text) !important;
}

.hindi-suggestions-dropdown .suggestion-item:hover,
.hindi-suggestions-dropdown .suggestion-item.active {
    color: #fff !important;
}

.output-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.copy-hindi-btn,
.clear-hindi-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.copy-hindi-btn {
    background: var(--c-success);
    color: #fff;
}

.copy-hindi-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

.clear-hindi-btn {
    background: var(--c-danger);
    color: #fff;
}

.clear-hindi-btn:hover {
    background: var(--c-danger-strong);
    transform: translateY(-1px);
}

/* Mobile responsiveness for Hindi input */
@media (max-width: 768px) {
    .hindi-input-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .output-actions {
        justify-content: center;
    }
    
    .copy-hindi-btn,
    .clear-hindi-btn {
        flex: 1;
        max-width: 120px;
    }
}

.input-sections h3 {
    margin-bottom: 15px;
    color: var(--c-text);
    font-size: 1.2rem;
    text-align: center;
    border-bottom: 2px solid var(--c-danger);
    padding-bottom: 8px;
}

.upload-area {
    border: 2px dashed var(--c-danger);
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: rgba(231, 76, 60, 0.05);
}

.upload-area:hover {
    border-color: var(--c-danger-strong);
    background-color: rgba(231, 76, 60, 0.1);
}

.upload-area.dragover {
    border-color: var(--c-danger-strong);
    background-color: rgba(231, 76, 60, 0.15);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--c-danger);
}

.upload-area h4 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--c-text);
}

.upload-area p {
    color: var(--c-text-muted);
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.upload-area .paste-hint {
    color: var(--c-success);
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 10px;
    margin-bottom: 10px;
}

.browse-btn {
    background: linear-gradient(135deg, var(--c-danger) 0%, var(--c-danger-strong) 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.browse-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.file-list {
    margin-top: 20px;
    padding: 20px;
    background: var(--c-primary-soft);
    border-radius: 10px;
}

.file-list h4 {
    margin-bottom: 15px;
    color: #333;
}

.file-list ul {
    list-style: none;
}

.file-list li {
    padding: 10px;
    background: white;
    margin-bottom: 10px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: move;
    transition: all 0.2s ease;
}

.file-list li.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.file-list li.drag-over {
    border-top: 3px solid #007bff;
    background: #e7f3ff;
}

.file-list li .drag-handle {
    cursor: grab;
    color: #666;
    font-size: 1.2rem;
    margin-right: 10px;
    user-select: none;
    padding: 0 5px;
    flex-shrink: 0;
}

.file-list li .drag-handle:active {
    cursor: grabbing;
}

.file-list li .file-name {
    flex: 1;
    margin: 0 10px;
    font-weight: 500;
}

.file-list li .file-size {
    color: #666;
    font-size: 0.9rem;
    margin-right: 10px;
    flex-shrink: 0;
}

.file-list li .remove-file {
    flex-shrink: 0;
    cursor: pointer;
}

.file-list li:hover {
    background: var(--c-bg-subtle);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.file-name {
    font-weight: 500;
}

.file-size {
    color: #666;
    font-size: 0.9rem;
}

.remove-file {
    background: #ff4757;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
}

.processing-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
    text-align: center;
}

.progress-container h3 {
    margin-bottom: 20px;
    color: #333;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-strong) 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-weight: 500;
    color: #333;
}

.processing-status {
    margin-top: 20px;
    padding: 15px;
    background: var(--c-primary-soft);
    border-radius: 8px;
    color: #555;
}

.results-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
    text-align: center;
}

.results-section h3 {
    color: var(--c-success);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.results-info p {
    margin-bottom: 20px;
    color: #555;
}

.download-btn, .new-conversion-btn, .print-btn {
    background: linear-gradient(135deg, var(--c-success) 0%, #2ecc71 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    cursor: pointer;
    margin: 0;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
}

.new-conversion-btn {
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-strong) 100%);
}

.print-btn {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.download-btn:hover, .new-conversion-btn:hover, .print-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.4);
}

.new-conversion-btn:hover {
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.print-btn:hover {
    box-shadow: 0 5px 15px rgba(23, 162, 184, 0.4);
}

/* Results section buttons keep original size */
.action-buttons .download-btn,
.action-buttons .new-conversion-btn,
.action-buttons .print-btn {
    padding: 12px 30px;
    font-size: 1rem;
    margin: 5px;
}

.preview-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.preview-section h3 {
    margin-bottom: 10px;
    color: #333;
    margin: 0;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.preview-header-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.preview-instructions {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.9rem;
    background: var(--c-primary-soft);
    padding: 10px;
    border-radius: 5px;
}

.preview-controls {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-secondary {
    background: var(--c-text-muted);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: var(--c-danger);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-danger:hover {
    background: var(--c-danger-strong);
}

.editable-preview {
    background: var(--c-primary-soft);
    border-radius: 8px;
    padding: 20px;
    overflow-x: auto;
    overflow-y: visible;
    margin-bottom: 20px;
}

.editable-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: white;
}

.editable-table th, .editable-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    position: relative;
    vertical-align: top;
    height: auto;
    overflow: visible;
}

.editable-table th {
    background: var(--c-primary);
    color: white;
    font-weight: 500;
    text-align: center;
}

.editable-table tr:nth-child(even) {
    background: #f9f9f9;
}

.editable-table tr {
    height: auto;
    min-height: auto;
}

.editable-table td:hover {
    background: #e3f2fd;
}

.editable-cell {
    width: 100%;
    min-height: 40px;
    height: auto;
    border: none;
    background: transparent;
    padding: 8px;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    color: #333;
    white-space: pre-wrap; /* preserve line breaks */
    word-wrap: break-word; /* wrap long words */
    word-break: break-word; /* break long words if needed */
    overflow-wrap: break-word; /* ensure words wrap */
    overflow: visible; /* show all content */
    box-sizing: border-box;
}

.editable-cell:focus {
    background: white;
    border: 2px solid var(--c-primary);
    border-radius: 4px;
}

.hindi-cell {
    font-family: 'Tiro Devanagari Hindi', 'Noto Serif Devanagari', 'Noto Sans Devanagari', 'Mangal', 'Arial Unicode MS', sans-serif !important;
    direction: ltr;
    text-align: left;
    font-size: 18px;
    font-feature-settings: 'kern' 1, 'liga' 1;
    font-variant-ligatures: common-ligatures;
    line-height: 1.6;
}

.hindi-tools {
    background: var(--c-primary-soft);
    border: 2px solid var(--c-primary);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.hindi-tools h4 {
    margin-bottom: 15px;
    color: #333;
}

.transliteration-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.transliteration-input input {
    flex: 1;
    min-width: 200px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.hindi-output {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    min-height: 50px;
    font-family: 'Tiro Devanagari Hindi', 'Noto Sans Devanagari', 'Mangal', 'Arial Unicode MS', sans-serif;
    font-size: 1.2rem;
    direction: ltr;
    text-align: left;
    color: #333;
    font-feature-settings: 'kern' 1, 'liga' 1;
}

.add-row-before-btn {
    background: var(--c-success);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    margin-right: 5px;
    min-width: 28px;
}

.add-row-before-btn:hover {
    background: #218838;
}

.remove-row-btn {
    background: #ff4757;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    min-width: 28px;
}

.remove-row-btn:hover {
    background: #ff3742;
}

.edit-hindi-btn {
    background: var(--c-success);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 5px;
}

.edit-hindi-btn:hover {
    background: #218838;
}

.text-input-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#textInput {
    width: 100%;
    min-height: 250px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.3s ease;
}

#textInput:focus {
    border-color: var(--c-danger);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

#textInput::placeholder {
    color: #999;
    font-style: italic;
}

.text-input-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.process-text-btn {
    background: linear-gradient(135deg, var(--c-success) 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.process-text-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.process-files-btn {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    margin-top: 15px;
    width: 100%;
    max-width: 200px;
}

.process-files-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.4);
}

/* Stop state */
.process-files-btn.stop {
    background: linear-gradient(135deg, var(--c-danger) 0%, var(--c-danger-strong) 100%);
}
.process-files-btn.stop:hover {
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

.clear-text-btn {
    background: linear-gradient(135deg, var(--c-text-muted) 0%, var(--c-neutral-700) 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.clear-text-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.cloud-save-btn {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    white-space: nowrap;
}

.cloud-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(23, 162, 184, 0.4);
}

/* Unused Text Container Styles */
.unused-text-container {
    background: var(--c-bg-subtle);
    border: 2px solid var(--c-border);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.unused-text-container h4 {
    color: var(--c-neutral-700);
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 8px;
}

.unused-text-content p {
    margin: 10px 0;
    color: var(--c-text-muted);
    font-size: 0.95rem;
}

.unused-text-box {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    margin: 10px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--c-neutral-700);
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 200px;
    overflow-y: auto;
}

/* CSV Library Styles */
.csv-library-section {
    margin-top: 30px;
    padding: 25px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid var(--c-border);
    overflow: visible;
    width: 100%;
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.csv-library-section h3 {
    color: var(--c-danger);
    margin: 0;
    font-size: 1.5rem;
}

.csv-library-section .search-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    overflow: visible;
}

.csv-library-section .search-controls .search-input {
    flex: 1;
    min-width: 250px;
    max-width: 100%;
}

.csv-library-section .search-controls .search-btn,
.csv-library-section .search-controls .clear-search-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: inline-block;
    visibility: visible;
}

.back-to-processing-btn {
    background: linear-gradient(135deg, var(--c-text-muted) 0%, var(--c-neutral-700) 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.back-to-processing-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

.search-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.search-input {
    flex: 1;
    min-width: 200px;
    max-width: 350px;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    border-color: var(--c-danger);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.search-btn, .close-library-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
    display: inline-block;
}

.search-btn {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.4);
}

.close-library-btn {
    background: linear-gradient(135deg, var(--c-text-muted) 0%, var(--c-neutral-700) 100%);
    color: white;
}

.close-library-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.4);
}

.clear-search-btn {
    background: linear-gradient(135deg, var(--c-danger) 0%, var(--c-danger-strong) 100%);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
    display: inline-block;
}

.clear-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

.csv-list {
    display: grid;
    gap: 15px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.csv-item {
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: var(--c-bg-subtle);
    transition: all 0.3s ease;
}

.csv-item:hover {
    border-color: var(--c-danger);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.2);
    transform: translateY(-2px);
}

.csv-item h4 {
    margin: 0 0 6px 0;
    color: var(--c-text);
    font-size: 0.95rem;
    line-height: 1.3;
    font-family: 'Tiro Devanagari Hindi', 'Noto Serif Devanagari', 'Noto Sans Devanagari', 'Mangal', 'Segoe UI', sans-serif !important;
    font-feature-settings: 'kern' 1, 'liga' 1;
    font-variant-ligatures: common-ligatures;
}

.csv-item p {
    margin: 4px 0;
    color: var(--c-text-muted);
    font-size: 0.8rem;
}

.csv-item-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
}

.csv-item-actions button {
    padding: 5px 10px;
    border: none;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preview-csv-btn {
    background: linear-gradient(135deg, var(--c-success) 0%, #20c997 100%);
    color: white;
}

.download-csv-btn {
    background: linear-gradient(135deg, var(--c-danger) 0%, var(--c-danger-strong) 100%);
    color: white;
}

.preview-csv-btn:hover, .download-csv-btn:hover, .delete-csv-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.delete-csv-btn {
    background: linear-gradient(135deg, var(--c-danger) 0%, var(--c-danger-strong) 100%);
    color: white;
}

.library-btn {
    background: linear-gradient(135deg, #6f42c1 0%, #5a32a3 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.library-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(111, 66, 193, 0.4);
}

/* CSV Upload Section */
.upload-csv-section {
    margin-bottom: 25px;
    padding: 20px;
    background: var(--c-bg-subtle);
    border-radius: 10px;
    border: 2px dashed #e0e0e0;
}

.upload-csv-section h4 {
    color: var(--c-danger);
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2rem;
}

.csv-upload-area {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.csv-upload-area:hover {
    background: rgba(231, 76, 60, 0.05);
    border-color: var(--c-danger);
}

.csv-upload-area.dragover {
    background: rgba(231, 76, 60, 0.1);
    border-color: var(--c-danger);
    transform: scale(1.02);
}

.csv-upload-area .upload-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--c-danger);
}

.csv-upload-area h4 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--c-text);
}

.csv-upload-area p {
    color: var(--c-text-muted);
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.browse-csv-btn {
    background: linear-gradient(135deg, var(--c-success) 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

/* Restricted CSV upload area styles */
.csv-upload-area.restricted {
    border-color: var(--c-danger);
    background: rgba(220, 53, 69, 0.05);
    cursor: not-allowed;
    opacity: 0.8;
}

.csv-upload-area.restricted:hover {
    border-color: var(--c-danger);
    background: rgba(220, 53, 69, 0.1);
    transform: none;
}

.csv-upload-area.restricted .upload-icon {
    color: var(--c-danger);
}

.csv-upload-area.restricted h4 {
    color: var(--c-danger);
}

.csv-upload-area.restricted .browse-csv-btn.disabled {
    background: var(--c-text-muted);
    color: #fff;
    cursor: not-allowed;
    opacity: 0.6;
}

.csv-upload-area.restricted .browse-csv-btn.disabled:hover {
    background: var(--c-text-muted);
    transform: none;
}

.browse-csv-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.csv-upload-area.drag-over {
    background: rgba(102, 126, 234, 0.15);
    border-color: var(--c-primary);
    transform: scale(1.02);
}

.upload-progress {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--c-border);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-strong) 100%);
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
}

.upload-progress p {
    text-align: center;
    color: var(--c-neutral-700);
    font-size: 0.95rem;
    margin: 0;
}

footer {
    margin-top: 15px;
    background: linear-gradient(135deg, #ffffff 0%, var(--c-bg-subtle) 50%, var(--c-border) 100%);
    color: var(--c-text);
    padding: 10px 12px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.footer-content {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
    text-align: center;
}

.temple-info h4 {
    font-size: 1.2rem;
    margin-bottom: 6px;
    color: var(--c-danger);
    font-weight: 600;
}

.temple-info p {
    margin-bottom: 5px;
    opacity: 0.9;
    line-height: 1.3;
}

/* CSV Library Page */
.csv-library-page {
    padding: 30px 0;
}

.csv-library-page .library-header {
    text-align: center;
    margin-bottom: 40px;
}

.csv-library-page .library-header h2 {
    color: var(--c-danger);
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.library-description {
    color: var(--c-text-muted);
    font-size: 1.1rem;
    margin-top: 10px;
}

.csv-library-page .search-controls {
    margin: 0 auto 40px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    align-items: center;
}

.csv-library-page .search-controls .search-input {
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.csv-library-page .search-controls .search-btn,
.csv-library-page .search-controls .clear-search-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.csv-library-page .csv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.empty-library-state {
    text-align: center;
    padding: 80px 20px;
    background: var(--c-bg-subtle);
    border-radius: 12px;
    margin: 40px auto;
    max-width: 500px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-library-state h3 {
    color: var(--c-neutral-700);
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.empty-library-state p {
    color: var(--c-text-muted);
    font-size: 1.1rem;
    margin-bottom: 25px;
}

.create-first-btn {
    display: inline-block;
    padding: 12px 30px;
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-strong) 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.create-first-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--c-text-muted);
}

.loader {
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--c-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

@media (max-width: 768px) {
    .container {
        padding: 10px;
        max-width: 95%;
    }
    
    .preview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .preview-header h3 {
        margin-bottom: 0;
    }
    
    .preview-header-buttons {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }
    
    .preview-header-buttons .download-btn,
    .preview-header-buttons .print-btn,
    .preview-header-buttons .cloud-save-btn,
    .preview-header-buttons .new-conversion-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 0.95rem;
    }
    
    /* Stack editable table rows for easier mobile CSV editing */
    .editable-table,
    .editable-table thead,
    .editable-table tbody,
    .editable-table th,
    .editable-table td,
    .editable-table tr {
        display: block;
        width: 100%;
    }
    .editable-table thead { display: none; }
    .editable-table tr {
        margin-bottom: 12px;
        background: #ffffff;
        border: 1px solid #ddd;
        border-radius: 8px;
        overflow: visible;
    }
    .editable-table td {
        position: relative;
        padding-top: 28px; /* space for label */
        height: auto;
        overflow: visible;
    }
    .editable-table td::before {
        content: attr(data-label);
        position: absolute;
        top: 6px;
        left: 8px;
        font-size: 12px;
        font-weight: 600;
        color: var(--c-text-muted);
    }
    .editable-cell {
        min-height: 80px;
        height: auto;
        overflow: visible;
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    .ai-restricted-notice {
        padding: 6px 10px;
        margin: 8px 0;
    }
    
    .ai-restricted-notice .notice-text {
        font-size: 0.8rem;
        line-height: 1.2;
    }
    
    .logo-section h1 {
        font-size: 1.5rem !important;
    }
    
    .subtitle {
        font-size: 0.9rem !important;
    }
    
    .header-top {
        flex-direction: column;
        gap: 15px;
        position: relative;
        min-height: auto;
        padding-top: 0;
    }
    
    .logo-section {
        text-align: center;
    }
    
    .auth-section {
        position: static;
        transform: none;
        z-index: 100;
        width: 100%;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        margin-bottom: 8px;
    }
    
    .header-top {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }
    
    .logo-section {
        flex: 0 0 70%;
        max-width: 70%;
        display: flex;
        align-items: center;
        gap: 8px;
        text-align: left !important;
        overflow: hidden;
    }
    
    .logo-section h1 {
        margin: 0;
        font-size: 1.3rem !important;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: left !important;
    }
    
    .logo-section .subtitle {
        text-align: left !important;
        display: none;
    }
    
    .auth-section {
        flex: 0 0 30%;
        max-width: 30%;
        justify-content: flex-end;
    }
    
    .user-profile {
        padding: 4px 8px;
        margin: 0;
        max-width: 100%;
    }
    
    .user-avatar {
        width: 24px;
        height: 24px;
        flex-shrink: 0;
    }
    
    .user-name {
        display: none;
    }
    
    .dropdown-arrow {
        display: none;
    }
    
    .user-dropdown {
        position: fixed;
        top: 80px;
        right: 10px;
        left: 10px;
        width: calc(100% - 20px);
        max-width: calc(100% - 20px);
        min-width: auto;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
        z-index: 10000;
    }
    
    .dropdown-header {
        padding: 12px;
    }
    
    .user-info-summary {
        gap: 10px;
        margin-bottom: 10px;
    }
    
    .dropdown-avatar {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }
    
    .user-name-full {
        font-size: 0.9rem;
    }
    
    .user-email {
        font-size: 0.8rem;
    }
    
    .ai-status {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    
    .status-text {
        font-size: 0.8rem;
    }
    
    .dropdown-menu {
        padding: 8px;
    }
    
    .dropdown-item {
        padding: 10px 12px !important;
        font-size: 0.9rem !important;
    }
    
    .dropdown-divider {
        margin: 6px 0 !important;
    }
        
    .quick-nav-btn {
        padding: 6px 3px;
        justify-content: center;
        font-size: clamp(12px, 2.5vw, 14px);
        flex: 1;
        min-width: 0;
        gap: 3px;
    }
        
    .quick-nav-text {
        font-size: clamp(12px, 2.5vw, 14px);
        white-space: nowrap;
        overflow: visible;
        line-height: 1.2;
    }
    
    .top-nav {
        flex-direction: row;
        gap: 4px;
        padding: 6px 8px;
        margin: 10px auto 5px;
        max-width: fit-content;
        flex-wrap: nowrap;
        justify-content: center;
    }
    
    .top-nav .quick-nav-btn {
        padding: 6px 3px;
        justify-content: center;
        font-size: clamp(12px, 2.5vw, 14px);
        flex: none;
        min-width: fit-content;
        gap: 3px;
    }
        
    .top-nav .quick-nav-text {
        font-size: clamp(12px, 2.5vw, 14px);
        white-space: nowrap;
        overflow: visible;
        line-height: 1.2;
    }
    
    .input-sections {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .upload-section, .text-input-section {
        padding: 15px;
    }
    
    .upload-area {
        padding: 15px;
    }
    
    .upload-icon {
        font-size: 2rem;
    }
    
    .upload-area h4 {
        font-size: 1rem;
    }
    
    .upload-area p {
        font-size: 0.8rem;
    }
    
    .text-input-area {
        gap: 10px;
    }
    
    #textInput {
        min-height: 200px;
        font-size: 0.85rem;
        padding: 10px;
    }
    
    .text-input-controls {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .process-text-btn, .clear-text-btn, .process-files-btn {
        width: 100%;
        max-width: 180px;
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .browse-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .input-sections h3 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    .mission-statement {
        margin: 8px 0 0 0;
        padding: 10px 12px;
    }
    
    .library-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .library-header h2 {
        font-size: 1.4rem !important;
        margin-bottom: 10px;
    }
    
    .library-header > div {
        flex-direction: column !important;
        width: 100%;
        gap: 10px !important;
    }
    
    #toggleUploadBtn {
        padding: 8px 16px !important;
        font-size: 12px !important;
        width: 100%;
        max-width: 100%;
        margin-left: 0 !important;
        justify-content: center;
    }
    
    .upload-csv-section {
        padding: 15px !important;
        margin-bottom: 20px;
    }
    
    .upload-csv-section h4 {
        font-size: 1rem !important;
    }
    
    .csv-upload-area {
        padding: 15px !important;
    }
    
    .csv-upload-area h4 {
        font-size: 0.9rem !important;
    }
    
    .csv-upload-area p {
        font-size: 0.8rem !important;
    }
    
    .browse-csv-btn {
        padding: 8px 16px !important;
        font-size: 0.85rem !important;
    }
    
    .search-controls {
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .search-input {
        flex: 1;
        min-width: 200px;
        width: auto;
    }
    
    .search-btn, .clear-search-btn {
        flex: 0 0 auto;
        padding: 8px 12px !important;
        font-size: 0.75rem !important;
    }
    
    .back-to-processing-btn {
        font-size: 0.85rem;
        padding: 8px 16px;
    }
    
    .container {
        overflow-x: hidden;
        max-width: 100%;
    }
    
    body {
        overflow-x: hidden;
    }
    
    header {
        overflow: visible;
    }
    
    .header-top {
        overflow: visible;
    }
    
    .auth-section {
        overflow: visible;
    }
    
    .csv-library-page {
        overflow-x: hidden;
        max-width: 100%;
    }
    
    .csv-item-actions {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .csv-item-actions button {
        padding: 4px 8px !important;
        font-size: 0.7rem !important;
        flex: 1;
        min-width: 0;
    }
    
    .csv-item h4 {
        font-size: 0.85rem !important;
        line-height: 1.2;
    }
    
    .csv-item p {
        font-size: 0.75rem !important;
    }
    
    .library-description {
        font-size: 0.9rem !important;
    }
    
    .logo-section h1 {
        font-size: 1.5rem !important;
    }
    
    .subtitle {
        font-size: 0.9rem !important;
    }
    
    .mission-statement p {
        font-size: 0.9rem !important;
    }
    
    /* Preview Modal Footer - Mobile */
    .preview-modal-footer {
        flex-wrap: nowrap !important;
        gap: 4px !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        justify-content: flex-start !important;
    }
    
    .preview-edit-btn,
    .preview-delete-btn,
    .preview-download-btn,
    .preview-close-btn {
        padding: 6px !important;
        font-size: 0 !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        margin: 0 !important;
        flex: 0 0 auto !important;
        justify-content: center !important;
        align-items: center !important;
        border-radius: 6px !important;
    }
    
    /* Hide text on mobile, show only icons */
    .preview-edit-btn .btn-text,
    .preview-delete-btn .btn-text,
    .preview-download-btn .download-text,
    .preview-close-btn .btn-text {
        display: none !important;
    }
    
    /* Show icons only */
    .preview-edit-btn .btn-icon,
    .preview-delete-btn .btn-icon,
    .preview-download-btn .download-icon,
    .preview-close-btn .btn-icon {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 14px !important;
        line-height: 1 !important;
        width: 100% !important;
        height: 100% !important;
    }
    
    /* Download dropdown on mobile */
    .download-dropdown-container {
        position: relative;
    }
    
    .download-dropdown-menu {
        position: fixed !important;
        bottom: auto !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        margin-bottom: 0 !important;
        min-width: 200px !important;
        box-shadow: 0 8px 24px rgba(0,0,0,0.3) !important;
        z-index: 10002 !important;
    }
    
    .csv-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    
    /* Preview modal on mobile */
    .modal-overlay {
        padding: 10px !important;
    }
    
    .preview-modal-overlay > div {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 95vh !important;
        margin: 0 !important;
    }
    
    /* Modal header on mobile - smaller */
    .preview-modal-overlay > div > div:first-child {
        padding: 8px 10px !important;
        flex-wrap: wrap !important;
        min-height: auto !important;
    }
    
    .preview-modal-overlay > div > div:first-child h3 {
        font-size: 0.95rem !important;
        word-break: break-word;
        margin: 0 !important;
        line-height: 1.3 !important;
    }
    
    .close-modal-btn {
        font-size: 1.2rem !important;
        padding: 2px 6px !important;
        line-height: 1 !important;
    }
    
    /* Modal table container - give more space */
    .preview-modal-overlay > div > div:nth-child(2) {
        padding: 8px !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        flex: 1 !important;
        min-height: 200px !important;
        max-height: calc(95vh - 140px) !important;
    }
    
    /* Ensure table is visible in modal on mobile */
    .preview-modal-overlay table {
        display: table !important;
        width: 100% !important;
        font-size: 13px !important;
        border-collapse: collapse !important;
        table-layout: auto !important;
    }
    
    .preview-modal-overlay table thead {
        display: table-header-group !important;
    }
    
    .preview-modal-overlay table tbody {
        display: table-row-group !important;
    }
    
    .preview-modal-overlay table tr {
        display: table-row !important;
    }
    
    .preview-modal-overlay table th,
    .preview-modal-overlay table td {
        display: table-cell !important;
        padding: 6px 4px !important;
        font-size: 12px !important;
        line-height: 1.4 !important;
        word-wrap: break-word !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
    }
    
    .preview-modal-overlay table th {
        font-size: 11px !important;
        padding: 6px 4px !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
    }
    
    /* Preview modal footer on mobile - smaller */
    .preview-modal-overlay > div > div:last-child {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 4px !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: auto !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .preview-modal-overlay > div > div:last-child > button {
        padding: 6px !important;
        font-size: 0 !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        flex: 0 0 auto !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Hide text in buttons, show only icons */
    .preview-modal-overlay > div > div:last-child > button .btn-text,
    .preview-modal-overlay > div > div:last-child > button .download-text {
        display: none !important;
    }
    
    /* Show icons */
    .preview-modal-overlay > div > div:last-child > button .btn-icon,
    .preview-modal-overlay > div > div:last-child > button .download-icon {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 14px !important;
        width: 100% !important;
        height: 100% !important;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .quick-nav-btn {
        padding: 5px 3px;
        font-size: clamp(11px, 2.3vw, 13px);
        gap: 2px;
    }
        
    .quick-nav-text {
        font-size: clamp(11px, 2.3vw, 13px);
    }
        
    .top-nav {
        gap: 3px;
        padding: 5px 6px;
        max-width: fit-content;
        flex-wrap: nowrap;
    }
    
    .top-nav .quick-nav-btn {
        padding: 5px 3px;
        font-size: clamp(11px, 2.3vw, 13px);
        gap: 2px;
        flex: none;
        min-width: fit-content;
    }
        
    .top-nav .quick-nav-text {
        font-size: clamp(11px, 2.3vw, 13px);
    }
    
    /* Download Modal Mobile Styles */
    .preview-modal-overlay > div {
        padding: 20px !important;
        max-width: 90% !important;
    }
    
    .download-option-btn {
        padding: 12px 16px !important;
        font-size: 14px !important;
        gap: 8px !important;
    }
    
    /* Very small screens - even smaller buttons */
    .preview-modal-footer {
        gap: 3px !important;
    }
    
    .preview-edit-btn,
    .preview-delete-btn,
    .preview-download-btn,
    .preview-close-btn {
        padding: 5px !important;
        font-size: 0 !important;
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        max-width: 32px !important;
        border-radius: 5px !important;
        flex: 0 0 auto !important;
    }
    
    .preview-edit-btn .btn-icon,
    .preview-delete-btn .btn-icon,
    .preview-download-btn .download-icon,
    .preview-close-btn .btn-icon {
        font-size: 12px !important;
    }
}

/* Tablet optimizations */
@media (max-width: 1024px) and (min-width: 769px) {
    .container {
        max-width: 85%;
        padding: 12px;
    }
    
    .logo-section h1 {
        font-size: 2rem;
    }
    
    .input-sections {
        gap: 18px;
    }
    
    .upload-section, .text-input-section {
        padding: 18px;
    }
    
    #textInput {
        min-height: 220px;
    }
}

/* Helper buttons styling */
.helper-btn {
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-strong) 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.helper-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.helper-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.helper-btn:disabled,
.helper-btn.is-loading {
    opacity: 0.78;
    cursor: wait;
    transform: none !important;
}

.button-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: button-spin 0.8s linear infinite;
    vertical-align: middle;
}

.button-loading-text {
    vertical-align: middle;
}

@keyframes button-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Color-coded helper buttons */
.helper-btn.blue {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.helper-btn.blue:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f6391 100%);
}

.helper-btn.orange {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
}

.helper-btn.orange:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
}

.helper-btn.green {
    background: linear-gradient(135deg, var(--c-success) 0%, #229954 100%);
    color: white;
}

.helper-btn.green:hover {
    background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
}

.helper-btn.red {
    background: linear-gradient(135deg, var(--c-danger) 0%, var(--c-danger-strong) 100%);
    color: white;
}

.helper-btn.red:hover {
    background: linear-gradient(135deg, var(--c-danger-strong) 0%, #a93226 100%);
}

.column-helpers {
    border: 1px solid #e0e6ed;
    border-radius: 8px;
}

.column-helpers h4 {
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.helper-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    border: 1px solid #e5e9f0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.75);
}

.helper-group-title {
    width: 100%;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5f6c7b;
    margin-bottom: 2px;
}

.app-feedback-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    z-index: 10000;
    padding: 20px;
}

.app-feedback-overlay.visible {
    display: flex;
}

.app-feedback-modal {
    width: min(92vw, 560px);
    max-height: min(86vh, 720px);
    overflow: hidden;
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.28);
    display: flex;
    flex-direction: column;
}

.app-feedback-modal.loading .app-feedback-actions {
    opacity: 0.95;
}

.app-feedback-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.app-feedback-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.app-feedback-close {
    border: none;
    background: transparent;
    color: #475569;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.app-feedback-body {
    padding: 18px;
    overflow: auto;
}

.app-feedback-message {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: #1f2937;
}

.app-feedback-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 18px 18px;
}

/* Better formatting for extracted text lines */
.extracted-line {
    margin-bottom: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #eee;
}

.extracted-line:last-child {
    border-bottom: none;
}

/* Suggestion indicators for AI-generated content */
.cell-container {
    position: relative;
    display: flex;
    flex-direction: column;
}

.suggested-text {
    background-color: #ffe6e6 !important;
    border: 2px solid #ff4444 !important;
    box-shadow: 0 0 5px rgba(255, 68, 68, 0.3);
}

.auto-generated-translit {
    border: 2px dashed #ffc107 !important;
    background-color: #fffacd !important;
    opacity: 0.92;
    box-shadow: 0 0 4px rgba(255, 193, 7, 0.4);
}

.suggestion-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ff4444;
    color: white;
    border: none;
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 3px;
    cursor: pointer;
    z-index: 10;
    font-weight: bold;
}

.suggestion-btn:hover {
    background: #cc3333;
}

/* Legend for suggestion indicators */
.suggestion-legend {
    background: var(--c-bg-subtle);
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 10px;
    margin: 10px 0;
    font-size: 14px;
}

.suggestion-legend h4 {
    margin: 0 0 10px 0;
    color: var(--c-neutral-700);
}

.suggestion-legend .legend-item {
    display: flex;
    align-items: center;
    margin: 5px 0;
}

.suggestion-legend .indicator {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    margin-right: 10px;
    border: 2px solid;
}

.suggestion-legend .indicator.red {
    background-color: #ffe6e6;
    border-color: #ff4444;
}

.suggestion-legend .indicator.yellow {
    background-color: #fff8dc;
    border-color: #ffcc00;
}

/* Custom Success Modal */
.success-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.success-modal {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    animation: slideIn 0.3s ease;
}

.success-modal-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.success-modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 10px;
}

.success-modal-message {
    font-size: 1rem;
    color: #555;
    margin-bottom: 20px;
    line-height: 1.5;
}

.success-modal-button {
    background: linear-gradient(135deg, var(--c-success) 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.success-modal-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Print Styles - Hide header, footer, and navigation */
@media print {
    header,
    footer,
    .header,
    .footer,
    nav,
    .results-toolbar,
    .preview-header-buttons,
    .action-buttons,
    .csv-library-section .library-header button,
    .upload-csv-section {
        display: none !important;
    }
    
    body {
        background: white !important;
    }
    
    .container {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}
