body {
    font-family: system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 12px;
    background: #f9fafb;
    min-height: 100vh;
}

/* Email verification message styles */
.verification-message {
    background: #ffffff;
    padding: 30px;
    margin: 20px auto;
    max-width: 500px;
    text-align: center;
}

.verification-title {
    background: #28a745;
    color: #ffffff;
    padding: 12px 20px;
    margin: -30px -30px 50px -30px;
    font-size: 18px;
    font-weight: 600;
}

.verification-content {
    text-align: left;
    color: #333;
    line-height: 1.6;
    margin-bottom: 50px;
}

.verification-content h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.verification-content ol {
    margin: 0;
    padding-left: 20px;
}

.verification-content li {
    margin-bottom: 8px;
    font-size: 14px;
}

.email-highlight {
    font-weight: 600;
    color: #007bff;
}

.verification-actions {
    text-align: center;
    margin-top: 25px;
}

.verification-actions .btn {
    background-color: #6c757d;
    color: #ffffff;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.verification-actions .btn:hover {
    background-color: #5a6268;
}

.container {
    max-width: min(900px, calc(100vw - 160px)); /* Max 900px, but always leave a gap on each side */
    margin: 0 auto; /* Center the container */
    background: white;
    border-radius: 0px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

/* First row: Title, companion text, and welcome */
.header-row-1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-row-1 h1 {
    margin: 0;
    color: #333;
    font-size: 1.8em;
    font-weight: 600;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.header-row-1 h1 img {
    display: block;
    height: auto;
}

.companion-text {
    margin: 0;
    color: #666;
    font-size: 14px;
    text-align: center;
    flex: 1;
}

.user-welcome {
    flex: 0 0 auto;
}

.user-welcome span {
    color: #333;
    font-size: 14px;
}

/* Second row: Navigation buttons */
.header-row-2 {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

.nav-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-left: auto;
}

.content {
    display: flex;
    padding: 0 20px 20px 20px;
    gap: 20px;
}

.left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.right-panel {
    flex: 1;
    border-radius: 0;
    min-height: 400px;
    padding: 24px 2px 2px 2px
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* Input text header with buttons */
.input-text-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.input-text-buttons {
    display: flex;
    gap: 8px;
}

.input-action-btn {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 0;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 28px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-action-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
}

.input-action-btn:active {
    background: #dee2e6;
    transform: translateY(1px);
}

/* Analysis toggle button states */
.analysis-toggle-btn.active {
    background: #ffc0cb;
    border-color: #ffb6c1;
    color: #333;
}

.analysis-toggle-btn.active:hover {
    background: #ffb6c1;
    border-color: #ffa0b4;
    color: #333;
}

/* Words Grabber button states */
.words-grabber-btn.active {
    background: #add8e6;
    border-color: #87ceeb;
    color: #333;
}

.words-grabber-btn.active:hover {
    background: #87ceeb;
    border-color: #6bb6d6;
    color: #333;
}

/* Text area analysis mode background */
.editable-text-area.analysis-mode-active {
    background-color: #fef7f7;
    transition: background-color 0.2s ease;
}

/* Text area words grabber mode background */
.editable-text-area.words-grabber-mode-active {
    background-color: #f0f8ff;
    transition: background-color 0.2s ease;
}

/* Words grabber translation spans styling */
.translation {
    background-color: #e6f3ff;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
    color: #1a5490;
}

/* Workspace session status button styles */
.workspace-session-status.session-active {
    background: #d4edda !important;
    border-color: #c3e6cb !important;
    color: #155724 !important;
}

.workspace-session-status.session-inactive {
    background: #f8d7da !important;
    border-color: #f5c6cb !important;
    color: #721c24 !important;
}

.workspace-session-status.session-checking {
    background: #fff3cd !important;
    border-color: #ffeaa7 !important;
    color: #856404 !important;
}

/* User Guide button - slightly yellow */
.user-guide-btn {
    background: #fff9e6 !important;
    border-color: #ffeaa7 !important;
    color: #856404 !important;
    text-decoration: none;
    box-sizing: border-box;
    padding: 4px 8px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    min-width: 28px !important;
    height: 24px !important;
    line-height: 1 !important;
}

.user-guide-btn:hover {
    background: #fffacd !important;
    border-color: #ffd700 !important;
    color: #856404 !important;
}

.user-guide-btn:active {
    background: #fff9e6 !important;
    transform: translateY(1px);
}

textarea {
    width: 100%;
    min-height: 195px;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 19px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    /* Remove grammar/spell check underlines */
    text-decoration: none !important;
    -webkit-text-decoration-line: none !important;
    text-decoration-line: none !important;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Editable text area styling */
.editable-text-area {
    width: 100%;
    min-height: 195px;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 0;
    font-size: 19px;
    font-family: inherit;
    box-sizing: border-box;
    background-color: #fff;
    color: #333;
    line-height: 1.4;
    transition: border-color 0.3s ease;
    text-decoration: none !important;
    -webkit-text-decoration-line: none !important;
    text-decoration-line: none !important;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.editable-text-area:focus {
    outline: none;
    border-color: #667eea;
}

/* Removed placeholder styling - no longer needed */

/* Word selection styling */
.word-selectable {
    cursor: pointer;
    padding: 1px 2px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
    display: inline-block;
    /* Ensure consistent font rendering */
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.word-selectable:hover {
    background-color: #f0f8ff;
}

.word-selected {
    background-color: #dbeafe !important; /* light blue color */
}

/* RTL language support */
.editable-text-area.rtl-input {
    direction: rtl;
    text-align: right;
    unicode-bidi: bidi-override;
}

/* Ensure RTL text flows correctly in word capture mode */
.editable-text-area.rtl-input .word-selectable {
    direction: rtl;
    unicode-bidi: normal;
}

/* RTL-specific cursor and caret positioning */
.editable-text-area.rtl-input:focus {
    caret-color: #667eea;
}

/* Removed placeholder and button styling - no longer needed */

.language-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 100%;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 0;
    border: 1px solid #e1e5e9;
    font-size: 13px;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
}

.checkbox-group.disabled {
    opacity: 0.5;
    pointer-events: none;
    background: #e9ecef;
}

.checkbox-group.disabled input[type="checkbox"] {
    cursor: not-allowed;
}

.target-languages-warning {
    margin-top: 10px;
    padding: 10px 14px;
    background-color: #d4edda;
    border: 1px solid #28a745;
    color: #155724;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    animation: fadeIn 0.3s ease-in;
}

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

.translate-btn {
    background: #4f46e5;
    color: white;
    border: 1px solid #4f46e5;
    padding: 8px 16px;
    border-radius: 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    white-space: nowrap;
    width: 120px;
    box-sizing: border-box;
}

.translate-btn:hover {
    background: #3730a3;
    border-color: #3730a3;
}

.translate-btn:disabled {
    background: #9ca3af;
    border-color: #9ca3af;
    cursor: not-allowed;
}

.listen-btn {
    background: #059669;
    color: white;
    border: 1px solid #059669;
    padding: 8px 16px;
    border-radius: 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0;
    transition: all 0.2s;
    text-align: center;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    white-space: nowrap;
    width: 120px;
    box-sizing: border-box;
}

.listen-btn:hover {
    background: #047857;
    border-color: #047857;
}

.listen-btn:disabled {
    background: #9ca3af;
    border-color: #9ca3af;
    cursor: not-allowed;
}

/* Pause and Stop Button Styles */
.pause-btn {
    background: #f59e0b;
    color: white;
    border: 1px solid #f59e0b;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0;
    transition: all 0.2s;
    text-align: center;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    white-space: nowrap;
}

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

.pause-btn:disabled {
    background: #9ca3af;
    border-color: #9ca3af;
    cursor: not-allowed;
}

.stop-btn {
    background: #dc2626;
    color: white;
    border: 1px solid #dc2626;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0;
    transition: all 0.2s;
    text-align: center;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    white-space: nowrap;
}

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

.stop-btn:disabled {
    background: #9ca3af;
    border-color: #9ca3af;
    cursor: not-allowed;
}

/* TTS Progress Indicator Styles */
.tts-progress-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
    padding: 10px;
    min-width: 200px;
}

.tts-progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.tts-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.tts-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.tts-progress-text {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

/* Restructured Controls Layout */
.listening-controls-row {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
    width: 100%;
    box-sizing: border-box;
}

.translation-controls-row {
    display: flex;
    justify-content: flex-start;
    margin: 10px 0;
    width: 100%;
    box-sizing: border-box;
}

/* Desktop layout for listening controls */
@media (min-width: 768px) {
    .listening-controls-row {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
    }

    .listening-controls-row .listen-btn,
    .listening-controls-row .pause-btn,
    .listening-controls-row .stop-btn {
        flex: 0 0 auto;
        width: 90px;
    }

    .listening-controls-row .speaking-rate-group {
        flex: 1;
        min-width: 180px;
        max-width: none;
        margin-left: auto;
    }

    .listening-controls-row .tts-progress-container {
        flex: 1;
        min-width: 200px;
        max-width: 300px;
    }
}

/* Desktop layout for listening controls */
@media (max-width: 767px) {
    .listening-controls-row {
        flex-direction: column;
        align-items: stretch;
    }

    .listening-controls-row .listen-btn,
    .listening-controls-row .pause-btn,
    .listening-controls-row .stop-btn {
        width: 100%;
    }

    .listening-controls-row .speaking-rate-group {
        width: 100%;
    }

    .listening-controls-row .tts-progress-container {
        width: 100%;
    }
}

/* Audio state button styles */
.listen-btn.playing {
    background: #dc2626;
    border-color: #dc2626;
}

.listen-btn.playing:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.listen-btn.paused {
    background: #f59e0b;
    border-color: #f59e0b;
}

.listen-btn.paused:hover {
    background: #d97706;
    border-color: #d97706;
}

.translations {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.translation-item {
    background: white;
    padding: 15px;
    border-radius: 0px;
    border-left: 0px solid #667eea;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
}

.translation-lang {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 5px;
}

.translation-text {
    color: #333;
    line-height: 1.5;
    font-size: 18px;
}

.translation-text.rtl-text {
    direction: rtl;
    text-align: right;
    unicode-bidi: bidi-override;
}

/* Turnaround buttons */
.turnaround-buttons {
    display: flex;
    gap: 4px;
    margin-top: 12px;
    justify-content: flex-end;
}

.turnaround-btn {
    background: #28a745;
    border: 1px solid #28a745;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 70px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.turnaround-btn:hover {
    background: #218838;
    border-color: #1e7e34;
    color: white;
}

.turnaround-btn:active {
    background: #1e7e34;
    transform: translateY(1px);
}

.turnaround-btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Translation TTS button - play/pause for translations */
.translation-tts-btn {
    background: #059669;
    border: 1px solid #059669;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 24px;
    width: 24px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.translation-tts-btn:hover {
    background: #047857;
    border-color: #047857;
    color: white;
}

.translation-tts-btn:active {
    background: #065f46;
    transform: translateY(1px);
}

.translation-tts-btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.translation-tts-btn.playing {
    background: #f59e0b;
    border-color: #f59e0b;
}

.translation-tts-btn.playing:hover {
    background: #d97706;
    border-color: #d97706;
}

.translation-tts-btn.paused {
    background: #f59e0b;
    border-color: #f59e0b;
    opacity: 0.8;
}

.translation-tts-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.loading {
    text-align: center;
    color: #666;
    font-style: italic;
}

.error {
    color: #dc3545;
    background: #f8d7da;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
}

.session-info {
    background: #e3f2fd;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #1976d2;
    width: 100%;
    box-sizing: border-box;
}

/* Audio Controls Styling */
.audio-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
}

.speaking-rate-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.speaking-rate-group label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.speaking-rate-select {
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 0;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
    width: 100%;
    min-width: 160px;
    box-sizing: border-box;
}

/* Source Language Select */
#sourceLanguage {
    border-radius: 0 !important;
    box-sizing: border-box;
}

.speaking-rate-select:focus {
    outline: none;
    border-color: #667eea;
}

.speaking-rate-select:hover {
    border-color: #b8c5f2;
}

/* Responsive layout for audio controls */
@media (min-width: 768px) {
    .audio-controls {
        flex-direction: row;
        align-items: flex-start;
        gap: 20px;
    }
    
    .listen-btn {
        margin-top: 0;
        flex-shrink: 0;
    }
    
    .speaking-rate-group {
        flex-shrink: 0;
    }
}

/* Controls Row Styling - constrained by textarea width */
.controls-row {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
    /* Match the textarea width exactly - same as input-group */
    width: 100%;
    box-sizing: border-box;
}

.controls-row .translate-btn {
    margin: 0;
}

/* User Guide Link below translation controls */
.user-guide-link-container {
    text-align: left;
    margin-top: 10px;
    padding: 8px 0;
}

.user-guide-link {
    color: #047857;
    background: #e5e7eb;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 4px;
    display: inline-block;
    transition: all 0.2s ease;
}

.user-guide-link:hover {
    color: #065f46;
    background: #d1d5db;
    text-decoration: none;
}

.controls-row .listen-btn {
    margin: 0;
}

.controls-row .speaking-rate-group {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}

/* Desktop layout - respect textarea width */
@media (min-width: 768px) {
    .controls-row {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        flex-wrap: nowrap; /* Don't wrap, constrain instead */
    }
    
    .controls-row .translate-btn {
        flex: 0 0 auto;
        width: 120px;
    }
    
    .controls-row .listen-btn {
        flex: 0 0 auto;
        width: 120px;
    }
    
    .controls-row .speaking-rate-group {
        flex: 1;
        min-width: 180px;
        max-width: none;
        margin-left: 15px;
        margin-right: 0;
    }
}

/* Desktop layout - stack vertically within textarea width */
@media (max-width: 767px) {
    .controls-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls-row .translate-btn,
    .controls-row .listen-btn {
        width: 100%;
    }
    
    .controls-row .speaking-rate-group {
        justify-content: center;
        margin-left: 0;
        max-width: 100%;
    }
}

/* Text highlighting and selection styles */
.highlighted-text {
    background-color: #fff3cd;
    border: 2px solid #ffeaa7;
    border-radius: 4px;
    padding: 2px 4px;
    position: relative;
}

/* Floating Analysis Panel */
.analysis-panel {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 2px solid #cb4270;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0;
    width: 240px;
    display: none;
}

.analysis-panel-header {
    background: #e13939;
    color: white;
    padding: 6px 10px;
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.analysis-panel-title {
    font-weight: 600;
    font-size: 12px;
}

.analysis-panel-close {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.analysis-panel-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.analysis-language-selector {
    padding: 8px 10px;
}

.analysis-language-selector label {
    font-size: 11px;
    margin-bottom: 4px;
    display: block;
}

.analysis-language-selector select {
    width: 100%;
    padding: 4px;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.analysis-buttons {
    padding: 8px 10px;
    display: flex;
    gap: 8px;
    justify-content: center;
}

.analysis-buttons .analyze-btn {
    padding: 6px 12px;
    font-size: 14px;
    min-width: 40px;
}

.model-name {
    padding: 0 10px 8px 10px;
    font-size: 10px;
    color: #666;
    text-align: center;
}


.analysis-language-selector label {
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

.analysis-language-selector select {
    padding: 6px 8px;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    font-size: 12px;
    background: white;
    cursor: pointer;
}

.analysis-language-selector select:focus {
    outline: none;
    border-color: #667eea;
}

.analysis-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
}

.analyze-btn {
    background: linear-gradient(135deg, #f10e23 0%, #b78293 100%);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.model-name {
    text-align: center;
    font-size: 8px;
    color: #666;
    margin-top: 2px;
    line-height: 1;
    font-weight: normal;
}

/* Docked Analysis Window */
.analysis-window {
    position: fixed;
    width: 650px;
    max-height: 813px;
    background: white;
    border: 2px solid #cb4270;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    overflow: hidden;
}

.analysis-header {
    background: linear-gradient(90deg, #c73333 0%, #c5758c 100%);
    color: white;
    padding: 2px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}

.analysis-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.analysis-window .close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.analysis-window .close-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    color: #f0f0f0;
}

.analysis-header .window-actions {
    display: flex;
    gap: 8px;
}

.minimize-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.minimize-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.analysis-content {
    padding: 20px;
    max-height: 650px;
    overflow-y: auto;
    font-size: 17px;
    line-height: 1.6;
}

.analysis-content .analysis h3 {
    color: #667eea;
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 16px;
}

.analysis-content .etymology-analysis h3 {
    color: #667eea;
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 16px;
}

.analysis-content .morphological-analysis h3 {
    color: #667eea;
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 16px;
}

.analysis-content .analysis h3:first-child {
    margin-top: 0;
}

.analysis-content .etymology-analysis h3:first-child {
    margin-top: 0;
}

.analysis-content .morphological-analysis h3:first-child {
    margin-top: 0;
}

/* Force consistent font sizes for all heading levels in analysis content */
.analysis-content h1,
.analysis-content h2 {
    color: #667eea;
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 16px;
}

.analysis-content h1:first-child,
.analysis-content h2:first-child {
    margin-top: 0;
}

.analysis-content .analysis p {
    color: #333;
    margin-bottom: 15px;
}

/* RTL support for analysis content */
.analysis-content.rtl-content {
    direction: rtl;
    text-align: right;
}

.analysis-content.rtl-content .analysis h3 {
    text-align: right;
}

.analysis-content.rtl-content .analysis p {
    text-align: right;
}

/* Responsive design for analysis window */
@media (max-width: 768px) {
    .analysis-window {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
        max-height: 60vh;
    }
}

/* Authentication Modal Styles */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.auth-modal-content {
    background: white;
    border-radius: 15px;
    padding: 40px;
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h2 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.8em;
    font-weight: 300;
}

.auth-header p {
    margin: 0;
    color: #666;
    font-size: 1em;
}

.auth-form {
    display: flex;
    flex-direction: column;
}

.auth-form h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.4em;
    font-weight: 400;
    text-align: center;
}

.auth-form .input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Add spacing above Altcha widget */
.auth-form .input-group:has(altcha-widget) {
    margin-top: 20px;
}

/* Increased spacing between form fields in login form */
/* Password field after username (h3 is 1st child, username input-group is 2nd, password input-group is 3rd) */
#loginForm .input-group:nth-child(3) {
    margin-top: 24px;
}

/* Increased spacing between form fields in registration form */
/* Email field after username (h3 is 1st child, username input-group is 2nd, email input-group is 3rd) */
#registerForm .input-group:nth-child(3) {
    margin-top: 24px;
}

/* Password field after email (password input-group is 4th child) */
#registerForm .input-group:nth-child(4) {
    margin-top: 24px;
}

/* Generate password link (6th), repeat password (7th), first name (8th), last name (9th) */
#registerForm .input-group:nth-child(6),
#registerForm .input-group:nth-child(7),
#registerForm .input-group:nth-child(8),
#registerForm .input-group:nth-child(9) {
    margin-top: 24px;
}

/* Password input with eye toggle */
.auth-form .password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-form .password-input-wrapper input {
    flex: 1;
    padding-right: 44px;
}

.auth-form .password-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: #6c757d;
    border-radius: 4px;
}

.auth-form .password-toggle-btn:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
}

.auth-form .generated-password-block {
    margin-top: 12px;
    padding: 12px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    font-size: 13px;
}

.auth-form .generated-password-label {
    display: block;
    margin-bottom: 6px;
    color: #333;
    font-weight: 500;
}

.auth-form .generated-password-value {
    display: block;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    font-family: monospace;
    font-size: 14px;
    word-break: break-all;
    margin-bottom: 10px;
}

.auth-form .generated-password-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.auth-form .generated-password-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
}

.auth-form .generated-password-btn.use-btn {
    background: #059669;
    color: white;
}

.auth-form .generated-password-btn.use-btn:hover {
    background: #047857;
}

.auth-form .generated-password-btn.dismiss-btn {
    background: #e5e7eb;
    color: #374151;
}

.auth-form .generated-password-btn.dismiss-btn:hover {
    background: #d1d5db;
}

.auth-form .generate-password-link {
    background: none;
    border: none;
    color: #667eea;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0;
    text-decoration: underline;
}

.auth-form .generate-password-link:hover {
    color: #5a67d8;
}

.auth-form .input-group label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.auth-form .input-group input,
.auth-form .input-group select {
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 16px;
    background: white;
    transition: border-color 0.3s ease;
}

.auth-form .input-group input:focus,
.auth-form .input-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Password requirements in auth forms */
.auth-form .password-requirements {
    font-size: 12px;
    margin-bottom: 12px;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.auth-form .password-requirements strong {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-size: 13px;
}

.auth-form .password-requirements ul {
    margin: 0;
    padding-left: 20px;
    list-style: none;
}

.auth-form .password-requirements li {
    margin: 4px 0;
    color: #6c757d;
    position: relative;
    padding-left: 20px;
    font-size: 12px;
}

.auth-form .password-requirements li:before {
    content: '•';
    position: absolute;
    left: 0;
    color: #6c757d;
}

.auth-form .password-requirements li.valid {
    color: #059669;
}

.auth-form .password-requirements li.valid:before {
    content: '✓';
    color: #059669;
    font-weight: bold;
}

.auth-form .password-requirements li.invalid {
    color: #dc2626;
}

.auth-form .password-requirements li.invalid:before {
    content: '✗';
    color: #dc2626;
    font-weight: bold;
}

.auth-btn {
    background: linear-gradient(135deg, #2c2c2c 0%, #000000 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 20px;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.auth-btn:active {
    transform: translateY(0);
}

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

/* Microsoft Login Button */
.ms-login-btn {
    background: #0078d4 !important;
    color: white !important;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
}

.ms-login-btn:hover {
    background: #106ebe !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 120, 212, 0.4);
}

/* Auth Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: #666;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ddd;
}

.auth-divider span {
    padding: 0 15px;
    font-size: 14px;
}

.auth-switch {
    text-align: center;
    margin-top: 15px;
    color: #666;
    font-size: 14px;
}

.auth-switch a {
    color: #000000 !important;
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    color: #000000 !important;
    text-decoration: underline;
}

.auth-switch a:visited {
    color: #000000 !important;
}

.auth-switch a:active {
    color: #000000 !important;
}

.forgot-password-link {
    font-size: 13px;
    margin-top: 8px;
    display: inline-block;
}

.form-description {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.attempts-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
    text-align: center;
}

.attempts-warning strong {
    display: block;
    margin-bottom: 4px;
}

.auth-message {
    margin-top: 20px;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    display: none;
}

.auth-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.auth-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* User Info Styles - moved to header styles above */

.logout-btn {
    background: #dc2626;
    color: white;
    border: 1px solid #dc2626;
    padding: 8px 16px;
    border-radius: 0;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    min-width: 80px;
    height: 32px;
    box-sizing: border-box;
}

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

/* Workspace Session Modal Styles */
.workspace-session-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.workspace-session-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
}

.workspace-session-modal-content {
    position: relative;
    background: white;
    border-radius: 15px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    z-index: 1002;
}

.workspace-session-header {
    text-align: center;
    margin-bottom: 30px;
}

.workspace-session-header h2 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.8em;
    font-weight: 400;
}

.workspace-session-subtitle {
    margin: 0;
    color: #666;
    font-size: 0.9em;
    line-height: 1.4;
}

.workspace-session-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.workspace-session-form .input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.workspace-session-form input[type="text"] {
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.workspace-session-form input[type="text"]:focus {
    outline: none;
    border-color: #4CAF50;
}

.workspace-session-actions {
    display: flex;
    justify-content: center;
}

.create-session-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.create-session-btn:hover {
    background: #45a049;
}

.create-session-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.workspace-session-message {
    text-align: center;
    padding: 10px;
    margin-top: 15px;
    border-radius: 6px;
    font-size: 14px;
}

.workspace-session-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.workspace-session-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Current Session Info Styles */
.current-session-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.session-info-item {
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.4;
}

.session-info-item strong {
    color: #333;
    font-weight: 600;
}

.session-info-item span {
    color: #666;
    margin-left: 8px;
}

.current-session-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.continue-session-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.continue-session-btn:hover {
    background: #45a049;
}

.start-new-session-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.start-new-session-btn:hover {
    background: #0056b3;
}

/* Settings Modal Styles */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 5vh; /* Position modal higher on window */
}

.settings-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 800px;
    height: 700px; /* Increased default height */
    min-height: 550px; /* Increased minimum to ensure save button + 10px margin is visible */
    max-height: 85vh; /* Reduced from 90vh to account for padding-top */
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}


