/* CSS Variables for Theming */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #f8fafc;
    --accent-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --transition: all 0.3s ease;
    --font-family: 'Calibri', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

[data-theme="dark"] {
    --primary-color: #818cf8;
    --primary-dark: #6366f1;
    --secondary-color: #1e293b;
    --accent-color: #34d399;
    --warning-color: #fbbf24;
    --danger-color: #f87171;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --border-color: #334155;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: var(--transition);
}

/* Improved Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

/* Auth Pages */
.auth-page {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    background: var(--bg-primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    overflow: hidden;
}

.auth-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 2.5rem 2rem;
    text-align: center;
}

.auth-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.auth-header p {
    opacity: 0.9;
    font-size: 1rem;
}

.auth-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.tab-button {
    flex: 1;
    padding: 1.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
}

.tab-button.active {
    color: var(--primary-color);
    background: var(--bg-primary);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
}

.tab-content {
    padding: 2.5rem 2rem;
}

.tab-pane {
    display: none;
}

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

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

.auth-links {
    text-align: center;
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-links a:hover {
    text-decoration: underline;
}

.link-separator {
    color: var(--text-secondary);
}

/* Security Notice */
.security-notice {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.security-notice.success {
    border-left: 4px solid var(--accent-color);
    background: rgba(16, 185, 129, 0.05);
}

.security-notice.warning {
    border-left: 4px solid var(--warning-color);
    background: rgba(245, 158, 11, 0.05);
}

.security-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.security-notice.success .security-icon {
    color: var(--accent-color);
}

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

.security-message h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.security-message p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Contact Info */
.contact-info {
    margin: 2rem 0;
}

.contact-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.contact-icon {
    font-size: 2rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.contact-details h5 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.admin-email {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.contact-details p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.input-with-icon {
    position: relative;
}

.input-with-icon .mdi {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    z-index: 1;
}

.input-with-icon input,
.input-with-icon select,
.input-with-icon textarea {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    font-size: 0.95rem;
    font-family: var(--font-family);
}

.input-with-icon input:focus,
.input-with-icon select:focus,
.input-with-icon textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-with-icon textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

/* Form Validation States */
.form-group.valid .input-with-icon::after {
    content: '✓';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-color);
    font-weight: bold;
}

.form-group.invalid .input-with-icon::after {
    content: '✗';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--danger-color);
    font-weight: bold;
}

.form-group.invalid input {
    border-color: var(--danger-color);
}

.form-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Buttons */
.btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    text-decoration: none;
    font-family: var(--font-family);
    justify-content: center;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--accent-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
}

.btn-xs {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

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

/* Header */
.app-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.75rem;
    border-radius: var(--radius);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.75rem;
    border-radius: var(--radius);
    transition: var(--transition);
    font-weight: 500;
}

.user-button:hover {
    background: var(--bg-secondary);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    display: none;
    z-index: 1000;
    margin-top: 0.5rem;
}

.user-dropdown.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background: var(--bg-secondary);
}

.dropdown-item.logout {
    color: var(--danger-color);
    border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 2rem;
    min-height: calc(100vh - 80px);
    height: 100%;
}

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 320px 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* Control Panel */
.control-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1.75rem;
    border: 1px solid var(--border-color);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

@media (max-width: 1024px) {
    .control-panel {
        position: static;
        margin-bottom: 1.5rem;
    }
}

.panel-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.panel-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Content Area */
.content-area {
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 600px;
}

.content-header {
    padding: 1.75rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.content-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.content-body {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Topics Container */
.topics-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 2rem;
    flex-shrink: 0;
}

.topic-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: var(--transition);
}

