/* ============================================
   L from Death Note Theme - Hesham Haroon
   Dark, Mysterious, Detective Aesthetic
   ============================================ */

/* CSS Variables */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-card: #151515;

    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;

    --accent-red: #8B0000;
    --accent-red-bright: #DC143C;
    --accent-red-glow: rgba(220, 20, 60, 0.4);

    --border-color: #2a2a2a;
    --border-red: rgba(139, 0, 0, 0.5);

    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
    --font-typewriter: 'Special Elite', cursive;

    --shadow-dark: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-red: 0 0 20px rgba(139, 0, 0, 0.3);

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-mono);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Selection */
::selection {
    background: var(--accent-red);
    color: white;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-red);
    box-shadow: var(--shadow-red);
}

/* L Silhouette Background */
.l-silhouette {
    position: fixed;
    bottom: -50px;
    right: -50px;
    width: 400px;
    height: 500px;
    background: linear-gradient(135deg, transparent 40%, rgba(139, 0, 0, 0.03) 100%);
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

.l-silhouette::before {
    content: 'L';
    position: absolute;
    font-family: var(--font-typewriter);
    font-size: 300px;
    color: rgba(139, 0, 0, 0.05);
    bottom: 0;
    right: 0;
    line-height: 1;
}

/* Notebook Lines Background */
.notebook-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 39px,
        rgba(139, 0, 0, 0.03) 39px,
        rgba(139, 0, 0, 0.03) 40px
    );
    pointer-events: none;
    z-index: 0;
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    padding: 30px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.l-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-typewriter);
    font-size: 36px;
    color: var(--accent-red-bright);
    border: 2px solid var(--accent-red);
    border-radius: 4px;
    background: var(--bg-secondary);
    animation: pulse-glow 3s infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 10px var(--accent-red-glow); }
    50% { box-shadow: 0 0 25px var(--accent-red-glow); }
}

.header-text h1 {
    font-family: var(--font-typewriter);
    font-size: 2rem;
    letter-spacing: 3px;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* Glitch Effect */
.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch::before {
    color: var(--accent-red-bright);
    animation: glitch-1 5s infinite;
}

.glitch::after {
    color: #00ffff;
    animation: glitch-2 5s infinite;
}

@keyframes glitch-1 {
    0%, 90%, 100% { opacity: 0; transform: translate(0); }
    91% { opacity: 0.8; transform: translate(-2px, 1px); }
    92% { opacity: 0; }
    93% { opacity: 0.8; transform: translate(2px, -1px); }
    94% { opacity: 0; }
}

@keyframes glitch-2 {
    0%, 90%, 100% { opacity: 0; transform: translate(0); }
    91.5% { opacity: 0.5; transform: translate(1px, -1px); }
    92.5% { opacity: 0; }
    93.5% { opacity: 0.5; transform: translate(-1px, 1px); }
    94.5% { opacity: 0; }
}

.header-quote {
    padding-left: 80px;
}

.quote-text {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-left: 2px solid var(--accent-red);
    padding-left: 15px;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    flex: 1;
}

/* Info Panel */
.info-panel {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.profile-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #00ff00;
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.5; }
}

.status-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.profile-info h2 {
    font-family: var(--font-typewriter);
    font-size: 1rem;
    color: var(--accent-red-bright);
    margin-bottom: 15px;
    letter-spacing: 2px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.info-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.info-item .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-item .value {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.expertise-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.tag {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.tag:hover {
    border-color: var(--accent-red);
    color: var(--accent-red-bright);
    box-shadow: 0 0 10px var(--accent-red-glow);
}

.connections-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
}

.connections-section h3 {
    font-family: var(--font-typewriter);
    font-size: 0.85rem;
    color: var(--accent-red-bright);
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px;
    border-radius: 4px;
    transition: var(--transition-fast);
    margin-bottom: 8px;
}

.social-link:hover {
    background: var(--bg-tertiary);
    color: var(--accent-red-bright);
}

.social-link svg {
    flex-shrink: 0;
}

.stats-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-family: var(--font-typewriter);
    font-size: 1.5rem;
    color: var(--accent-red-bright);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Tools Section */
.tools-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.tools-section h3 {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
    font-family: var(--font-mono);
}

.tool-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition-normal);
}