.settings-header {
    background: #f8f9fa;
    color: #333;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid #eee;
}

.settings-header h2 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #e9ecef;
    color: #333;
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
    flex-shrink: 0; /* Prevent tabs from shrinking */
}

/* Scrollable tab content wrapper */
.settings-tab-content-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 30px;
}

/* Resize handle */
.settings-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(-45deg, transparent 40%, #ccc 40%, #ccc 45%, transparent 45%, transparent 55%, #ccc 55%, #ccc 60%, transparent 60%);
    z-index: 10;
    border-radius: 0 0 12px 0;
}

.settings-resize-handle:hover {
    background: linear-gradient(-45deg, transparent 40%, #4f46e5 40%, #4f46e5 45%, transparent 45%, transparent 55%, #4f46e5 55%, #4f46e5 60%, transparent 60%);
}

.tab-btn {
    background: none;
    border: none;
    padding: 15px 25px;
    cursor: pointer;
    font-size: 16px;
    color: #6c757d;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
    background: white;
}

.tab-btn:hover:not(.active) {
    color: #495057;
    background: #e9ecef;
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 30px;
    padding-bottom: 40px; /* Extra bottom padding to ensure button + 10px margin is visible */
}

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

/* Placeholders for dynamically loaded tabs - transparent to layout */
#balance-settings-placeholder,
#complaint-settings-placeholder {
    display: contents;
}

