/* ========== Base Styles ========== */
:root {
    --primary-color: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-light: #94a3b8;
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: rgba(0, 0, 0, 0.05);
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #3b82f6;
    --border-radius: 12px;
    --transition-speed: 0.3s;
}

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

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-primary);
    background: linear-gradient(135deg, #e0f2fe, #ede9fe);
    min-height: 100vh;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
}

button {
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
}

input, button, textarea {
    font-family: inherit;
    outline: none;
}

a {
    text-decoration: none;
    color: inherit;
}

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

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px var(--glass-shadow);
    border-radius: var(--border-radius);
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px var(--glass-shadow);
    border-radius: var(--border-radius);
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    transition: background-color var(--transition-speed);
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 10px 16px;
    font-weight: 500;
    transition: background-color var(--transition-speed);
}

.btn-secondary:hover {
    background: var(--bg-primary);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

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

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.input-group input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.input-group input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.search-bar {
    position: relative;
    width: 250px;
    flex-shrink: 0;
}

.search-bar i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    z-index: 1;
}

.search-bar input {
    width: 100%;
    padding: 8px 8px 8px 36px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    font-size: 14px;
    transition: all var(--transition-speed);
}

.search-bar input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background: rgba(255, 255, 255, 0.8);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    color: var(--text-light);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.7;
}

/* ========== App Container ========== */
.app-container {
    max-width: 1440px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 20px;
}

/* ========== Authentication ========== */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 40px);
}

.auth-container .glass-card {
    width: 100%;
    max-width: 420px;
    padding: 30px;
    animation: fadeIn 0.5s ease;
}

.logo-container {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.logo i {
    font-size: 28px;
}

.logo-container h2 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
}

.tabs {
    display: flex;
    position: relative;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    position: relative;
    transition: color var(--transition-speed);
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 50%;
    background-color: var(--primary-color);
    border-radius: 3px 3px 0 0;
    transition: transform var(--transition-speed);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

/* ========== Main App Layout ========== */
.main-app {
    display: flex;
    height: calc(100vh - 40px);
    overflow: hidden;
    animation: fadeIn 0.5s ease;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--glass-border);
    box-shadow: 2px 0 10px var(--glass-shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    z-index: 10;
    border-radius: var(--border-radius);
}

.sidebar .logo-container {
    margin-bottom: 40px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.nav-item:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

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

.user-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.user-details {
    line-height: 1.2;
}

.username {
    font-weight: 600;
    font-size: 14px;
}

.user-details small {
    color: var(--text-light);
    font-size: 12px;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow: hidden;
    padding: 0 20px;
}

.content-view {
    display: none;
    height: 100%;
    flex-direction: column;
}

.content-view.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.content-header {
    padding: 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.content-header h1 {
    font-size: 24px;
}

.content-body {
    flex: 1;
    overflow: auto;
    padding-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.content-body .glass-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: auto;
    min-height: 0;
}

/* ========== Documents View ========== */
.panel-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
    gap: 16px;
    flex-wrap: wrap;
}

.panel-header h3 {
    margin: 0;
    flex-shrink: 0;
}

.documents-grid {
    padding: 20px;
    padding-bottom: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 380px));
    gap: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 300px;
    max-height: 100%;
    align-content: start;
    justify-content: start;
}

.document-card {
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--border-radius);
    padding: 16px;
    display: flex;
    position: relative;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    width: 100%;
}

