/**
 * News Portal - Google News Style
 */

/* ========================================
   Root Variables
   ======================================== */
:root {
    --nav-height: 60px;
    --category-tabs-height: 50px;
    --transition-speed: 0.2s;
}

/* Light Theme */
[data-bs-theme="light"] {
    --bs-body-bg: #ffffff;
    --bs-card-bg: #ffffff;
    --nav-bg: #ffffff;
    --nav-border: #e0e0e0;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-tertiary: #80868b;
    --hover-bg: #f8f9fa;
    --card-border: #e0e0e0;
    --category-tab-hover: #f1f3f4;
}

/* Dark Theme */
[data-bs-theme="dark"] {
    --bs-body-bg: #202124;
    --bs-card-bg: #292a2d;
    --nav-bg: #292a2d;
    --nav-border: #3c4043;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --text-tertiary: #5f6368;
    --hover-bg: #3c4043;
    --card-border: #3c4043;
    --category-tab-hover: #3c4043;
}

/* ========================================
   General Styles
   ======================================== */
body {
    padding-top: calc(var(--nav-height) + var(--category-tabs-height));
    background-color: var(--bs-body-bg);
    color: var(--text-primary);
    font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    transition: background-color var(--transition-speed);
}

/* ========================================
   Navigation
   ======================================== */
.navbar {
    background-color: var(--nav-bg) !important;
    border-bottom: 1px solid var(--nav-border);
    height: var(--nav-height);
    padding: 0.5rem 0;
}

.navbar-brand {
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--text-primary) !important;
}

/* ========================================
   Category Tabs (Google News Style)
   ======================================== */
.category-tabs-container {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    z-index: 1020;
    height: var(--category-tabs-height);
}

.category-tabs {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    height: 100%;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.category-tab {
    padding: 12px 24px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-speed);
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    user-select: none;
}

.category-tab:hover {
    background-color: var(--category-tab-hover);
    color: var(--text-primary);
}

.category-tab.active {
    color: var(--bs-primary);
    border-bottom-color: var(--bs-primary);
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 2rem;
}

/* ========================================
   Section Titles
   ======================================== */
.section-title {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--nav-border);
}

/* ========================================
   Top Stories Section (Featured Layout)
   ======================================== */
.top-stories-section {
    margin-bottom: 3rem;
}

.story-card {
    background-color: var(--bs-card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow var(--transition-speed);
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.story-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.story-card-image {
    width: 100%;
    height: 220px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.story-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-card-image .placeholder-icon {
    font-size: 3rem;
    color: rgba(255,255,255,0.3);
}

.story-card-content {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.story-card-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.story-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

.story-card-source {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.story-card-time {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.story-card-category {
    margin-left: auto;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background-color: var(--bs-primary);
    color: white;
    border-radius: 4px;
    text-transform: capitalize;
}

/* ========================================
   More News Section (List Layout)
   ======================================== */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.news-list-item {
    background-color: var(--bs-card-bg);
    border: 1px solid var(--card-border);
    border-bottom: none;
    padding: 1rem;
    cursor: pointer;
    transition: background-color var(--transition-speed);
}

.news-list-item:first-child {
    border-radius: 8px 8px 0 0;
}

.news-list-item:last-child {
    border-radius: 0 0 8px 8px;
    border-bottom: 1px solid var(--card-border);
}

.news-list-item:only-child {
    border-radius: 8px;
    border-bottom: 1px solid var(--card-border);
}

.news-list-item:hover {
    background-color: var(--hover-bg);
}

.news-item-content {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.news-item-text {
    flex: 1;
}

.news-item-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.news-item-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.news-item-source {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.news-item-time {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.news-item-category {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    background-color: var(--bs-primary);
    color: white;
    border-radius: 4px;
    text-transform: capitalize;
}

.news-item-thumbnail {
    width: 120px;
    height: 80px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.news-item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-item-thumbnail .placeholder-icon {
    font-size: 1.5rem;
    color: rgba(255,255,255,0.3);
}

/* ========================================
   Theme Toggle
   ======================================== */
#themeToggle {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-color: var(--nav-border);
    background-color: transparent;
    color: var(--text-primary);
}

#themeToggle:hover {
    background-color: var(--hover-bg);
}

/* ========================================
   Search Box (Centered above content)
   ======================================== */
.search-container {
    max-width: 800px;
    margin: 0 auto 2rem auto;
}

.search-form {
    width: 100%;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--bs-card-bg);
    border: 2px solid var(--card-border);
    border-radius: 50px;
    padding: 8px 12px;
    transition: all var(--transition-speed);
}

.search-input-wrapper:focus-within {
    border-color: var(--bs-primary);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.15);
}

.search-icon {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-right: 12px;
    margin-left: 8px;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 12px;
    font-size: 1rem;
    color: var(--text-primary);
}

.search-input:focus {
    outline: none;
    box-shadow: none;
    background: transparent;
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.search-button {
    border-radius: 50px;
    padding: 8px 24px;
    font-weight: 500;
    margin-left: 8px;
}

/* ========================================
   Search (Old navbar styles - kept for compatibility)
   ======================================== */
.form-control {
    background-color: var(--bs-card-bg);
    border-color: var(--nav-border);
    color: var(--text-primary);
}

.form-control:focus {
    background-color: var(--bs-card-bg);
    border-color: var(--bs-primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

/* ========================================
   Pagination
   ======================================== */
.pagination {
    margin-top: 2rem;
}

.page-link {
    background-color: var(--bs-card-bg);
    border-color: var(--card-border);
    color: var(--text-primary);
    border-radius: 8px;
    margin: 0 4px;
}

.page-link:hover {
    background-color: var(--hover-bg);
    border-color: var(--bs-primary);
    color: var(--bs-primary);
}

.page-item.active .page-link {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* ========================================
   Footer
   ======================================== */
footer {
    background-color: var(--nav-bg);
    border-top: 1px solid var(--nav-border);
}

/* ========================================
   Modal
   ======================================== */
.modal-content {
    background-color: var(--bs-card-bg);
    border: 1px solid var(--card-border);
}

.modal-header,
.modal-footer {
    border-color: var(--card-border);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .main-content {
        padding-top: 1rem;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .story-card-image {
        height: 180px;
    }
    
    .story-card-title {
        font-size: 1rem;
    }
    
    .news-item-thumbnail {
        width: 100px;
        height: 67px;
    }
    
    .category-tab {
        padding: 12px 16px;
        font-size: 13px;
    }
}

@media (max-width: 576px) {
    .news-item-thumbnail {
        width: 80px;
        height: 53px;
    }
    
    .news-item-title {
        font-size: 0.95rem;
    }
}

/* ========================================
   Loading States
   ======================================== */
.spinner-border {
    animation: spinner-border 0.75s linear infinite;
}

/* ========================================
   Alerts
   ======================================== */
.alert {
    border-radius: 8px;
}