/* Ensure settings modal body handles scrolling */
.settings-modal-body {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0; /* Allow flexbox to shrink */
}

/* Language Sets Container */
.language-sets-container {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.language-set {
    flex: 1;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e1e5e9;
}

.language-set h3 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 1.2em;
}

.language-set p {
    margin: 0 0 15px 0;
    color: #6c757d;
    font-size: 14px;
}

/* Languages Grid */
.languages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 15px;
    background: white;
}

.language-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    font-size: 14px;
}

.language-option:hover {
    border-color: #4f46e5;
    background: #f8f9ff;
}

.language-option.selected {
    border-color: #4f46e5;
    background: #4f46e5;
    color: white;
}

.language-option input[type="checkbox"] {
    margin-right: 8px;
    accent-color: #4f46e5;
}

.language-option.selected input[type="checkbox"] {
    accent-color: white;
}

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

.language-code {
    font-size: 12px;
    opacity: 0.7;
    margin-left: auto;
}

/* Selected Languages Display */
.selected-languages {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 12px;
    min-height: 60px;
    font-size: 14px;
}

.selected-languages strong {
    color: #495057;
}

.selected-language-tag {
    display: inline-block;
    background: #4f46e5;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    margin: 2px;
    font-size: 12px;
}

/* Settings Actions */
.settings-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding-top: 20px;
    padding-bottom: 10px; /* Ensure 10px margin below button */
    margin-bottom: 0; /* No extra margin, padding handles spacing */
    border-top: 1px solid #e1e5e9;
}

