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

:root {
    --primary-gradient: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    --header-height: 60px;
    --nav-width: 250px;
    --chat-width: 350px;
    --transition-speed: 0.3s;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #000000;
    color: #ffffff;
    min-height: 100vh;
}

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

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

/* Header */
.app-header {
    background: var(--primary-gradient);
    color: white;
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.app-header h1 {
    font-size: 1.5em;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    background: #000000;
    transition: margin-left var(--transition-speed);
}


input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1em;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.4);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}


/* Loading Modal */
.loading-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-modal.show {
    display: flex;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: white;
    font-size: 1.2em;
    font-weight: 600;
    margin-top: 20px;
    text-align: center;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 500px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-icon {
    font-size: 1.5em;
    font-weight: bold;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    color: #333;
    font-size: 0.95em;
    line-height: 1.4;
}

/* Toast Types */
.toast-success {
    border-left: 4px solid #10b981;
}

.toast-success .toast-icon {
    color: #10b981;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-error .toast-icon {
    color: #ef4444;
}

.toast-warning {
    border-left: 4px solid #f59e0b;
}

.toast-warning .toast-icon {
    color: #f59e0b;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

.toast-info .toast-icon {
    color: #3b82f6;
}

/* Shared back button styles */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid #e0e0e0;
    background: #f9fafb;
    color: #374151;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: #f3f4f6;
    border-color: #d0d0d0;
}

/* Page exit button (fixed top-right) */
.page-exit-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 900;
    width: 40px;
    height: 40px;
    padding: 0;
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid #555;
    border-radius: 50%;
    color: #cccccc;
    font-size: 1.5em;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.page-exit-btn:hover {
    color: #ffffff;
    background: rgba(60, 60, 60, 0.9);
    border-color: #777;
    transform: none;
    box-shadow: none;
}

/* Exit confirmation modal */
.exit-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.exit-confirm-modal.hidden {
    display: none;
}

.exit-confirm-content {
    background: #1a1a1a;
    border: 2px solid #444;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.exit-confirm-content h2 {
    color: #ffffff;
    font-size: 1.4em;
    margin: 0 0 12px 0;
}

.exit-confirm-content p {
    color: #aaaaaa;
    font-size: 1em;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.exit-confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.exit-confirm-cancel {
    padding: 10px 24px;
    background: #333;
    border: 1px solid #555;
    border-radius: 6px;
    color: #ffffff;
    font-size: 1em;
    font-weight: normal;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.exit-confirm-cancel:hover {
    background: #444;
    border-color: #777;
    transform: none;
    box-shadow: none;
}

.exit-confirm-leave {
    padding: 10px 24px;
    background: #dc2626;
    border: 1px solid #dc2626;
    border-radius: 6px;
    color: #ffffff;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.exit-confirm-leave:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    transform: none;
    box-shadow: none;
}