/* Custom Font Faces */
@font-face {
    font-family: 'EatHappyBasic';
    src: url('./fonts/EatHappyBasic-T.otf') format('opentype'),
         url('/fonts/EatHappyBasic-T.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

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

:root {
    /* Office Employee Theme */
    --primary-office: #003DA6;
    --primary-office-light: #336cb8;
    --primary-office-dark: #002a74;
    --primary-office-hover: #4a7bc8;
    
    /* Field Manager Theme */
    --primary-field: #FF646E;
    --primary-field-light: #ff8990;
    --primary-field-dark: #cc4e58;
    --primary-field-hover: #ff9da4;
    
    /* Neutral Colors */
    --background: #FFFFFF;
    --surface: #F5F5F7;
    --surface-light: #FAFAFA;
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --border-light: #E5E5EA;
    
    /* Design System */
    --border-radius-sm: 8px;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow: 0 4px 12px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.16);
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 300ms ease;
}

/* Role-based theming */
body.role-office {
    --primary: var(--primary-office);
    --primary-light: var(--primary-office-light);
    --primary-dark: var(--primary-office-dark);
    --primary-hover: var(--primary-office-hover);
    --primary-rgb: 0, 61, 166; /* RGB values for #003DA6 */
}

body.role-field {
    --primary: var(--primary-field);
    --primary-light: var(--primary-field-light);
    --primary-dark: var(--primary-field-dark);
    --primary-hover: var(--primary-field-hover);
    --primary-rgb: 255, 100, 110; /* RGB values for #FF646E */
}

/* Default to office theme */
:root {
    --primary: var(--primary-office);
    --primary-light: var(--primary-office-light);
    --primary-dark: var(--primary-office-dark);
    --primary-hover: var(--primary-office-hover);
    --primary-rgb: 0, 61, 166; /* Default RGB */
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: inherit;
}

html, body {
    height: 100%;
    font-family: 'Montserrat', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Vietnamese font override - replace ALL fonts with Montserrat */
html[lang="vi"] *,
html[lang="vi"] *::before,
html[lang="vi"] *::after,
html[lang="vi"] .title,
html[lang="vi"] h1, html[lang="vi"] h2, html[lang="vi"] h3,
html[lang="vi"] h4, html[lang="vi"] h5, html[lang="vi"] h6,
html[lang="vi"] .welcome-greeting,
html[lang="vi"] .mud-appbar .mud-typography,
html[lang="vi"] .app-logo-btn {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Mobile First Design */
.container {
    width: 100%;
    padding: var(--spacing-md);
    margin: 0 auto;
}

/* Service Card Grid */
.service-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* Service Card */
.service-card {
    background: var(--surface-light);
    border-radius: var(--border-radius);
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.service-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
}

.service-card:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.service-card-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
    color: var(--primary);
    transition: color var(--transition);
}

.service-card:hover .service-card-icon {
    color: var(--primary-hover);
}

.service-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

/* App Layout */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: var(--surface-light);
    border-bottom: 1px solid var(--border-light);
    padding: var(--spacing-md);
    flex-shrink: 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.header-content h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Chat Interface */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 64px); /* Account for MudAppBar */
    position: relative;
    overflow: hidden;
}

/* Ensure proper spacing below fixed navbar */
.mud-main-content {
    padding-top: 0 !important; /* MudAppBar is sticky, not fixed, so no extra padding needed */
}

.chat-header {
    padding: var(--spacing-md);
    background: var(--surface-light);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
    padding-bottom: 100px;
}

.message-bubble {
    max-width: 85%;
    padding: var(--spacing-md);
    border-radius: var(--border-radius-lg);
    margin-bottom: var(--spacing-md);
    word-wrap: break-word;
}

.message-user {
    background: var(--primary);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: var(--spacing-xs);
}

.message-assistant {
    background: var(--surface);
    color: var(--text-primary);
    border-bottom-left-radius: var(--spacing-xs);
}

/* Chat Input Bar (Gemini Style) */
.chat-input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--background);
    border-top: 1px solid var(--border-light);
    padding: var(--spacing-md);
    z-index: 100;
}

.chat-input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    background: var(--surface-light);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: var(--spacing-sm);
    transition: all var(--transition);
}

.chat-input-wrapper:hover {
    border-color: rgba(var(--primary-rgb), 0.2);
}

.chat-input-wrapper:focus-within {
    border-color: rgba(var(--primary-rgb), 0.5);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.1);
}

/* Old .chat-input styles removed - now using .chat-input-optimized */

