:root {
    /* Dark Mode Color Palette */
    --primary-color: #3f51b5;
    --secondary-color: #03dac6;
    --background-color: #121212;
    --surface-color: #1e1e1e;
    --card-background: #2c2c2c;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --elevation-color: rgba(255,255,255,0.05);
    
    /* Material Design Elevation Shadows */
    --shadow-1: 0 1px 3px rgba(255,255,255,0.12), 0 1px 2px rgba(255,255,255,0.24);
    --shadow-2: 0 3px 6px rgba(255,255,255,0.16), 0 3px 6px rgba(255,255,255,0.23);
    --shadow-3: 0 10px 20px rgba(255,255,255,0.19), 0 6px 6px rgba(255,255,255,0.23);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--background-color);
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-primary);
    font-weight: 400;
}

header {
    background-color: var(--surface-color);
    padding: 1rem 5%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-1);
}

.logo {
    font-size: 1.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-wrapper {
    width: 100%;
    max-width: 600px;
}

.search-container {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    z-index: 10;
}

#search-input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: none;
    border-radius: 24px;
    background-color: var(--card-background);
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-1);
}

#search-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.clear-search {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    display: none;
}

#news-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 5%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.news-card {
    background-color: var(--card-background);
    border-radius: 4px;
    box-shadow: var(--shadow-1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    overflow: hidden;
}

.news-card:hover {
    box-shadow: var(--shadow-2);
    transform: translateY(-4px);
}

.news-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.news-card-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.news-card .source {
    color: var(--secondary-color);
    font-weight: 500;
    font-size: 0.875rem;
}

.news-card h2 {
    font-size: 1.125rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-primary);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.8);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--surface-color);
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-3);
}

.modal-news-header {
    position: relative;
}

.modal-news-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
}

.modal-news-meta {
    position: absolute;
    bottom: 16px;
    left: 16px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

.modal-news-description {
    padding: 16px;
    color: var(--text-secondary);
}

.read-more-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 300px;
    padding: 12px 24px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    text-align: center;
    transition: background-color 0.3s ease;
    box-shadow: var(--shadow-2);
}

.read-more-btn:hover {
    background-color: #3949ab;
}

.close-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 32px;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 10;
}

/* Loading Indicator */
#loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.spinner {
    border: 4px solid var(--elevation-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

.hidden {
    display: none;
}

.post-details {
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 2rem auto;
    background-color: var(--surface-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-3);
}

.post-image-container {
    position: relative;
    width: 100%;
    max-height: 500px;
    overflow: hidden;
}

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

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

.post-content-wrapper {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.post-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.post-title {
    font-size: 2.5rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.meta-details {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
}

.post-tags {
    display: flex;
    gap: 0.5rem;
}

.tag {
    background-color: var(--elevation-color);
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.post-description {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 1.1rem;
}

.post-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background-color: var(--surface-color);
}

#share-buttons {
    display: flex;
    gap: 1rem;
}

.share-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

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

.post-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.post-share-section {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

#copy-shareable-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 300px;
    padding: 12px 24px;
    background-color: var(--surface-color);
    color: var(--text-primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    box-shadow: var(--shadow-1);
}

#copy-shareable-link:hover {
    background-color: var(--card-background);
}

#copy-shareable-link i {
    font-size: 1rem;
}

.back-button-icon {
    display: inline-block;
    padding: 1rem 5%;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.5rem;
    transition: color 0.3s ease;
}

.back-button-icon:hover {
    color: var(--primary-color);
}

/* Accessibility Additions */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.shareable-link-section {
    display: flex;
    align-items: center;
    margin-top: 1rem;
    background-color: var(--card-background);
    border-radius: 4px;
    overflow: hidden;
}

.shareable-link-section input {
    flex-grow: 1;
    padding: 0.5rem;
    background-color: var(--card-background);
    color: var(--text-primary);
    border: none;
    outline: none;
}

.shareable-link-section button {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.shareable-link-section button:hover {
    color: var(--primary-color);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--surface-color);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 4px;
    box-shadow: var(--shadow-2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 2000;
}

.toast.show {
    opacity: 1;
    visibility: visible;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .post-details {
        margin: 1rem;
    }

    .post-content-wrapper {
        padding: 1.5rem;
    }

    .post-title {
        font-size: 2rem;
    }

    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

.back-button {
    display: block;
    padding: 1rem 5%;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1rem;
}

.back-button i {
    margin-right: 0.5rem;
}

.no-post-found {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.no-post-found i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}