.save-btn, .cancel-btn {
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 120px;
}

.save-btn {
    background: #4f46e5;
    color: white;
    border: 1px solid #4f46e5;
}

.save-btn:hover {
    background: #3730a3;
    border-color: #3730a3;
}

.save-btn:disabled {
    background: #9ca3af;
    border-color: #9ca3af;
    cursor: not-allowed;
}

.cancel-btn {
    background: #9ca3af;
    color: white;
    border: 1px solid #9ca3af;
}

.cancel-btn:hover {
    background: #6b7280;
    border-color: #6b7280;
}

/* Settings Button */
.settings-btn {
    background: #6366f1;
    color: white;
    border: 1px solid #6366f1;
    padding: 8px 12px;
    border-radius: 0;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    min-width: 80px;
    height: 32px;
    box-sizing: border-box;
}

.settings-btn:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}

.recap-btn {
    background: #059669;
    color: white;
    border: 1px solid #059669;
    padding: 8px 12px;
    border-radius: 0;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 80px;
    height: 32px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recap-btn:hover {
    background: #047857;
    border-color: #047857;
}

/* Settings Message */
.settings-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    display: none;
}

.settings-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.settings-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}


/* Password Settings Styles */
.password-settings-container {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e1e5e9;
    margin-bottom: 30px;
}