.chat-input-actions {
    display: flex;
    gap: var(--spacing-sm);
    padding-right: var(--spacing-sm);
}

.chat-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.chat-action-btn:hover {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-hover);
    transform: scale(1.05);
}

.chat-action-btn:active {
    transform: scale(0.95);
    background: rgba(var(--primary-rgb), 0.2);
}

/* Welcome Screen */
.welcome-container {
    text-align: center;
    padding: var(--spacing-xl);
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}


.welcome-greeting {
    font-size: 28px;
    font-weight: 300;
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
    transition: color var(--transition);
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    line-height: 1.3;
    text-align: center;
    max-width: 100%;
}

/* Mobile optimization for long names */
@media (max-width: 767px) {
    .welcome-greeting {
        font-size: 24px;
        line-height: 1.2;
        padding: 0 16px;
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
}

@media (max-width: 479px) {
    .welcome-greeting {
        font-size: 22px;
        line-height: 1.1;
        padding: 0 12px;
    }
}

.welcome-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
}

/* Role Selector */
.role-selector {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    padding: var(--spacing-lg);
}

.role-btn {
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--border-radius);
    border: 2px solid var(--border-light);
    background: var(--surface-light);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    min-width: 150px;
}

.role-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.role-btn.active-office {
    background: var(--primary-office);
    color: white;
    border-color: var(--primary-office);
}

.role-btn.active-field {
    background: var(--primary-field);
    color: white;
    border-color: var(--primary-field);
}

/* Language Selector */
.language-selector {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
}

/* Mobile Specific Styles */
@media (max-width: 767px) {
    /* Mobile Actions Container - Improved Toggle Design */
    .mobile-actions-container {
        display: flex;
        align-items: center;
        background: rgba(var(--primary-rgb), 0.06);
        border-radius: 8px;
        padding: 2px;
        height: 32px;
        width: 32px;
        overflow: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
    }
    
    .mobile-actions-container.expanded {
        width: 128px;
        background: rgba(var(--primary-rgb), 0.1);
    }
    
    /* Mobile Toggle Button - Better Design */
    .mobile-toggle-btn {
        width: 28px;
        height: 28px;
        border-radius: 6px;
        background: rgba(var(--primary-rgb), 0.1);
        border: none;
        color: var(--primary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        flex-shrink: 0;
        z-index: 2;
    }
    
    .mobile-toggle-btn:hover {
        background: rgba(var(--primary-rgb), 0.2);
        transform: scale(1.05);
    }
    
    .mobile-toggle-btn:active {
        transform: scale(0.95);
    }
    
    /* Mobile Actions List */
    .mobile-actions-list {
        display: flex;
        align-items: center;
        gap: 1px;
        margin-left: 2px;
        opacity: 0;
        transform: translateX(-10px);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        pointer-events: none;
    }
    
    .mobile-actions-container.expanded .mobile-actions-list {
        opacity: 1;
        transform: translateX(0);
        pointer-events: auto;
    }
    
    /* Mobile Action Buttons */
    .mobile-action-btn {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        border-radius: 4px !important;
        padding: 0 !important;
        background: transparent !important;
    }
    
    .mobile-action-btn:hover {
        background: rgba(var(--primary-rgb), 0.15) !important;
    }
    
    
    
    /* Desktop action buttons hidden on mobile */
    .d-none.d-md-flex.chat-input-actions {
        display: none !important;
    }
    
    /* Old mobile .chat-input styles removed - now using .chat-input-optimized */
    
    /* Input wrapper adjustments */
    .chat-input-wrapper {
        padding: 4px;
        gap: 6px;
        align-items: center;
    }
    
    /* Send button for mobile */
    .chat-input-wrapper .mud-icon-button:last-child {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        flex-shrink: 0;
    }
    
    .chat-input-wrapper .mud-icon-button:last-child .mud-icon-root {
        font-size: 16px !important;
    }
}

/* Responsive Design */
@media (min-width: 768px) {
    .container {
        max-width: 768px;
        padding: var(--spacing-lg);
    }
    
    /* Old desktop .chat-input styles removed - now using .chat-input-optimized */
    
    /* Desktop input wrapper */
    .chat-input-wrapper {
        padding: 6px;
        gap: 8px;
    }
    
    /* Desktop action buttons - normal size */
    .chat-input-actions {
        gap: var(--spacing-sm);
        padding-right: var(--spacing-sm);
    }
    
    .chat-action-btn {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
    }
    
    .chat-action-btn .mud-icon-root {
        font-size: 18px !important;
    }
}
    
    .service-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-lg);
    }
    
    .service-card {
        min-height: 150px;
    }
    
    .service-card-icon {
        font-size: 40px;
    }
    
    .service-card-title {
        font-size: 16px;
    }
    
    .message-bubble {
        max-width: 90%;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
    }
    
    .service-grid {
        max-width: 800px;
    }
    
    .message-bubble {
        max-width: 90%;
    }
}