.tool-link:hover {
    border-color: var(--accent-red);
    background: rgba(139, 0, 0, 0.1);
    transform: translateX(5px);
}

.tool-link svg:first-child {
    flex-shrink: 0;
    fill: var(--accent-red-bright);
}

.tool-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tool-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.tool-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tool-link .arrow-icon {
    flex-shrink: 0;
    fill: var(--text-muted);
    transition: all var(--transition-normal);
}

.tool-link:hover .arrow-icon {
    fill: var(--accent-red-bright);
    transform: translateX(3px);
}

/* CV Upload in Chat */
.cv-upload-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

.cv-upload-btn svg {
    fill: var(--text-muted);
    transition: fill var(--transition-normal);
}

.cv-upload-btn:hover {
    background: rgba(139, 0, 0, 0.2);
}

.cv-upload-btn:hover svg {
    fill: var(--accent-red-bright);
}

.cv-upload-btn.has-file svg {
    fill: var(--accent-red-bright);
}

.cv-upload-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-red);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
}

.cv-upload-preview.hidden {
    display: none;
}

.cv-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cv-file-info svg {
    fill: var(--accent-red-bright);
    flex-shrink: 0;
}

.cv-file-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cv-file-name {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.cv-file-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cv-remove-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.cv-remove-btn svg {
    fill: var(--text-muted);
}

.cv-remove-btn:hover {
    background: rgba(239, 83, 80, 0.2);
}

.cv-remove-btn:hover svg {
    fill: #ef5350;
}

/* CV Analysis Message Styles */
.cv-analysis-message {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-card));
    border: 1px solid var(--accent-red);
    border-radius: 12px;
    padding: 20px;
    margin: 10px 0;
}

.cv-score-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.cv-score-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    flex-shrink: 0;
}

.cv-score-circle.excellent { background: rgba(102, 187, 106, 0.2); color: #66bb6a; border: 2px solid #66bb6a; }
.cv-score-circle.good { background: rgba(255, 167, 38, 0.2); color: #ffa726; border: 2px solid #ffa726; }
.cv-score-circle.needs-work { background: rgba(239, 83, 80, 0.2); color: #ef5350; border: 2px solid #ef5350; }

.cv-score-info h3 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.cv-score-info p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.cv-categories {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.cv-category {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 10px;
}

.cv-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.cv-category-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.cv-category-score {
    font-size: 0.85rem;
    font-weight: 600;
}

.cv-category-bar {
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
}

.cv-category-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

@media (max-width: 480px) {
    .cv-categories {
        grid-template-columns: 1fr;
    }
}

/* CV Upload Indicator in Messages */
.cv-upload-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(139, 0, 0, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--accent-red-bright);
}

.cv-upload-indicator svg {
    fill: var(--accent-red-bright);
}

/* Drag over effect for chat section */
.chat-section.drag-over {
    border: 2px dashed var(--accent-red-bright) !important;
    background: rgba(139, 0, 0, 0.05);
}

/* Chat Section */
.chat-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 220px);
    min-height: 500px;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 8px 8px 0 0;
}

.chat-avatar {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-red);
    color: white;
    font-family: var(--font-typewriter);
    font-size: 1.5rem;
    border-radius: 50%;
}

.chat-title h2 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.chat-title p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chat-status {
    margin-left: auto;
}

.typing-status {
    color: var(--accent-red-bright);
    font-size: 0.8rem;
    animation: fade-pulse 1.5s infinite;
}

@keyframes fade-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: message-fade-in 0.3s ease;
}