.topic-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.topic-header {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.topic-input {
    flex: 1;
}

.topic-actions {
    display: flex;
    gap: 0.75rem;
}

/* Generation Results */
.generation-results {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.article-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    flex-shrink: 0;
}

.article-card:hover {
    box-shadow: var(--shadow-lg);
}

.article-header {
    padding: 1.5rem 2rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.article-title {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    font-size: 1.1rem;
    margin: 0;
}

.article-status {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-generating {
    background: #fef3c7;
    color: #92400e;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.status-paused {
    background: #e0e7ff;
    color: #3730a3;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
}

.article-content {
    padding: 2rem;
}

/* Improved Content Styling with Professional Font Sizes */
.streaming-content {
    line-height: 1.7;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 12px; /* Body text */
}

.streaming-content h1 {
    font-size: 20px; /* H1 */
    font-weight: 700;
    margin: 2rem 0 1rem 0;
    color: var(--text-primary);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.streaming-content h2 {
    font-size: 18px; /* H2 */
    font-weight: 600;
    margin: 1.75rem 0 1rem 0;
    color: var(--text-primary);
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
}

.streaming-content h3 {
    font-size: 16px; /* H3 */
    font-weight: 600;
    margin: 1.5rem 0 0.75rem 0;
    color: var(--text-primary);
}

.streaming-content p {
    margin-bottom: 1.25rem;
    font-size: 12px; /* Body text */
    line-height: 1.7;
}

.streaming-content strong {
    font-weight: 700;
    color: var(--text-primary);
}

.streaming-content em {
    font-style: italic;
    color: var(--text-secondary);
}

.streaming-content ul,
.streaming-content ol {
    margin: 1.25rem 0;
    padding-left: 2rem;
}

.streaming-content li {
    margin-bottom: 0.75rem;
    font-size: 12px; /* Body text */
}

.streaming-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: var(--bg-primary);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
}

.streaming-content code {
    background: var(--bg-primary);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.article-footer {
    padding: 1.5rem 2rem;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.article-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.article-actions {
    display: flex;
    gap: 0.75rem;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transition: width 0.3s ease;
    width: 0%;
}

/* Notifications */
.notifications-container {
    position: fixed;
    top: 100px;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
}

.notification {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    animation: slideInRight 0.3s ease;
    position: relative;
}

.notification.success {
    border-left: 4px solid var(--accent-color);
}

.notification.error {
    border-left: 4px solid var(--danger-color);
}

.notification.warning {
    border-left: 4px solid var(--warning-color);
}

.notification.info {
    border-left: 4px solid var(--primary-color);
}

.notification-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-content h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.notification-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition);
    flex-shrink: 0;
}

.notification-close:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

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

/* Support Section */
.support-section {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 2rem;
    border-radius: var(--radius);
    margin-top: 2rem;
    text-align: center;
}

.support-section h3 {
    color: white;
    margin-bottom: 1rem;
}

.support-section p {
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.support-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 2rem;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 700px;
    max-height: 90vh;
}

.modal-header {
    padding: 1.75rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Modern Form Styles */
.modern-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon .mdi {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    z-index: 1;
}

.input-with-icon input,
.input-with-icon textarea,
.input-with-icon select {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

.input-with-icon input:focus,
.input-with-icon textarea:focus,
.input-with-icon select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-with-icon textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Checkbox Styles */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: normal;
    margin: 0.5rem 0;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    transition: var(--transition);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Admin Dashboard */
.admin-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    min-height: calc(100vh - 80px);
}

.admin-sidebar {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 2rem;
    border: 1px solid var(--border-color);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: var(--transition);
    font-weight: 500;
}

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

.admin-main {
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.admin-section {
    padding: 2rem;
    display: none;
}

.admin-section.active {
    display: block;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 1.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.data-table tr:hover {
    background: var(--bg-secondary);
}

/* Install Result */
.install-result {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--radius);
}

.install-result .success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    padding: 1rem;
    border-radius: var(--radius);
}

.install-result .error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 1rem;
    border-radius: var(--radius);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header {
        padding: 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .dashboard-grid {
        gap: 1rem;
    }
    
    .content-body {
        padding: 1.5rem;
    }
    
    .article-header,
    .article-footer {
        padding: 1.25rem 1.5rem;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .article-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .article-stats {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .support-buttons {
        flex-direction: column;
    }
    
    .admin-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-sidebar {
        position: static;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .auth-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .link-separator {
        display: none;
    }
}

@media (max-width: 480px) {
    .auth-container {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }
    
    .tab-content {
        padding: 2rem 1.5rem;
    }
    
    .control-panel {
        padding: 1.5rem;
    }
    
    .notifications-container {
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
    
    .content-body {
        padding: 0.75rem;
    }
    
    .article-content {
        padding: 1rem;
    }
    
    .article-footer {
        padding: 0.75rem;
    }
    
    .security-notice {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .contact-card {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
}

/* Animation for streaming content */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.streaming {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.hidden { display: none; }
/* Improved Content Styling for Better Readability */
.streaming-content {
    line-height: 1.7;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px; /* Better base font size */
    max-width: 100%;
    overflow-wrap: break-word;
}

.streaming-content h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 2rem 0 1rem 0;
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    line-height: 1.3;
}

.streaming-content h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 1.75rem 0 1rem 0;
    color: var(--text-primary);
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    line-height: 1.3;
}

.streaming-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem 0;
    color: var(--text-primary);
    line-height: 1.3;
}

.streaming-content h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem 0;
    color: var(--text-primary);
}

.streaming-content p {
    margin-bottom: 1.25rem;
    font-size: 14px;
    line-height: 1.7;
    text-align: left;
}

.streaming-content strong {
    font-weight: 700;
    color: var(--text-primary);
}

.streaming-content em {
    font-style: italic;
    color: var(--text-secondary);
}

.streaming-content u {
    text-decoration: underline;
}

.streaming-content ul,
.streaming-content ol {
    margin: 1.25rem 0;
    padding-left: 2rem;
}

.streaming-content li {
    margin-bottom: 0.5rem;
    font-size: 14px;
    line-height: 1.6;
}

.streaming-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: var(--bg-primary);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    font-size: 14px;
}

.streaming-content code {
    background: var(--bg-primary);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
}

.streaming-content pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.9em;
}

.streaming-content pre code {
    background: none;
    padding: 0;
    border: none;
    font-size: inherit;
}

.streaming-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 14px;
}

.streaming-content th,
.streaming-content td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.streaming-content th {
    background: var(--bg-secondary);
    font-weight: 600;
}

/* API Key Security - Hide from source code */
#apiKey {
    -webkit-text-security: disc;
    -moz-text-security: disc;
    text-security: disc;
}

#settingsApiKey {
    -webkit-text-security: disc;
    -moz-text-security: disc;
    text-security: disc;
}

/* Better responsive design for content */
@media (max-width: 768px) {
    .streaming-content {
        font-size: 13px;
    }
    
    .streaming-content h1 {
        font-size: 22px;
    }
    
    .streaming-content h2 {
        font-size: 18px;
    }
    
    .streaming-content h3 {
        font-size: 16px;
    }
    
    .streaming-content ul,
    .streaming-content ol {
        padding-left: 1.5rem;
    }
}