.document-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.document-icon {
    width: 48px;
    height: 48px;
    background: rgba(79, 70, 229, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    color: var(--primary-color);
}

.document-info {
    flex: 1;
    overflow: hidden;
}

.document-name {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.document-date {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.document-stats {
    font-size: 12px;
    color: var(--text-secondary);
}

.document-actions {
    display: flex;
    gap: 8px;
    position: absolute;
    top: 12px;
    right: 12px;
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.document-card:hover .document-actions {
    opacity: 1;
}

.doc-action {
    width: 28px;
    height: 28px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: color var(--transition-speed), transform var(--transition-speed);
}

.doc-action:hover {
    background: white;
    color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.delete-doc:hover {
    color: var(--danger);
}

/* ========== Chat View ========== */
.chat-layout {
    overflow: hidden;
}

.chat-panel {
    overflow: hidden;
}

/* New Chat Button */
.chat-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.new-chat-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 16px;
    color: white;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-speed);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
}

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

/* Chat Controls */
.chat-controls {
    border-top: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
}

.chat-options {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

/* Document Selector */
.document-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.document-selector label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.glass-select {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-primary);
    min-width: 140px;
    transition: all var(--transition-speed);
}

.glass-select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background: rgba(255, 255, 255, 0.9);
}

/* Chat Features */
.chat-features {
    display: flex;
    gap: 8px;
    align-items: center;
}

.feature-toggle {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
    position: relative;
    cursor: pointer;
}

.feature-toggle:hover {
    background: rgba(255, 255, 255, 0.8);
    color: var(--primary-color);
    transform: scale(1.05);
}

.feature-toggle.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

/* Language Switcher Button */
.language-switcher-btn {
    width: auto;
    padding: 0 8px;
    border-radius: 18px;
    gap: 4px;
}

.current-lang {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: rgba(248, 250, 252, 0.7);
}

.chat-welcome {
    display: flex;
    align-items: flex-start;
    margin-bottom: 30px;
}

.assistant-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 16px;
    flex-shrink: 0;
}

.welcome-message h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.example-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.example-question {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    color: var(--primary-color);
    transition: background-color var(--transition-speed);
}

.example-question:hover {
    background: white;
}

.chat-message {
    margin-bottom: 20px;
    opacity: 0;
    animation: fadeInUp 0.3s forwards;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.user-message {
    padding-left: 56px;
}

.assistant-message {
    display: flex;
    align-items: flex-start;
}

.message-bubble {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 0 var(--border-radius) var(--border-radius) var(--border-radius);
    padding: 16px 20px;
    margin-right: 56px;
    position: relative;
    max-width: 90%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.user-message .message-content {
    background: var(--primary-color);
    color: white;
    padding: 12px 16px;
    border-radius: var(--border-radius) 0 var(--border-radius) var(--border-radius);
    margin-left: auto;
    max-width: 80%;
    text-align: right;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-time {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 6px;
    text-align: right;
    opacity: 0.7;
}

.assistant-message .message-time {
    text-align: left;
}

.chat-input {
    padding: 16px;
    border-top: 1px solid var(--glass-border);
}

.chat-input form {
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    font-size: 14px;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.chat-input input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
}

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

/* ========== History View ========== */
.history-list {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    max-height: calc(100% - 70px);
}

.history-item {
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--border-radius);
    padding: 16px;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.history-question {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
}

.history-question i {
    color: var(--primary-color);
    margin-right: 12px;
    font-size: 18px;
}

.history-question p {
    font-weight: 500;
}

.history-answer {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-left: 30px;
}

.history-answer i {
    color: var(--text-secondary);
    margin-right: 12px;
}

.answer-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.history-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--glass-border);
    font-size: 12px;
    color: var(--text-light);
}

.history-sources {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ========== Modal ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed), visibility var(--transition-speed);
}

/* Language Modal */
.language-modal {
    max-width: 400px;
    width: 90%;
}

.language-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.language-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed);
    text-align: left;
    width: 100%;
}

.language-option:hover {
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.language-option.active {
    background: rgba(79, 70, 229, 0.1);
    border-color: var(--primary-color);
}

.lang-flag {
    font-size: 32px;
    line-height: 1;
}

.lang-info {
    flex: 1;
}

.lang-info h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.lang-info p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

.lang-check {
    color: var(--primary-color);
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.language-option.active .lang-check {
    opacity: 1;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: zoomIn 0.3s ease;
}

.modal-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
}

.close-modal {
    background: transparent;
    border: none;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-speed);
}

.close-modal:hover {
    color: var(--danger);
}