@keyframes message-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.bot-message {
    align-self: flex-start;
}

.message-content {
    background: var(--bg-tertiary);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    line-height: 1.5;
    font-size: 0.95rem;
    word-wrap: break-word;
}

.user-message .message-content {
    white-space: pre-wrap;
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
    border-radius: 12px 12px 4px 12px;
}

.bot-message .message-content {
    border-left: none;
    border-right: 3px solid var(--accent-red);
    border-radius: 12px 12px 4px 12px;
    direction: rtl;
    text-align: right;
    unicode-bidi: plaintext;
}

/* Markdown Styles for Bot Messages */
.bot-message .message-content p {
    margin: 0 0 10px 0;
}

.bot-message .message-content p:last-child {
    margin-bottom: 0;
}

.bot-message .message-content h1,
.bot-message .message-content h2,
.bot-message .message-content h3,
.bot-message .message-content h4 {
    color: var(--accent-red-bright);
    margin: 15px 0 10px 0;
    font-weight: 600;
}

.bot-message .message-content h1 { font-size: 1.3rem; }
.bot-message .message-content h2 { font-size: 1.15rem; }
.bot-message .message-content h3 { font-size: 1.05rem; }
.bot-message .message-content h4 { font-size: 1rem; }

.bot-message .message-content strong {
    color: var(--accent-red-bright);
    font-weight: 600;
}

.bot-message .message-content em {
    color: var(--text-secondary);
    font-style: italic;
}

.bot-message .message-content code {
    background: var(--bg-primary);
    color: var(--accent-red-bright);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    border: 1px solid var(--border-color);
}

.bot-message .message-content pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
}

.bot-message .message-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-primary);
    display: block;
    white-space: pre;
}

.bot-message .message-content ul,
.bot-message .message-content ol {
    margin: 10px 0;
    padding-right: 25px;
    padding-left: 0;
}

.bot-message .message-content li {
    margin: 5px 0;
    line-height: 1.5;
}

.bot-message .message-content ul li::marker {
    color: var(--accent-red-bright);
}

.bot-message .message-content ol li::marker {
    color: var(--accent-red-bright);
    font-weight: 600;
}

.bot-message .message-content blockquote {
    border-left: none;
    border-right: 3px solid var(--accent-red);
    margin: 10px 0;
    padding: 8px 15px;
    background: var(--bg-primary);
    border-radius: 8px 0 0 8px;
    color: var(--text-secondary);
    font-style: italic;
}

.bot-message .message-content a {
    color: var(--accent-red-bright);
    text-decoration: none;
    border-bottom: 1px dashed var(--accent-red);
    transition: var(--transition-fast);
}

.bot-message .message-content a:hover {
    color: white;
    border-bottom-style: solid;
}

.bot-message .message-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 15px 0;
}

.bot-message .message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 0.9rem;
}

.bot-message .message-content th,
.bot-message .message-content td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}

.bot-message .message-content th {
    background: var(--bg-primary);
    color: var(--accent-red-bright);
    font-weight: 600;
}

.bot-message .message-content tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.2);
}

.message-timestamp {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 5px;
    text-align: right;
}

.user-message .message-timestamp {
    text-align: left;
}

.bot-message .message-timestamp {
    text-align: left;
    direction: ltr;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 15px 20px;
    align-items: center;
}

.typing-indicator.hidden {
    display: none;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    animation: typing-bounce 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; }

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat Input */
.chat-input-container {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 0 0 8px 8px;
}

.quick-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.quick-prompt {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: var(--transition-fast);
}

.quick-prompt:hover {
    border-color: var(--accent-red);
    color: var(--accent-red-bright);
    box-shadow: 0 0 10px var(--accent-red-glow);
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#user-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 15px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    resize: none;
    min-height: 48px;
    max-height: 150px;
    transition: var(--transition-fast);
}

