:root {
    --bg-primary: #ffffff; /* White */
    --bg-secondary: #ffffff; /* White */
    --bg-card: #ffffff;
    --bg-card-hover: #ffffff;
    --border-color: #e2e8f0; /* Slate 200 */
    --border-color-active: rgba(99, 102, 241, 0.5);
    
    --text-primary: #0f172a; /* Slate 900 */
    --text-secondary: #334155; /* Slate 700 */
    --text-muted: #64748b; /* Slate 500 */
    
    --primary: #4f46e5; /* Indigo 600 */
    --primary-glow: rgba(79, 70, 229, 0.12);
    --secondary: #7c3aed; /* Violet 600 */
    --accent: #0891b2; /* Cyan 600 */
    --accent-red: #e11d48; /* Rose 600 */
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

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

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 5%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.logo-icon {
    color: var(--primary);
    margin-right: 0.5rem;
    filter: drop-shadow(0 2px 4px rgba(79, 70, 229, 0.3));
}

.logo-accent {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* User Profile Selector */
.user-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

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

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1.1rem;
    border-radius: 99px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: var(--transition-smooth);
}

.dropdown-trigger:hover {
    border-color: var(--border-color-active);
    background: var(--bg-secondary);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.08);
}

.avatar-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
}

.dropdown-arrow {
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 290px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 0 20px rgba(99, 102, 241, 0.04);
    list-style: none;
    padding: 0.5rem;
    display: none;
    transform-origin: top right;
    animation: dropdownSlide 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 101;
}

.dropdown.open .dropdown-menu {
    display: block;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.dropdown-item {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.dropdown-item:hover {
    background: rgba(99, 102, 241, 0.06);
}

.dropdown-item.active {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.dropdown-item-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.dropdown-item-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* Main Area */
.app-main {
    flex: 1;
    max-width: 1300px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem 5%;
}

/* Hero Section */
.profile-hero {
    position: relative;
    padding: 2.5rem;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.07), rgba(255, 255, 255, 0.85));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 2.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 700px;
}

.profile-hero h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #0f172a, #475569);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.profile-hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.hero-accent-shapes .shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.07;
    z-index: 1;
}

.circle-1 {
    background: var(--primary);
    width: 250px;
    height: 250px;
    right: 5%;
    top: -50px;
}

.circle-2 {
    background: var(--accent);
    width: 200px;
    height: 200px;
    right: 20%;
    bottom: -80px;
}

/* Recommendations Layout */
.recommendations-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    margin-bottom: 3rem;
}

@media (min-width: 900px) {
    .recommendations-container {
        grid-template-columns: 1fr 1fr;
    }
}

.rec-section {
    display: flex;
    flex-direction: column;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.icon-rec {
    color: var(--accent);
}

.icon-popular {
    color: var(--accent-red);
}

.section-badge {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    letter-spacing: 0.5px;
}

.badge-personal {
    background: rgba(8, 145, 178, 0.08);
    color: var(--accent);
    border: 1px solid rgba(8, 145, 178, 0.15);
}

.badge-popular {
    background: rgba(225, 29, 72, 0.08);
    color: var(--accent-red);
    border: 1px solid rgba(225, 29, 72, 0.15);
}

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

/* Cards */
.news-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.news-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -8px rgba(99, 102, 241, 0.15), 0 4px 6px -4px rgba(99, 102, 241, 0.08);
}

.card-meta-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.card-category {
    background: #f1f5f9; /* Slate 100 */
    color: #475569; /* Slate 600 */
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: capitalize;
}

.card-views {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--accent-red);
    font-weight: 600;
}

.news-card h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid #f1f5f9;
    padding-top: 0.6rem;
    margin-top: auto;
}

.card-publisher {
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Browse Section */
.browse-section {
    border-top: 1px solid var(--border-color);
    padding-top: 2.5rem;
    margin-top: 1.5rem;
}

.browse-header {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .browse-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.browse-header h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.icon-browse {
    color: var(--primary);
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 99px;
    padding: 0.25rem 0.5rem 0.25rem 1.1rem;
    width: 100%;
    max-width: 480px;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: var(--transition-smooth);
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
}

.search-icon {
    color: var(--text-muted);
    margin-right: 0.6rem;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    width: 100%;
    outline: none;
}

.btn-search {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 99px;
    padding: 0.45rem 1.3rem;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-search:hover {
    background: var(--secondary);
    box-shadow: 0 4px 10px rgba(124, 58, 237, 0.3);
}

/* Category Tabs */
.category-tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.8rem;
    margin-bottom: 1.5rem;
    scrollbar-width: none; /* Firefox */
}

.category-tabs::-webkit-scrollbar {
    display: none; /* Safari/Chrome */
}

.tab-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.45rem 1.1rem;
    border-radius: 99px;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: rgba(79, 70, 229, 0.06);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* News Grid */
.news-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 600px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1000px) {
    .news-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.2rem;
    margin-top: 1rem;
}

.btn-page {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: var(--transition-smooth);
}

.btn-page:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--bg-primary);
}

.btn-page:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Skeleton Loaders */
.skeleton-card {
    height: 150px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.open {
    opacity: 1;
    pointer-events: all;
}

.modal-backdrop {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 92%;
    max-width: 900px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.open .modal-content {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    z-index: 1002;
}

.modal-close:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem 3rem 1.5rem;
}

/* Modal Content Styling */
.modal-header-meta {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.3;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.modal-author-pub {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.modal-author {
    font-weight: 600;
    color: var(--text-secondary);
}

.modal-desc {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-left: 3.5px solid var(--primary);
    padding-left: 1rem;
    margin-bottom: 1.5rem;
}

.modal-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 1.5rem;
    white-space: pre-wrap; /* Preserve formatting */
}

/* Modal Recommendations (Bottom) */
.modal-recommendations {
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 3rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-height: 250px;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .modal-recommendations {
        grid-template-columns: 1fr 1fr;
        overflow-y: visible;
    }
}

.modal-rec-column h3 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.modal-rec-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.modal-rec-item {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.9rem;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: var(--transition-smooth);
}

.modal-rec-item:hover {
    background: rgba(79, 70, 229, 0.03);
    border-color: var(--primary);
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.05);
}

.modal-rec-item h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.modal-rec-item-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    display: flex;
    justify-content: space-between;
}

/* Footer */
.app-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 5%;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Detail View */
.detail-view {
    animation: detailFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes detailFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.detail-view-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 1.4rem;
    border-radius: 99px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    transition: var(--transition-smooth);
}

.btn-back:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    color: var(--primary);
    transform: translateX(-2px);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.08);
}

.detail-view-content {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem 4rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .detail-view-content {
        padding: 2rem;
    }
}

#detailBody {
    margin-bottom: 3.5rem;
}

.detail-recommendations {
    border-top: 1px solid var(--border-color);
    padding-top: 2.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
}

@media (min-width: 768px) {
    .detail-recommendations {
        grid-template-columns: 1fr 1fr;
    }
}