.modal-body {
    padding: 20px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.drop-area {
    border: 2px dashed var(--glass-border);
    border-radius: var(--border-radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-speed), background-color var(--transition-speed);
}

.drop-area i {
    font-size: 40px;
    color: var(--primary-light);
    margin-bottom: 16px;
}

.drop-area p {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.file-info {
    color: var(--text-light);
    font-size: 12px;
}

.drop-area:hover, .drop-area.active {
    border-color: var(--primary-light);
    background: rgba(99, 102, 241, 0.05);
}

.selected-file {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-progress {
    margin-top: 20px;
    transition: all 0.3s ease-in-out;
}

.upload-progress.hidden {
    opacity: 0;
    transform: translateY(-10px);
}

.progress-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(90deg, #4CAF50, #45a049);
    height: 100%;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

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

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

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

.progress-fill.progress-active {
    animation: progressPulse 1.5s ease-in-out infinite;
}

.progress-text {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-top: 8px;
    text-align: center;
}

/* ========== Notifications ========== */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
    width: auto;
    min-width: 280px;
}

.toast {
    margin-bottom: 12px;
    padding: 14px 16px;
    border-radius: var(--border-radius);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 4.7s forwards;
    opacity: 0;
    max-width: 400px;
    width: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.toast.show {
    opacity: 1;
}

.toast-icon {
    margin-right: 12px;
    font-size: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.toast-message {
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    margin: 0;
    text-overflow: ellipsis;
    max-width: 100%;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-speed);
    flex-shrink: 0;
    margin-left: 8px;
    margin-top: 2px;
    padding: 4px;
    border-radius: 4px;
}

.toast-close:hover {
    color: var(--danger);
    background: rgba(255, 255, 255, 0.1);
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error .toast-icon {
    color: var(--danger);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast.info .toast-icon {
    color: var(--info);
}

/* ========== Enhanced Message Content - COMPLETELY REWRITTEN ========== */

/* Legal Document Structure */
.message-content {
    line-height: 1.5;
    color: var(--text-primary);
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    min-width: 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.legal-paragraph:last-child {
    margin-bottom: 0;
}

/* Legal Headers - Clean & Minimal */
.legal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--primary-color);
    margin: 14px 0 10px 0;
    border-bottom: 1px solid rgba(79, 70, 229, 0.2);
    padding-bottom: 4px;
}

.legal-header {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-color);

    border-left: 3px solid var(--primary-color);
    padding-left: 12px;
    background: rgba(79, 70, 229, 0.05);
    padding: 8px 12px;
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
}

.legal-subheader {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    padding-left: 16px;
    position: relative;
}

.legal-subheader::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}

/* Text Emphasis - Minimal */
.legal-emphasis {
    font-weight: 600;
    color: var(--primary-dark);
    background: rgba(79, 70, 229, 0.08);
    padding: 2px 4px;
    border-radius: 3px;
}

/* Legal Lists - FIXED */
.legal-list,
.legal-numbered-list {
    padding-left: 0;
    list-style: none;
}

.legal-numbered-list {
    counter-reset: legal-counter;
    padding-left: 0;
}

.legal-point {
    position: relative;
    padding-left: 20px;
    line-height: 1.6;
    list-style: none;
    display: block;
}

.legal-numbered {
    position: relative;
    margin-bottom: 8px;
    padding-left: 25px;
    line-height: 1.6;
    list-style: none;
    display: block;
    counter-increment: legal-counter;
}

/* Custom bullet for legal points - FIXED */
.legal-point::before {
    content: "•";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 16px;
    line-height: 1.6;
}

/* Custom numbering for legal numbered items - FIXED */
.legal-numbered::before {
    content: counter(legal-counter) ".";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--primary-color);
    font-weight: bold;
    line-height: 1.6;
}

/* Remove any conflicting list styles */
.message-content ul,
.message-content ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

.message-content ul.legal-list,
.message-content ol.legal-numbered-list {
    padding-left: 0;
}

/* Document References - Enhanced */
.document-reference {
    background: rgba(245, 158, 11, 0.12);
    color: var(--text-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    border-left: 2px solid #f59e0b;
}

/* ========== ENHANCED LEGAL TERM HIGHLIGHTING ========== */

/* Base legal term styling */
.legal-term {
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.legal-term:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Critical legal terms (red) */
.legal-term-critical {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
    border-bottom: 1px solid rgba(239, 68, 68, 0.3);
}

/* Important legal terms (orange) */
.legal-term-important {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
}

/* Standard legal terms (blue) */
.legal-term-standard {
    background: rgba(79, 70, 229, 0.12);
    color: var(--primary-dark);
    border-bottom: 1px solid rgba(79, 70, 229, 0.3);
}

/* Financial terms (green) */
.legal-term-financial {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    border-bottom: 1px solid rgba(16, 185, 129, 0.3);
}

/* Temporal terms (purple) */
.legal-term-temporal {
    background: rgba(139, 92, 246, 0.15);
    color: #7c3aed;
    border-bottom: 1px solid rgba(139, 92, 246, 0.3);
}

/* ========== SPECIAL CONTENT HIGHLIGHTING ========== */

/* Monetary amounts */
.legal-amount {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* Percentages */
.legal-percentage {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* Dates */
.legal-date {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
    font-family: 'Courier New', monospace;
}

/* Legal citations and references */
.legal-citation {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
    font-family: 'Courier New', monospace;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Contact information */
.legal-contact {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
    font-family: 'Courier New', monospace;
}

/* Sources - Enhanced */
.sources-simple {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--border-radius);
    font-size: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Confidence - Enhanced */
.confidence-simple {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--border-radius);
    font-size: 12px;
    text-align: center;
}

/* Processing Time - Enhanced */
.message-processing-time {
    margin-top: 10px;
    padding: 6px 10px;
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Clean up empty elements */
.message-content p:empty,
.message-content div:empty,
.message-content span:empty {
    display: none;
}

/* Ensure proper spacing between elements */
.message-content > *:first-child {
    margin-top: 0;
}

.message-content > *:last-child {
    margin-bottom: 0;
}

/* Special styling for key sections */
.legal-header:contains("Quick Answer") {
    background: rgba(16, 185, 129, 0.1);
    border-left-color: #10b981;
    color: #10b981;
}

.legal-header:contains("Recommendations") {
    background: rgba(99, 102, 241, 0.1);
    border-left-color: #6366f1;
    color: #6366f1;
}

/* ========== Typing Indicator ========== */
.typing-animation {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

.typing-text {
    color: #666;
    font-size: 0.9em;
    margin-top: 4px;
}

.typing-steps {
    margin-top: 8px;
    font-size: 11px;
}

.typing-steps .step {
    color: var(--text-light);
    margin-bottom: 2px;
    opacity: 0.6;
    animation: fadeInOut 1.5s infinite;
}

.typing-steps .step:nth-child(2) {
    animation-delay: 0.5s;
}

.typing-steps .step:nth-child(3) {
    animation-delay: 1s;
}

.typing-steps .step:nth-child(4) {
    animation-delay: 1.5s;
}

/* ========== Animations ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes zoomIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

@keyframes typingAnimation {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

@keyframes fadeInOut {
    0%, 100% { 
        opacity: 0.3; 
    }
    50% { 
        opacity: 1; 
    }
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .main-app {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-radius: var(--border-radius) var(--border-radius) 0 0;
        padding: 16px;
    }
    
    .nav-menu {
        flex-direction: row;
        justify-content: space-around;
        margin-bottom: 16px;
    }
    
    .nav-item span {
        display: none;
    }
    
    .user-section {
        display: none;
    }
    
    /* Mobile Chat Header */
    .content-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .chat-header-actions {
        justify-content: center;
    }
    
    .new-chat-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Mobile Chat Controls */
    .chat-options {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .document-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    
    .glass-select {
        width: 100%;
        min-width: auto;
    }
    
    .chat-features {
        justify-content: center;
        gap: 16px;
    }
    
    .feature-toggle {
        width: 44px;
        height: 44px;
    }
    
    .language-switcher-btn {
        padding: 0 12px;
    }
    
    /* Mobile Document Grid */
    .documents-grid {
        grid-template-columns: 1fr;
        padding: 16px;
    }
    
    .panel-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
        padding: 16px;
    }
    
    .search-bar {
        width: 100%;
    }
    
    .search-bar input:focus {
        width: 100%;
    }
    
    /* Mobile Chat Messages */
    .chat-messages {
        padding: 16px;
    }
    
    .chat-welcome {
        flex-direction: column;
        text-align: center;
    }
    
    .assistant-avatar {
        align-self: center;
        margin-right: 0;
        margin-bottom: 12px;
    }
    
    .example-questions {
        justify-content: center;
    }
    
    .example-question {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .user-message {
        padding-left: 0;
    }
    
    .user-message .message-content {
        max-width: 90%;
        margin-left: 10%;
    }
    
    .message-bubble {
        max-width: 90%;
        padding: 12px 16px;
        margin-right: 10%;
    }
    
    .assistant-message .assistant-avatar {
        width: 32px;
        height: 32px;
        margin-right: 12px;
    }
    
    /* Mobile Legal Content */
    .legal-title {
        font-size: 16px;
    }
    
    .legal-header {
        font-size: 14px;
        padding: 6px 10px;
    }
    
    .legal-subheader {
        font-size: 13px;
    }
    
    .legal-point,
    .legal-numbered {
        padding-left: 16px;
        font-size: 13px;
    }
    
    /* Mobile Typing Indicator */
    .typing-steps {
        display: none; /* Hide detailed steps on mobile */
    }
    
    .typing-text {
        font-size: 12px;
    }
    
    /* Mobile Language Modal */
    .language-modal {
        width: 95%;
        margin: 20px;
    }
    
    .language-option {
        padding: 12px;
        gap: 12px;
    }
    
    .lang-flag {
        font-size: 24px;
    }
    
    .lang-info h4 {
        font-size: 14px;
    }
    
    .lang-info p {
        font-size: 11px;
    }
    
    /* Mobile Chat Input */
    .chat-input {
        padding: 12px;
    }
    
    .chat-input input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px 16px;
    }
    
    .btn-send {
        width: 44px;
        height: 44px;
    }
    
    /* Mobile History */
    .history-list {
        padding: 16px;
    }
    
    .history-item {
        padding: 12px;
    }
    
    .history-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .app-container {
        padding: 10px;
    }
    
    .auth-container .glass-card {
        padding: 20px;
    }
    
    .main-app {
        height: calc(100vh - 20px);
    }
    
    .sidebar {
        padding: 12px;
    }
    
    .content-header h1 {
        font-size: 20px;
    }
    
    .new-chat-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .chat-options {
        padding: 10px 12px;
    }
    
    .feature-toggle {
        width: 40px;
        height: 40px;
    }
    
    .document-selector label {
        font-size: 11px;
    }
    
    .glass-select {
        font-size: 11px;
        padding: 5px 8px;
    }
}

/* ========== States ========== */
button:disabled,
input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ========== Print Styles for Legal Documents ========== */
@media print {
    .legal-title,
    .legal-header,
    .legal-subheader {
        color: black !important;
        break-after: avoid;
    }
    
    .legal-list,
    .legal-numbered-list {
        break-inside: avoid;
    }
    
    .legal-emphasis {
        background: none !important;
        text-decoration: underline;
        color: black !important;
    }
    
    .document-reference {
        background: none !important;
        border: 1px solid black;
        color: black !important;
    }
    
    .legal-term {
        background: none !important;
        color: black !important;
        border: 1px solid black;
    }
    
    .chat-message {
        break-inside: avoid;
        margin-bottom: 20px;
    }
}

/* ========== Responsive Design ========== */
@media (max-width: 768px) {
    .notification-container {
        right: 10px;
        left: 10px;
        top: 10px;
        width: auto;
        max-width: none;
    }
    
    .toast {
        max-width: none;
        width: 100%;
        font-size: 13px;
    }
    
    .toast-message {
        font-size: 13px;
        line-height: 1.3;
    }
    
    .chat-message {
        max-width: 95%;
    }
    
    .assistant-message {
        max-width: 95%;
    }
    
    .message-bubble {
        margin-right: 20px;
        padding: 12px 16px;
        max-width: 100%;
    }
    
    .user-message {
        padding-left: 20px;
    }
    
    .user-message .message-content {
        max-width: 90%;
        padding: 10px 14px;
    }
    
    .assistant-avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
        margin-right: 8px;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .notification-container {
        right: 5px;
        left: 5px;
        top: 10px;
    }
    
    .toast {
        padding: 12px;
        font-size: 12px;
    }
    
    .toast-icon {
        font-size: 16px;
        margin-right: 8px;
    }
    
    .toast-message {
        font-size: 12px;
    }
    
    .message-bubble {
        margin-right: 10px;
        padding: 10px 12px;
    }
    
    .user-message {
        padding-left: 10px;
    }
    
    .message-content {
        font-size: 13px;
    }
}

/* ========== Document View Components ========== */
.documents-view-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.view-toggle {
    display: inline-flex;
    gap: 4px;
    padding: 3px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.view-toggle-btn {
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    position: relative;
    white-space: nowrap;
}

.view-toggle-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 6px;
}

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

.view-toggle-btn.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
    color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.2);
}

.view-toggle-btn.active::before {
    opacity: 1;
}

.view-toggle-btn i {
    font-size: 13px;
    position: relative;
    z-index: 1;
}

/* File Browser Styles */
.file-browser {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 300px;
    max-height: 100%;
    overflow: hidden;
}

.browser-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.browser-nav-btn {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.browser-nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.browser-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.03);
}

.browser-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.breadcrumb-item {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.breadcrumb-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--primary-color);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

.breadcrumb-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    color: var(--primary-color);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: inset 0 0 15px rgba(99, 102, 241, 0.1);
}

.breadcrumb-separator {
    color: var(--text-secondary);
    padding: 0 4px;
    opacity: 0.4;
    font-weight: 300;
}

.browser-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 40px;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.3) rgba(255, 255, 255, 0.05);
    min-height: 0;
}

.browser-content::-webkit-scrollbar {
    width: 8px;
}

.browser-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.browser-content::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.05);
}