.password-setting h3 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 18px;
    font-weight: 600;
}

.password-setting > p {
    color: #6c757d;
    margin: 10px 0 20px 0;
    font-size: 14px;
}

.password-reset-info {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.password-reset-info .info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 15px;
}

.password-reset-info .info-item:last-child {
    margin-bottom: 0;
}

.password-reset-info .info-item svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.password-reset-info .info-item span {
    color: #495057;
    font-size: 14px;
    line-height: 1.5;
}

.password-reset-action {
    display: flex;
    justify-content: center;
    align-items: center;
}

.password-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.password-reset-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.password-reset-btn:active:not(:disabled) {
    transform: translateY(0);
}

.password-reset-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}

.password-reset-btn svg {
    width: 18px;
    height: 18px;
}

/* Desktop responsiveness for main layout */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        margin: 0;
        border-radius: 10px;
    }
    
    .header {
        padding: 16px;
        gap: 12px;
    }
    
    .header-row-1 {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .header-row-1 h1 {
        font-size: 1.5em;
    }
    
    .companion-text {
        font-size: 13px;
    }
    
    .user-welcome span {
        font-size: 14px;
    }
    
    .nav-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
    
    .content {
        flex-direction: column;
        padding: 16px;
        gap: 16px;
    }
    
    .left-panel, .right-panel {
        flex: none;
        width: 100%;
    }
    
    .right-panel {
        min-height: 300px;
        padding: 16px;
    }
    
    .language-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .checkbox-group {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .session-info {
        font-size: 13px;
        padding: 8px;
    }
    
    /* Button layout adjustments */
    .recap-btn, .settings-btn, .logout-btn {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 70px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .header {
        padding: 12px;
    }
    
    .header-row-1 h1 {
        font-size: 1.3em;
    }
    
    .content {
        padding: 12px;
    }
    
    .nav-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .language-options {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .checkbox-group {
        padding: 8px;
        font-size: 14px;
    }
    
    textarea {
        font-size: 16px;
        min-height: 120px;
    }
    
    .controls-row {
        gap: 10px;
    }
    
    .translate-btn, .listen-btn {
        padding: 12px;
        font-size: 13px;
    }
    
    .speaking-rate-select {
        font-size: 14px;
        padding: 8px;
    }
}

/* Responsive design for auth modal */
@media (max-width: 768px) {
    .auth-modal-content {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .auth-header h2 {
        font-size: 1.5em;
    }
    
    .auth-form h3 {
        font-size: 1.2em;
    }
    
    /* Responsive design for settings modal */
    .language-sets-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .languages-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .settings-modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .settings-actions {
        flex-direction: column;
        align-items: center;
    }
}

/* Selected Texts Popup Styles */
.selected-texts-popup {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 400px;
    max-width: calc(35vw - 40px); /* Same width restriction as Stories Playground */
    max-height: 70vh;
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
    transition: all 0.3s ease;
    font-family: system-ui, -apple-system, sans-serif;
}

.selected-texts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
    position: relative;
    cursor: move;
}

.selected-texts-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.popup-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.reload-popup-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #666;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reload-popup-btn:hover {
    background: #e9ecef;
    color: #333;
}

.reload-popup-btn:active {
    transform: rotate(45deg);
}

.close-popup-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-popup-btn:hover {
    background: #e9ecef;
    color: #333;
}

.selected-texts-content {
    max-height: 400px;
    overflow-y: auto;
}

.selected-texts-loading {
    padding: 40px 20px;
    text-align: center;
    color: #666;
}

.selected-texts-loading .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

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

.selected-texts-list {
    padding: 0;
}

.selected-text-item {
    border-bottom: 1px solid #e1e5e9;
    padding: 0;
}

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

.selected-text-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 14px;
    line-height: 1.4;
}

.selected-text-title:hover {
    background: #f8f9fa;
}

.selected-text-content {
    padding: 0 20px 14px;
    font-size: 13px;
    line-height: 1.5;
    color: #555;
    display: none;
}

.selected-text-buttons {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.selected-text-use-btn {
    background: #4f46e5;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 0px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.selected-text-use-btn:hover {
    background: #3730a3;
}

.selected-text-append-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 0px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.selected-text-append-btn:hover {
    background: #059669;
}

.selected-text-item.selected-text-highlighted {
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
}

.selected-texts-empty {
    padding: 40px 20px;
    text-align: center;
    color: #666;
}

.selected-texts-empty .empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.selected-texts-empty p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.4;
}

/* Minimize button styles */
.minimize-popup-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.minimize-popup-btn:hover {
    background: #e9ecef;
    color: #333;
}

/* Delete button container styles */
.delete-button-container {
    padding: 8px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
}

.delete-buttons-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.delete-selected-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 0px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.delete-selected-btn:hover {
    background: #c82333;
}

.delete-selected-btn:active {
    background: #bd2130;
}

.delete-selected-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.delete-all-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 0px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.delete-all-btn:hover {
    background: #c82333;
}

.delete-all-btn:active {
    background: #bd2130;
}

.delete-all-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Navigation buttons group */
.navigation-buttons-group {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.nav-text-btn {
    background: #6366f1;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 0px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.nav-text-btn:hover {
    background: #4f46e5;
}

.nav-text-btn:active {
    background: #3730a3;
}

.nav-text-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Checkbox styles for selected texts */
.selected-text-checkbox {
    margin-right: 12px;
    transform: scale(1.1);
}

/* Minimized popup styles */
.selected-texts-popup.minimized {
    max-height: 60px;
    overflow: hidden;
}

.selected-texts-popup.minimized .selected-texts-content,
.selected-texts-popup.minimized .delete-button-container {
    display: none !important;
}

.selected-texts-popup.minimized .selected-texts-header {
    border-bottom: none;
}

.selected-texts-popup.minimized .minimize-popup-btn {
    font-size: 16px;
}

/* Stories Playground Toggle Button */
.stories-playground-toggle-btn {
  position: fixed;
  top: calc(50% - 35px); /* Shifted up to make room for W button below */
  left: 10px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  z-index: 999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stories-playground-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(16, 185, 129, 0.4);
}

.stories-playground-toggle-btn:active {
  transform: translateY(0);
}

/* Saved Texts Toggle Button */
.saved-texts-toggle-btn {
  position: fixed;
  top: calc(50% + 35px); /* 20px gap + 50px P button height + 20px = 70px below center, adjusted to 35px */
  left: 10px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  z-index: 999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.saved-texts-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(16, 185, 129, 0.4);
}

.saved-texts-toggle-btn:active {
  transform: translateY(0);
}

/* Current Worksession Toggle Button (right side) */
.current-worksession-toggle-btn {
  position: fixed;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  z-index: 999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.current-worksession-toggle-btn:hover {
  transform: translateY(calc(-50% - 2px));
  box-shadow: 0 6px 12px rgba(16, 185, 129, 0.4);
}

.current-worksession-toggle-btn:active {
  transform: translateY(-50%);
}

/* Stories Playground Popup Styles */
.stories-playground-popup {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 400px;
  max-width: calc(35vw - 40px); /* Ensure it doesn't exceed ~35% of viewport width */
  max-height: 70vh;
  background: white;
  border: 2px solid #e1e5e9;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  overflow: hidden;
  transition: all 0.3s ease;
}

.stories-playground-popup.minimized {
  height: 50px;
  overflow: hidden;
}

.stories-playground-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e1e5e9;
  cursor: move;
}

.stories-playground-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.stories-playground-content {
  max-height: calc(70vh - 70px);
  overflow-y: auto;
  padding: 0;
}

.stories-playground-loading {
  padding: 40px 20px;
  text-align: center;
  color: #666;
}

.stories-playground-empty {
  padding: 40px 20px;
  text-align: center;
  color: #666;
}

.stories-playground-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.stories-playground-list {
  padding: 0;
}

.story-playground-item {
  border-bottom: 1px solid #f0f0f0;
  padding: 0;
  margin: 0;
}

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

.story-playground-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #f8f9fa;
  cursor: pointer;
  transition: background-color 0.2s;
}

.story-playground-title:hover {
  background: #e9ecef;
}

.story-playground-title-text {
  flex: 1;
  font-weight: 600;
  color: #333;
  margin-right: 12px;
}

.story-playground-use-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.story-playground-use-btn:hover {
  background: #5a67d8;
}

.story-playground-title-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.story-playground-delete-story-btn {
  background: #dc2626;
  color: white;
  border: none;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.story-playground-delete-story-btn:hover {
  background: #b91c1c;
}

.story-playground-sentences {
  display: none;
  padding: 0;
  background: white;
}

.story-playground-sentence {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid #f5f5f5;
  background: #fafbfc;
  transition: background-color 0.2s;
  cursor: pointer;
}

.story-playground-sentence:hover {
  background: #f0f2f5;
}

.story-playground-sentence:last-child {
  border-bottom: none;
}

.story-playground-sentence .sentence-delete-checkbox {
  margin-right: 12px;
}

.story-playground-actions {
  padding: 8px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #e1e5e9;
}

.story-playground-actions .story-playground-delete-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}

.story-playground-actions .story-playground-delete-btn:hover {
  background: #c82333;
}

.story-playground-sentence-number {
  display: inline-block;
  min-width: 24px;
  font-weight: 600;
  color: #667eea;
  margin-right: 8px;
}

.story-playground-sentence-text {
  color: #333;
  line-height: 1.4;
}

.sentence-delete-checkbox {
  margin: 0;
  flex-shrink: 0;
}

.story-playground-sentence-use-btn {
  background: #059669;
  color: white;
  border: 1px solid #059669;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
  margin-left: auto;
  flex-shrink: 0;
}

.story-playground-sentence-use-btn:hover {
  background: #047857;
  border-color: #047857;
}

.story-playground-delete-btn {
  background: #dc2626;
  color: white;
  border: 1px solid #dc2626;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-top: 8px;
  width: 100%;
}

.story-playground-delete-btn:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* Desktop responsiveness */
@media (max-width: 768px) {
  .stories-playground-popup {
    width: 300px;
    max-width: calc(40vw - 20px); /* Allow a bit more space on tablets */
    top: 10px;
    left: 10px;
  }

  .selected-texts-popup {
    width: 300px;
    max-width: calc(40vw - 20px);
    bottom: 10px;
    left: 10px;
  }

  .stories-playground-toggle-btn {
    width: 45px;
    height: 45px;
    font-size: 18px;
    left: 8px;
    top: calc(50% - 32.5px); /* Adjusted for smaller button */
  }

  .saved-texts-toggle-btn {
    width: 45px;
    height: 45px;
    font-size: 18px;
    left: 8px;
    top: calc(50% + 32.5px); /* Adjusted for smaller button */
  }

  .current-worksession-toggle-btn {
    width: 45px;
    height: 45px;
    font-size: 18px;
    right: 8px;
  }
}

@media (max-width: 480px) {
  .stories-playground-popup {
    width: calc(100vw - 40px); /* Full width on mobile */
    max-width: calc(100vw - 40px);
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .selected-texts-popup {
    width: calc(100vw - 40px);
    max-width: calc(100vw - 40px);
    bottom: 10px;
    left: 10px;
    right: 10px;
  }

  .stories-playground-toggle-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
    left: 5px;
    top: calc(50% - 30px); /* Adjusted for smaller button */
  }

  .saved-texts-toggle-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
    left: 5px;
    top: calc(50% + 30px); /* Adjusted for smaller button */
  }

  .current-worksession-toggle-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
    right: 5px;
  }
}