/* MudBlazor Overrides */
.mud-theme-primary {
    background-color: var(--primary);
}

.mud-button-root {
    text-transform: none;
    border-radius: var(--border-radius);
    font-family: 'Montserrat', 'Roboto', sans-serif;
}

.mud-paper {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

/* Apply Montserrat font to all MudBlazor components */
.mud-typography {
    font-family: 'Montserrat', 'Roboto', sans-serif !important;
}

.mud-input {
    font-family: 'Montserrat', 'Roboto', sans-serif !important;
}

.mud-menu-item {
    font-family: 'Montserrat', 'Roboto', sans-serif !important;
}

/* EatHappyBasic font for headings and important elements only */
h1, h2, h3, h4, h5, h6 {
    font-family: 'EatHappyBasic', 'Montserrat', sans-serif !important;
}

.welcome-greeting {
    font-family: 'EatHappyBasic', 'Montserrat', sans-serif !important;
}

.mud-appbar .mud-typography {
    font-family: 'EatHappyBasic', 'Montserrat', sans-serif !important;
}

.app-logo-btn {
    font-family: 'EatHappyBasic', 'Montserrat', sans-serif !important;
}

.service-card-title {
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.apt-title {
    font-family: 'EatHappyBasic', 'Montserrat', sans-serif !important;
}

.deepl-card .card-title {
    font-family: 'EatHappyBasic', 'Montserrat', sans-serif !important;
    color: var(--text-secondary) !important;
}

/* Header Title Styling */
.mud-appbar .mud-typography {
    color: var(--primary) !important;
    font-weight: 600 !important;
    transition: color var(--transition);
}

/* Welcome Logo */
.welcome-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: var(--spacing-xl) 0;
}

.welcome-logo {
    height: 120px;
    width: auto;
    max-width: 300px;
    object-fit: contain;
    transition: all var(--transition);
    cursor: pointer;
}

.welcome-logo:hover {
    transform: scale(1.08);
}

/* Responsive Welcome Logo */
@media (max-width: 768px) {
    .welcome-logo {
        height: 100px;
        max-width: 250px;
    }
}

@media (max-width: 480px) {
    .welcome-logo {
        height: 80px;
        max-width: 200px;
    }
    .welcome-container {
        padding: 16px 8px;
        max-width: 100%;
    }
}

/* Action Button Icons */
.mud-icon-button {
    color: var(--primary) !important;
    transition: all var(--transition-fast);
}

.mud-icon-button:hover {
    color: var(--primary-hover) !important;
    background-color: rgba(var(--primary-rgb), 0.1) !important;
}

/* MudTooltip Fixes */
.mud-tooltip {
    max-width: 200px;
    word-wrap: break-word;
    z-index: 10000 !important;
}

.mud-tooltip-root {
    z-index: 10000 !important;
}

.mud-popover.mud-tooltip-root {
    pointer-events: none;
    z-index: 10000 !important;
}

.mud-popover:not(.mud-tooltip-root) {
    pointer-events: auto !important;
    z-index: 10500 !important;
}

.mud-popover-provider {
    position: fixed !important;
    overflow: visible !important;
    z-index: 10000 !important;
}

.mud-popover-open {
    z-index: 10000 !important;
}

/* MudMenu/Dropdown Fixes */
.mud-menu {
    z-index: 10500 !important;
}

.mud-menu-list {
    z-index: 10500 !important;
}

.mud-popover-menu {
    pointer-events: auto !important;
    z-index: 10500 !important;
}

/* Language Dropdown in Header */
.mud-appbar .mud-menu {
    z-index: 11000 !important;
    position: relative !important;
}

.mud-appbar .mud-menu-list {
    z-index: 11000 !important;
}

.mud-appbar .mud-button-root {
    z-index: 11000 !important;
    position: relative !important;
}

/* MudOverlay fixes - don't block dropdowns */
.mud-overlay {
    z-index: 9999 !important;
}

/* Ensure dropdown overlays are above everything */
.mud-menu .mud-overlay {
    z-index: 11001 !important;
}

.mud-popover-menu .mud-overlay {
    z-index: 11001 !important;
}

/* Language Dropdown Specific Fixes */
.language-dropdown {
    z-index: 12000 !important;
    position: relative !important;
}

.language-popover {
    z-index: 12001 !important;
}

.language-popover .mud-list {
    z-index: 12002 !important;
}

.language-popover .mud-overlay {
    z-index: 12003 !important;
}

/* Chat Input Tooltips - Extra spacing to avoid overlap */
.chat-tooltip .mud-tooltip {
    margin-bottom: 10px !important;
}

.chat-input-actions .mud-tooltip-root {
    z-index: 10001 !important;
}

/* Blazor Error Boundary */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 2s infinite;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Styles */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

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

/* DeepL-like Translation Workspace */
.translation-workspace {
    position: relative;
    min-height: calc(100vh - 64px);
    padding: 32px 24px 260px; /* more space to sticky bar + editor */
    background: var(--background);
}

.translation-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.translation-workspace .pane {
    border-radius: var(--border-radius-lg);
    background: var(--surface-light);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.translation-workspace .pane-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(var(--primary-rgb), 0.03);
    border-bottom: 1px solid var(--border-light);
}

.translation-workspace .pane-body {
    padding: 16px;
}

.translation-workspace .pane-text {
    width: 100%;
}

.translation-workspace .pane-empty {
    min-height: 420px;
    color: var(--text-secondary);
}

@media (max-width: 1024px) {
    .translation-panels {
        grid-template-columns: 1fr;
    }
}

/* DeepL-style layout */
.deepl-container {
  max-width: 1200px;
  margin: 16px auto;
  padding: 0 16px;
  padding-top: 8px; /* Small top padding to prevent navbar overlap */
}
.deepl-cards { display:flex; gap:12px; margin-bottom:16px; flex-wrap: wrap; }
.deepl-card { display:flex; align-items:center; gap:10px; padding:10px 14px; border:1px solid var(--border-light); border-radius:12px; cursor:pointer; background: var(--surface-light); transition: box-shadow var(--transition), border-color var(--transition); }
.deepl-card.active { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.deepl-card.disabled { opacity:.6; cursor: default; }
.deepl-card .card-icon .mud-icon-root { color: var(--primary); }
.deepl-card .card-title { font-weight:600; }
.deepl-card .card-sub { color: var(--text-secondary); font-size: .85rem; }

.deepl-shell { border-radius:16px; border:1px solid var(--border-light); background:#fff; overflow:hidden; }
.language-bar { display:flex; align-items:center; gap:8px; padding:8px 12px; border-bottom:1px solid var(--border-light); background: var(--surface-light); flex-wrap: wrap; }
.language-bar .lang-select { min-width: 200px; }
.language-bar .lang-swap { border:1px solid var(--border-light); }

.editor-grid {
  display:grid;
  grid-template-columns: 1fr 1fr;
  height: auto;
}
.editor-pane { padding:16px; }
.editor-pane.right { border-left:1px solid var(--border-light); background: var(--surface-light); }
.editor-text {
  width: 100% !important;
}
.editor-text .mud-input-slot,
.editor-text .mud-input-root,
.editor-text .mud-input,
.editor-text .mud-input-control,
.editor-text .mud-input-control-input-container {
  height: auto !important;
  width: 100% !important;
  max-width: none !important;
}
/* Native textarea styling to match MudTextField with underline only */
.native-textarea {
  width: 100%;
  min-height: 150px;
  height: 150px;
  max-height: 600px;
  resize: vertical;
  padding: 12px 0 15px 0;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0;
  background: transparent;
  color: inherit;
  outline: none;
  transition: border-bottom-color 0.15s ease-in-out;
  overflow-y: auto;
}

.native-textarea:hover {
  border-bottom-color: rgba(0, 0, 0, 0.42);
}

.native-textarea:focus {
  border-bottom-color: var(--mud-palette-primary);
  border-bottom-width: 2px;
  padding-bottom: 14px;
}

.native-textarea::placeholder {
  color: rgba(0, 0, 0, 0.42);
  opacity: 1;
}

.native-textarea[readonly] {
  background: transparent;
  cursor: default;
}

.native-textarea[readonly]:hover {
  border-bottom-color: rgba(0, 0, 0, 0.12);
}

/* Remove height restrictions from containers */
.resizable-textarea .mud-input-slot,
.resizable-textarea .mud-input-control,
.resizable-textarea .mud-input-control-input-container {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}
.editor-pane .mud-input-control {
  width: 100% !important;
}
.doc-drop { display:flex; flex-direction:column; align-items:flex-start; justify-content:flex-start; min-height: 150px; gap:8px; }

@media (max-width: 1024px) {
  .editor-grid {
    grid-template-columns: 1fr;
    height: auto;
  }
  .editor-pane.right { border-left:none; border-top:1px solid var(--border-light); }
}

/* Mobile tweaks for service cards - 2x2 Grid FULL WIDTH */
@media (max-width: 640px) {
    .service-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 100%;
        width: calc(100vw - 32px);
        gap: 12px;
        padding: 0 16px;
        margin: 0 auto;
    }
    .service-card {
        min-height: 150px;
        padding: 24px 20px;
        text-align: center;
        width: 100%;
    }
    .service-card-icon {
        font-size: 40px;
        margin-bottom: 12px;
    }
    .service-card-title {
        font-size: 15px;
        font-weight: 600;
        line-height: 1.3;
        word-break: break-word;
    }
}

/* Extra small mobile devices - still use full width */
@media (max-width: 480px) {
    .service-grid {
        max-width: 100%;
        width: calc(100vw - 24px);
        gap: 10px;
        padding: 0 12px;
    }
    .service-card {
        min-height: 140px;
        padding: 20px 16px;
    }
    .service-card-icon {
        font-size: 36px;
        margin-bottom: 10px;
    }
    .service-card-title {
        font-size: 14px;
        line-height: 1.2;
    }
}

/* Mobile optimizations for translation page */
@media (max-width: 640px) {
  /* Cards full width and compact */
  .deepl-cards {
    gap: 8px;
    margin-bottom: 12px;
  }

  .deepl-card {
    flex: 1 1 100%;
    padding: 8px 12px;
  }

  .deepl-card .card-title {
    font-size: 14px;
  }

  .deepl-card .card-sub {
    font-size: 12px;
  }

  /* Language bar optimizations */
  .language-bar {
    padding: 8px;
    gap: 4px;
    display: flex;
    flex-direction: column;
  }

  .language-bar .custom-select {
    flex: 1 1 100%;
    min-width: 100%;
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    height: 48px;
  }

  .language-bar .lang-swap {
    min-width: 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 4px auto;
  }

  .language-bar .mud-spacer {
    display: none;
  }

  .language-bar .mud-button-root {
    width: 100%;
    margin-top: 4px;
    height: 48px;
  }

  /* Editor panes mobile */
  .editor-pane {
    padding: 12px;
  }

  .editor-text textarea {
    font-size: 14px;
    line-height: 1.4;
    max-height: 400px !important;
  }

  /* Make translation windows smaller and more responsive on mobile */
  .editor-grid {
    height: auto;
  }

  .doc-drop {
    min-height: 180px;
    padding: 16px;
  }

  /* Container adjustments */
  .deepl-container {
    padding: 8px;
    margin-top: 0;
  }

  .deepl-shell {
    border-radius: 12px;
  }
}

/* Apartment UI */
.apt-container { max-width: 1200px; margin: 16px auto; padding: 0 16px; }
.apt-header { display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.apt-filters { display:flex; align-items:center; gap:12px; padding:12px; border:1px solid var(--border-light); border-radius:12px; background: var(--surface-light); margin-bottom:16px; }
.apt-grid { display:grid; grid-template-columns: repeat(3, 1fr); gap:16px; }
.apt-card { overflow:hidden; border-radius:12px; }
.apt-thumb { height:160px; background-size:cover; background-position:center; }
.apt-body { padding:12px; display:flex; flex-direction:column; gap:6px; }
.apt-title { font-weight:600; }
.apt-meta { color:var(--text-secondary); font-size:.9rem; }
.apt-price { font-weight:700; color: var(--text-primary); }
.apt-tags { display:flex; gap:6px; }

@media (max-width: 1024px) {
  .apt-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .apt-grid { grid-template-columns: 1fr; }
  .apt-filters { flex-wrap: wrap; }
  .apt-filters > * { flex: 1 1 160px; }
  .apt-filters .mud-spacer { display: none; }
}

/* Expanded text editor anchored above bottom bar */
.translation-text-editor {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 110px; /* above sticky bar */
    width: min(1100px, 94vw);
    background: var(--surface-light);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    padding: 12px;
    z-index: 90; /* below appbar popovers, above content */
}

.translation-textarea .mud-input-root {
    background: #fff;
}

@media (max-width: 767px) {
    .translation-text-editor {
        bottom: 140px;
        width: calc(100vw - 24px);
        padding: 8px;
    }
}

/* Voice button wrapper for push-to-talk */
.voice-button-wrapper {
    display: inline-block;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