.browser-content::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

.browser-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
}

.browser-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(168, 85, 247, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.browser-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.browser-item:hover::before {
    opacity: 1;
}

.browser-item i {
    font-size: 22px;
    width: 28px;
    text-align: center;
    color: var(--primary-color);
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.browser-item:hover i {
    transform: scale(1.1);
}

.browser-folder i {
    color: #a855f7;
}

.browser-item-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

.browser-item-count,
.browser-item-date,
.browser-item-chunks {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    position: relative;
    z-index: 1;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.browser-item-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.3s ease;
    position: relative;
    z-index: 1;
}

.browser-item:hover .browser-item-actions {
    opacity: 1;
}

.browser-action {
    padding: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.browser-action:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Collapsible Folder Styles */
.folder-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    width: 100%;
}

.folder-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(168, 85, 247, 0.08);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(168, 85, 247, 0.15);
    position: relative;
    overflow: hidden;
}

.folder-header:hover {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.3);
    transform: translateX(4px);
}

.folder-toggle {
    font-size: 14px;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.folder-header.expanded .folder-toggle {
    transform: rotate(90deg);
}

.folder-icon {
    font-size: 20px;
    color: #a855f7;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.folder-header.expanded .folder-icon {
    color: #d8b4fe;
}

.folder-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.folder-count {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.folder-content {
    display: none;
    flex-direction: column;
    gap: 6px;
    margin-left: 24px;
    padding-left: 16px;
    border-left: 2px solid rgba(168, 85, 247, 0.2);
    margin-top: 6px;
}

.folder-content.expanded {
    display: flex;
}

.folder-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.folder-file:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateX(4px);
}

.folder-file i {
    font-size: 16px;
    color: var(--primary-color);
}

.folder-file-name {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.folder-file-info {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: var(--text-secondary);
}

.folder-file-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.folder-file:hover .folder-file-actions {
    opacity: 1;
}

.folder-file-action {
    padding: 6px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.folder-file-action:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    color: var(--primary-color);
}

/* Upload Mode Buttons */
.upload-options {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.upload-mode-btn {
    flex: 1;
    padding: 18px 16px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.upload-mode-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-mode-btn:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 0 20px rgba(99, 102, 241, 0.1);
}

.upload-mode-btn:hover::before {
    opacity: 0.5;
}

.upload-mode-btn.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.3), inset 0 0 25px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.upload-mode-btn.active::before {
    opacity: 1;
}

.upload-mode-btn i {
    font-size: 28px;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.upload-mode-btn:hover i {
    transform: scale(1.15);
}

.upload-mode-btn.active i {
    transform: scale(1.2);
}

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