/* Bengali News PWA - Dark Theme Styles */

:root {
    --bg-primary: #12121a;
    --bg-secondary: #1e1e2e;
    --bg-card: #252536;
    --bg-hover: #2d2d44;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --accent: #f97316;
    --accent-light: #fb923c;
    --success: #22c55e;
    --danger: #ef4444;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    --gradient-3: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 20px;
    overflow-y: auto;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 25px;
}

.logo-icon {
    font-size: 32px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
}

.logo-text span {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.nav-section {
    margin-bottom: 25px;
}

.nav-title {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
    margin-bottom: 5px;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--gradient-2);
    color: white;
}

.nav-link i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    padding: 30px;
    min-height: 100vh;
}

/* Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 25px;
    border: 1px solid var(--border);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card.gradient-1 {
    background: var(--gradient-1);
    border: none;
}

.stat-card.gradient-2 {
    background: var(--gradient-2);
    border: none;
}

.stat-card.gradient-3 {
    background: var(--gradient-3);
    border: none;
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 15px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 13px;
    opacity: 0.8;
}

/* News Grid */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.news-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 25px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    cursor: pointer;
}

.news-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.news-category {
    display: inline-block;
    padding: 5px 12px;
    background: var(--bg-hover);
    border-radius: 20px;
    font-size: 11px;
    color: var(--accent-light);
    margin-bottom: 12px;
}

.news-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.news-title a:hover {
    color: var(--accent-light);
}

.news-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 15px;
}

.news-meta i {
    margin-right: 5px;
}

.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: var(--bg-secondary);
    border-radius: 15px;
    font-size: 11px;
    color: var(--text-secondary);
}

.source-count {
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

/* Keywords */
.keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.keyword-tag {
    background: rgba(249, 115, 22, 0.15);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 500;
}

/* Hot Topic Banner */
.hot-topic-banner {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.hot-topic-banner::before {
    content: '🔥';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 80px;
    opacity: 0.2;
}

.hot-topic-banner .badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    margin-bottom: 15px;
}

.hot-topic-banner h2 {
    font-size: 24px;
    margin-bottom: 10px;
    max-width: 80%;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(249, 115, 22, 0.4);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

/* AI Content Studio */
.ai-studio-panel {
    background: var(--gradient-1);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 30px;
}

.ai-studio-panel h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.script-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.script-btn {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
}

.script-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.script-btn h4 {
    font-size: 16px;
    margin-bottom: 5px;
}

.script-btn p {
    font-size: 12px;
    opacity: 0.8;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px 25px;
    display: none;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow);
    z-index: 2000;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

.toast.show {
    display: flex;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Mobile Category Nav */
.mobile-cat-nav {
    display: none;
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px 0;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

.mobile-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 25px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
    transition: all 0.2s;
}

.mobile-cat-pill:hover,
.mobile-cat-pill.active {
    background: var(--gradient-2);
    color: white;
    border-color: transparent;
}

/* Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(18, 18, 26, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 1000;
    justify-content: space-around;
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.2s ease;
    min-width: 60px;
    gap: 4px;
}

.bottom-nav .nav-item i {
    font-size: 20px;
}

.bottom-nav .nav-item span {
    font-size: 10px;
}

.bottom-nav .nav-item:hover,
.bottom-nav .nav-item.active {
    color: var(--accent);
}

.bottom-nav .nav-item.active {
    background: rgba(249, 115, 22, 0.15);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
        padding-bottom: 100px;
    }

    .mobile-cat-nav {
        display: flex;
    }

    .bottom-nav {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 18px;
    }

    .stat-value {
        font-size: 24px;
    }

    .news-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .news-card {
        padding: 18px;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .hot-topic-banner {
        padding: 20px;
    }

    .hot-topic-banner h2 {
        font-size: 18px;
        max-width: 100%;
    }

    .hot-topic-banner::before {
        display: none;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .script-buttons {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .script-btn {
        padding: 15px;
    }

    .modal-content {
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
    }
}

@media (max-width: 380px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .script-buttons {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

/* Dark mode fixes */
a {
    color: inherit;
}

input,
textarea,
select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 15px;
    color: var(--text-primary);
    font-size: 14px;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Mobile Optimizations */
@media (max-width: 768px) {

    /* Main Layout */
    .section-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }

    .recommendation-list .news-grid {
        display: flex;
        /* Switch to horizontal scroll for recs on mobile */
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 20px;
        gap: 15px;
        margin-right: -15px;
        /* Offset parent padding */
        padding-right: 15px;
    }

    .recommendation-list .news-card {
        min-width: 280px;
        /* Fixed width for scrolling cards */
        scroll-snap-align: start;
        margin-bottom: 0 !important;
        flex-direction: column;
    }

    /* Better Touch Targets */
    .btn {
        padding: 14px 20px;
        /* Larger hit area */
        font-size: 15px;
    }

    .nav-item {
        padding: 10px 5px !important;
        /* Larger bottom nav targets */
    }

    /* Headlines */
    .page-header h1 {
        font-size: 24px;
        line-height: 1.3;
    }

    /* Form Elements */
    input,
    textarea,
    select {
        font-size: 16px;
        /* Prevent iOS zoom */
        padding: 12px;
    }
}

/* Full Screen Editor Modal */
.modal-content.large-editor {
    width: 95vw;
    height: 90vh;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    padding: 0;
    /* Let toolbar sit flush */
}

.modal-content.large-editor .modal-header {
    background: var(--bg-card);
    padding: 15px 25px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-content.large-editor .modal-body {
    flex-grow: 1;
    padding: 0;
    overflow: hidden;
    /* Container handles scroll */
    display: flex;
    flex-direction: column;
    background: #0f0f1a;
}

.modal-content.large-editor .modal-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}

/* Quill Editor Customization (Dark Theme) */
.ql-toolbar.ql-snow {
    background: #f1f5f9;
    /* Light toolbar for contrast */
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
}

.ql-container.ql-snow {
    border: none !important;
    background: #0f0f1a;
    color: #e2e8f0;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    flex-grow: 1;
}

.ql-editor {
    padding: 30px;
    /* Document feel */
    line-height: 1.8;
}

/* Fix Scrollbar in Editor */
.ql-editor::-webkit-scrollbar {
    width: 8px;
}

.ql-editor::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}