/* Base styles and variables */
:root {
    --primary-color: #007AFF;
    --background-color: #F5F5F7;
    --text-color: #1D1D1F;
    --card-background: #FFFFFF;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --secondary-text: #666;
    --border-color: rgba(0, 0, 0, 0.1);
}

/* Dark theme variables */
[data-theme="dark"] {
    --primary-color: #0A84FF;
    --background-color: #1C1C1E;
    --text-color: #FFFFFF;
    --card-background: #2C2C2E;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    --secondary-text: #8E8E93;
    --border-color: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.5;
}

/* Header and Navigation */
header {
    background: var(--card-background);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.logo:hover {
    color: var(--primary-color);
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    margin-left: 2rem;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Search Container */
.search-container {
    display: flex;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

#searchInput {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-background);
    color: var(--text-color);
    font-size: 1rem;
    transition: var(--transition);
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
}

#searchInput::placeholder {
    color: var(--secondary-text);
}

#searchButton {
    padding: 0.8rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

#searchButton:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

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

/* Trending Topics */
#trending-topics {
    margin: 2rem auto 3rem;
    text-align: center;
    max-width: 1200px;
}

#trending-topics h2 {
    margin-bottom: 2rem;
    font-size: 1.8rem;
    color: var(--text-color);
}

.topics-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.8rem;
    padding: 0.8rem;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}

.topics-container::-webkit-scrollbar {
    display: none;
}

.topics-container .filter-btn {
    flex: 0 0 auto;
    min-width: 140px;
    width: calc((100% - 4rem) / 6);
    height: 70px;
    padding: 0.6rem;
    border: none;
    border-radius: 10px;
    background: var(--card-background);
    color: var(--text-color);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    white-space: nowrap;
}

.topics-container .filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.topics-container .filter-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.topics-container .filter-btn:hover::before {
    transform: scaleX(1);
}

/* Add icons for each topic */
.filter-btn::after {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.filter-btn[data-topic="Latest News"]::after { content: "📰"; }
.filter-btn[data-topic="Technology Trends"]::after { content: "💻"; }
.filter-btn[data-topic="Educational Resources"]::after { content: "📚"; }
.filter-btn[data-topic="Scientific Discoveries"]::after { content: "🔬"; }
.filter-btn[data-topic="Business Insights"]::after { content: "📈"; }
.filter-btn[data-topic="Health & Wellness"]::after { content: "🏥"; }

/* Results Container */
.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.article-card {
    display: flex;
    flex-direction: column;
    background: var(--card-background);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.article-content {
    flex: 1;
    cursor: pointer;
}

.article-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.article-image {
    width: 100%;
    height: 200px;
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.article-card:hover .article-image img {
    transform: scale(1.05);
}

.article-card h3 {
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
    line-height: 1.4;
}

.article-card p {
    color: var(--secondary-text);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--secondary-text);
}

.article-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.save-btn, .notes-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    background: transparent;
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
    z-index: 1;
}

.save-btn:hover, .notes-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Notes Panel */
#notes-panel {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    width: 300px;
    background: var(--card-background);
    padding-top: calc(70px + 2rem);
    padding-left: 2rem;
    padding-right: 2rem;
    padding-bottom: 2rem;
    box-shadow: var(--shadow);
    transform: translateX(100%);
    transition: var(--transition);
    z-index: 99;
    display: flex;
    flex-direction: column;
}

#notes-panel.visible {
    transform: translateX(0);
}

#notes-panel h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--text-color);
}

#article-notes {
    width: 100%;
    flex: 1;
    min-height: 200px;
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: none;
    font-size: 1rem;
    line-height: 1.5;
}

#save-notes {
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

#close-notes {
    padding: 0.8rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