/* Shakti Notification Popup Styles */
.shakti-notification-popup {
  position: fixed;
  top: 20px;
  right: 20px;
  min-width: 300px;
  max-width: 500px;
  background: white;
  border: 2px solid #059669;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  transform: translateX(100%);
  transition: all 0.3s ease;
  overflow: hidden;
}

.shakti-notification-popup.show {
  transform: translateX(0);
}

.shakti-notification-popup.success {
  border-color: #059669;
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
}

.shakti-notification-popup.error {
  border-color: #dc2626;
  background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
}

.shakti-notification-popup.warning {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}

.shakti-notification-popup.info {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
}

.shakti-notification-content {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  gap: 12px;
}

.shakti-notification-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.shakti-notification-popup.success .shakti-notification-icon {
  color: #059669;
}

.shakti-notification-popup.error .shakti-notification-icon {
  color: #dc2626;
}

.shakti-notification-popup.warning .shakti-notification-icon {
  color: #f59e0b;
}

.shakti-notification-popup.info .shakti-notification-icon {
  color: #3b82f6;
}

.shakti-notification-text {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .shakti-notification-popup {
    left: 10px;
    right: 10px;
    min-width: auto;
    max-width: none;
  }

  .stories-playground-popup {
    right: 10px;
    max-height: 80vh;
  }

  .stories-playground-content {
    max-height: calc(80vh - 70px);
  }
}

/* Centered Notification Animations */
@keyframes slideInCenter {
  from {
    opacity: 0;
    transform: translate(-50%, -60%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes slideOutCenter {
  from {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -40%);
  }
}

.centered-notification {
  /* Base styles - these should override any JavaScript inline styles */
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  padding: 15px 25px !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  z-index: 10001 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  max-width: 400px !important;
  text-align: center !important;
  animation: slideInCenter 0.3s ease-out !important;
  border: 2px solid !important;
  background-color: #d4edda !important; /* Default success color */
  color: #155724 !important; /* Default success text color */
  border-color: #c3e6cb !important; /* Default success border color */
} 