#user-input:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 10px var(--accent-red-glow);
}

#user-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-red);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: var(--transition-fast);
}

.send-btn:hover {
    background: var(--accent-red-bright);
    box-shadow: var(--shadow-red);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Footer */
.footer {
    padding: 20px 0;
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.death-note-ref {
    font-size: 0.9rem;
    color: var(--accent-red);
}

.arabic-text {
    font-size: 0.9rem;
    direction: rtl;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 10, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.loading-content {
    text-align: center;
}

.loading-l {
    font-family: var(--font-typewriter);
    font-size: 80px;
    color: var(--accent-red-bright);
    animation: loading-pulse 1.5s infinite;
}

@keyframes loading-pulse {
    0%, 100% {
        text-shadow: 0 0 20px var(--accent-red-glow);
    }
    50% {
        text-shadow: 0 0 40px var(--accent-red-glow), 0 0 60px var(--accent-red-glow);
    }
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: var(--accent-red);
    border-radius: 50%;
    animation: loading-dot 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loading-dot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.loading-text {
    margin-top: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 2px;
}

/* Hidden Utility */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .info-panel {
        order: 2;
    }

    .chat-section {
        order: 1;
        height: 60vh;
        min-height: 400px;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .header-quote {
        padding-left: 0;
        text-align: center;
    }

    .quote-text {
        border-left: none;
        border-top: 2px solid var(--accent-red);
        padding-left: 0;
        padding-top: 10px;
        display: block;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    .header-text h1 {
        font-size: 1.4rem;
    }

    .l-icon {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }

    .message {
        max-width: 90%;
    }

    .quick-prompts {
        display: none;
    }

    .stats-section {
        grid-template-columns: 1fr;
    }

    .l-silhouette::before {
        font-size: 150px;
    }
}

/* Print Styles */
@media print {
    .chat-input-container,
    .loading-overlay,
    .l-silhouette,
    .notebook-bg {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }
}

/* ============================================
   Fun Elements & Easter Eggs
   ============================================ */

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-quote {
    border-left: 3px solid var(--accent-red);
}

.toast-achievement {
    border-left: 3px solid #FFD700;
    background: linear-gradient(135deg, var(--bg-card), #1a1a0a);
}

.toast-icon {
    font-size: 1.5rem;
    color: var(--accent-red);
    font-weight: bold;
}

.toast-achievement .toast-icon {
    color: #FFD700;
}

.toast-message {
    color: var(--text-primary);
    font-size: 0.95rem;
    max-width: 300px;
}

/* Confetti Animation */
@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
    }
}

/* Cursor Trail */
.cursor-trail {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    animation: trail-fade 0.5s ease forwards;
}

@keyframes trail-fade {
    0% {
        opacity: 0.8;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0);
    }
}

/* Enhanced Glitch Effect */
@keyframes glitch {
    0% {
        transform: translate(0);
        text-shadow: -2px 0 #DC143C, 2px 0 #00f;
    }
    25% {
        transform: translate(-2px, 2px);
        text-shadow: 2px 0 #DC143C, -2px 0 #00f;
    }
    50% {
        transform: translate(2px, -2px);
        text-shadow: -2px 0 #0f0, 2px 0 #DC143C;
    }
    75% {
        transform: translate(-2px, -2px);
        text-shadow: 2px 0 #00f, -2px 0 #0f0;
    }
    100% {
        transform: translate(0);
        text-shadow: none;
    }
}

/* L Icon Hover Effects */
.l-icon {
    transition: all 0.3s ease;
}

.l-icon:hover {
    text-shadow: 
        0 0 10px var(--accent-red),
        0 0 20px var(--accent-red),
        0 0 30px var(--accent-red);
    transform: scale(1.1);
}

/* Fun Status Indicator Pulse */
.status-dot {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 5px currentColor;
    }
    50% {
        box-shadow: 0 0 15px currentColor, 0 0 25px currentColor;
    }
}

/* Quick Prompt Hover Fun */
.quick-prompt:hover {
    transform: translateY(-2px) scale(1.02);
}

/* Message Appear Animation */
.message {
    animation: message-appear 0.3s ease;
}

@keyframes message-appear {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Send Button Pulse on Hover */
.send-btn:hover:not(:disabled) {
    animation: send-pulse 0.5s ease;
}

@keyframes send-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Typing Indicator Enhanced */
.typing-dot {
    animation: typing-bounce 1.4s ease-in-out infinite;
}

.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; }

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Header Quote Typewriter Effect */
.quote-text {
    overflow: hidden;
    white-space: nowrap;
    animation: typewriter 3s steps(60) 1s forwards;
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

/* Fun Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-red);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-red-bright);
}

/* Selection Color */
::selection {
    background: var(--accent-red);
    color: white;
}

/* Fun Focus Ring */
*:focus-visible {
    outline: 2px solid var(--accent-red);
    outline-offset: 2px;
}

/* Secret Hint in Footer */
.footer-hint {
    margin-top: 10px;
}

.secret-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.5;
    cursor: help;
    transition: all 0.3s ease;
}

.secret-hint:hover {
    opacity: 1;
    color: var(--accent-red);
}

/* Joke & Expression Toast Styles */
.toast-joke {
    border-left: 3px solid #4CAF50;
    background: linear-gradient(135deg, var(--bg-card), #0a1a0a);
}

.toast-joke .toast-icon {
    color: #4CAF50;
}

.toast-expression {
    border-left: 3px solid #2196F3;
    background: linear-gradient(135deg, var(--bg-card), #0a0a1a);
}

.toast-expression .toast-icon {
    color: #2196F3;
}

/* RTL Support for Arabic Toasts */
.toast-message {
    direction: rtl;
    text-align: right;
    unicode-bidi: plaintext;
}

/* ============================================
   Chat History Sidebar
   ============================================ */

.chat-history-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.chat-history-sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
    color: var(--accent-red);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.new-chat-btn {
    background: var(--accent-red);
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.new-chat-btn:hover {
    background: var(--accent-red-dark);
    transform: scale(1.05);
}

.sidebar-search {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-search input {
    width: 100%;
    padding: 10px 15px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--accent-red);
}

.sidebar-search input::placeholder {
    color: var(--text-muted);
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.conversation-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 5px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.conversation-item:hover {
    background: var(--bg-main);
    border-color: var(--border-color);
}

.conversation-item.active {
    background: rgba(220, 20, 60, 0.1);
    border-color: var(--accent-red);
}

.conversation-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-main);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
    color: var(--accent-red);
}

.conversation-details {
    flex: 1;
    min-width: 0;
}

.conversation-title {
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.conversation-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.conversation-count {
    font-size: 0.7rem;
    color: var(--accent-red);
    background: rgba(220, 20, 60, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
}

.conversation-actions {
    display: none;
    gap: 5px;
    margin-left: 10px;
}

.conversation-item:hover .conversation-actions {
    display: flex;
}

.conv-action-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.conv-action-btn:hover {
    background: var(--bg-main);
    color: var(--accent-red);
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.sidebar-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-action:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.sidebar-action.active {
    background: rgba(220, 20, 60, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 101;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.sidebar-toggle.active {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

/* Main container shift when sidebar open */
.container.sidebar-open {
    margin-left: 300px;
    transition: margin-left 0.3s ease;
}

/* Empty State */
.conversation-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.conversation-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.conversation-empty p {
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Search Results */
.search-result-item {
    background: rgba(220, 20, 60, 0.05);
}

.search-highlight {
    background: rgba(220, 20, 60, 0.3);
    padding: 0 2px;
    border-radius: 2px;
}

/* Conversation Context Menu */
.context-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    min-width: 150px;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    cursor: pointer;
    color: var(--text-main);
    font-size: 0.85rem;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.context-menu-item:hover {
    background: var(--bg-main);
}

.context-menu-item.danger {
    color: var(--accent-red);
}

.context-menu-item.danger:hover {
    background: rgba(220, 20, 60, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .chat-history-sidebar {
        width: 100%;
    }

    .container.sidebar-open {
        margin-left: 0;
    }

    .sidebar-toggle {
        top: 10px;
        left: 10px;
    }
}

/* Archived indicator */
.conversation-item.archived {
    opacity: 0.6;
}

.conversation-item.archived .conversation-title::after {
    content: ' (Archived)';
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* ============================================
   MESSAGE LIMIT & CHAT MANAGEMENT STYLES
   ============================================ */

/* Message Count Indicator */
.message-count-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.message-count-indicator .count-text {
    font-weight: 500;
}

.message-count-indicator .count-bar {
    width: 50px;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
}

.message-count-indicator .count-fill {
    height: 100%;
    background: #4caf50;
    border-radius: 2px;
    transition: width 0.3s ease, background 0.3s ease;
}

.message-count-indicator.medium .count-fill {
    background: #ff9800;
}

.message-count-indicator.warning .count-fill {
    background: var(--accent-red-bright);
}

.message-count-indicator.warning .count-text {
    color: var(--accent-red-bright);
}

/* Message Limit Warning Banner */
.message-limit-warning {
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.15), rgba(139, 0, 0, 0.1));
    border: 1px solid var(--accent-red);
    border-radius: 8px;
    margin: 10px 15px;
    padding: 0;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.limit-warning-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: var(--accent-red-bright);
    font-size: 0.85rem;
}

.limit-warning-content svg {
    flex-shrink: 0;
}

.limit-warning-content span {
    flex: 1;
}

.limit-warning-content button {
    background: none;
    border: none;
    color: var(--accent-red-bright);
    cursor: pointer;
    padding: 0;
    font-size: inherit;
    font-family: inherit;
    text-decoration: underline;
}

.limit-warning-content button:hover {
    color: var(--text-primary);
}

.limit-warning-content .dismiss-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 18px;
    text-decoration: none;
}

.limit-warning-content .dismiss-btn:hover {
    background: rgba(220, 20, 60, 0.2);
}

/* Message Limit Reached Modal */
.message-limit-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.limit-modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--accent-red);
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.limit-modal-icon {
    margin-bottom: 20px;
    color: var(--accent-red-bright);
}

.limit-modal-content h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.limit-modal-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
    line-height: 1.5;
}

.limit-modal-content .limit-reason {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
    margin-bottom: 25px;
}

.new-chat-modal-btn {
    background: linear-gradient(135deg, var(--accent-red-bright), var(--accent-red));
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-mono);
}

.new-chat-modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px var(--accent-red-glow);
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    font-size: 0.9rem;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Title Update Animation */
.conversation-title.title-updating {
    animation: titlePulse 0.5s ease;
}

@keyframes titlePulse {
    0% {
        opacity: 0.5;
        transform: translateX(-5px);
    }
    50% {
        opacity: 1;
        background: rgba(220, 20, 60, 0.1);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
        background: transparent;
    }
}

/* Chat Restored Indicator */
.chat-restored-indicator {
    text-align: center;
    padding: 8px;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.chat-restored-indicator span {
    background: var(--bg-tertiary);
    padding: 4px 12px;
    border-radius: 12px;
}

/* Mobile Responsive for new elements */
@media (max-width: 768px) {
    .message-count-indicator {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .message-count-indicator .count-bar {
        width: 40px;
    }

    .limit-modal-content {
        margin: 20px;
        padding: 20px;
    }

    .toast-notification {
        left: 20px;
        right: 20px;
        transform: translateX(0) translateY(100px);
    }

    .toast-notification.show {
        transform: translateX(0) translateY(0);
    }
}