/* Responsive adjustments for notes panel */
@media (max-width: 768px) {
    #notes-panel {
        width: 100%;
        padding-top: calc(120px + 1rem);
        padding-left: 1rem;
        padding-right: 1rem;
        padding-bottom: 1rem;
    }

    #article-notes {
        min-height: 150px;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Header adjustments */
    header {
        padding: 1rem;
    }

    nav {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        display: flex;
        width: 100%;
        justify-content: center;
        gap: 1rem;
    }

    .nav-btn {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }

    /* Search container adjustments */
    .search-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Main content adjustments */
    main {
        padding: 1rem;
    }

    /* Topics container adjustments */
    .topics-container {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.6rem;
    }

    .topics-container .filter-btn {
        min-width: calc(50% - 0.6rem);
        max-width: calc(50% - 0.6rem);
        height: 70px;
        font-size: 0.8rem;
    }

    /* Results container adjustments */
    .results-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .article-card {
        padding: 1rem;
    }

    .article-image {
        height: 150px;
    }

    /* Notes panel adjustments */
    #notes-panel {
        width: 100%;
        padding: 5rem 1rem 1rem;
    }

    /* Alerts panel adjustments */
    .alerts-panel {
        padding: 1rem;
    }

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

    .alert-item {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .alert-actions {
        width: 100%;
        justify-content: center;
    }

    .filters {
        flex-direction: column;
        align-items: center;
        padding: 0 1rem;
    }

    .filter-btn {
        width: 100%;
        max-width: 300px;
        padding: 1rem 1.5rem;
    }

    /* Show hamburger, hide nav links by default */
    .hamburger {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 250px;
        background: var(--card-background);
        flex-direction: column;
        padding: 80px 20px 20px;
        transition: var(--transition);
        box-shadow: var(--shadow);
    }

    .nav-links.active {
        right: 0;
    }

    /* Hamburger animation when active */
    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    /* Update nav styles */
    nav {
        position: relative;
    }

    .nav-btn {
        width: 100%;
        text-align: left;
        padding: 1rem;
        border-radius: 8px;
    }

    .nav-btn:hover {
        background: var(--background-color);
    }
}

/* Add styles for extra small screens */
@media (max-width: 480px) {
    .nav-links {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .nav-btn {
        width: 100%;
        text-align: center;
    }

    .filters {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }

    .filter-btn {
        width: 100%;
        max-width: 200px;
    }

    .article-card h3 {
        font-size: 1.1rem;
    }

    .article-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }

    .article-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .save-btn, .notes-btn {
        width: 100%;
    }

    .topics-container .filter-btn {
        font-size: 1rem;
        padding: 1rem;
        min-height: 90px;
    }
}

/* Add loading spinner */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid var(--background-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Add these styles to your existing CSS */
.loading, .error {
    text-align: center;
    padding: 2rem;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow);
    grid-column: 1 / -1;
}

.loading {
    color: var(--primary-color);
}

.error {
    color: #dc3545;
    border: 1px solid #ffcdd2;
}

.error p {
    margin-bottom: 0.5rem;
}

/* Alerts Panel Styles */
.alerts-panel {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.alerts-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.alerts-form input {
    flex: 1;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--background-color);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.alert-item button {
    padding: 0.5rem 1rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.info {
    text-align: center;
    padding: 2rem;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow);
    color: var(--primary-color);
}

/* Add these styles to your existing CSS file */
.nav-btn {
    background: none;
    border: none;
    color: var(--text-color);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

.nav-btn:hover {
    color: var(--primary-color);
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.primary-btn:hover {
    opacity: 0.9;
}

.alert-actions {
    display: flex;
    gap: 0.5rem;
}

.search-alert-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
}

.remove-alert-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
}

#close-notes {
    margin-top: 1rem;
    width: 100%;
    padding: 0.8rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

/* Responsive adjustments for trending topics */
@media (max-width: 1024px) {
    .topics-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .topics-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
        padding: 0.5rem;
    }

    .topics-container .filter-btn {
        min-height: 70px;
        padding: 0.6rem;
        font-size: 0.85rem;
    }

    .filter-btn::after {
        font-size: 1.2rem;
        margin-bottom: 0.3rem;
    }

    #trending-topics h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .topics-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .topics-container .filter-btn {
        min-height: 65px;
        padding: 0.6rem;
        font-size: 0.75rem;
    }

    .filter-btn::after {
        font-size: 1.1rem;
        margin-bottom: 0.2rem;
    }
}

/* Add hamburger menu styles */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 5px;
    z-index: 101;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--text-color);
    margin: 2px 0;
    transition: var(--transition);
}

/* Add content type and category badges */
.content-type-badge,
.category-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 0.5rem 0.5rem 0.5rem 0;
}

.content-type-badge {
    background: var(--primary-color);
    color: white;
}

.category-badge {
    background: #f0f0f0;
    color: var(--text-color);
}

/* Add visual feedback for clickable area */
.article-content:hover h3 {
    color: var(--primary-color);
}

/* Add theme toggle button styles */
.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--card-background);
    border: none;
    box-shadow: var(--shadow);
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* Responsive adjustments for theme toggle */
@media (max-width: 768px) {
    .theme-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Add quota exceeded specific styling */
.quota-exceeded {
    background: var(--card-background);
    border: 1px solid #ffcdd2;
    padding: 2rem;
    text-align: center;
    border-radius: 12px;
    margin: 2rem auto;
    max-width: 600px;
}

.quota-exceeded p {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.quota-exceeded p:first-child {
    font-weight: bold;
    color: #dc3545;
} 