/**
 * QuantumComputer.blog Highlights - Styles
 * Modern, clean, responsive design with light/dark theme support
 * Header and Footer matching bulkcalculator.com style
 */

/* ============================================
   CSS Variables & Theme Configuration
   ============================================ */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #0ea5e9;
    --accent: #22d3ee;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #0f172a;
    --dark-light: #1e293b;
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --white: #ffffff;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    --gradient-3: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* Light theme specific */
    --bg-primary: var(--white);
    --bg-secondary: var(--gray-50);
    --bg-card: var(--white);
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --border-color: var(--gray-200);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: var(--dark);
    --bg-secondary: var(--dark-light);
    --bg-card: var(--dark-light);
    --text-primary: var(--gray-100);
    --text-secondary: var(--gray-400);
    --border-color: var(--gray-700);
}

/* ============================================
   Reset & Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* ============================================
   Header Styles (Matching WSD Tools)
   ============================================ */
.header {
    background: var(--dark);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--white);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.logo span {
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navigation */
.nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--gray-300);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--white);
    background: var(--dark-light);
}

.nav-link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.nav-item:hover .nav-link svg {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 260px;
    background: var(--dark-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    padding: 0.5rem;
    z-index: 100;
}

.nav-item:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(5px);
}

.dropdown-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--gray-300);
    font-size: 0.875rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.dropdown-link:hover {
    background: var(--primary);
    color: var(--white);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--white);
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
    background: var(--gradient-2);
    padding: 4rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.hero-content {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    color: var(--white);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: rgba(255, 255, 255, 0.9);
    max-width: 700px;
    margin: 0 auto 2rem;
}

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

/* Hero Search */
.search-container-hero {
    position: relative;
    width: 100%;
    max-width: 500px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--gray-400);
    pointer-events: none;
}

.search-input-hero {
    width: 100%;
    height: 50px;
    padding: 0 50px 0 50px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    color: var(--white);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input-hero::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-input-hero:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.search-clear {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    border-radius: 50%;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.search-input-hero:not(:placeholder-shown) + .search-clear {
    opacity: 1;
    visibility: visible;
}

.search-clear:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.2);
}

/* Hero Buttons */
.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-hero {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: var(--white);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.btn-hero:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-hero svg {
    width: 18px;
    height: 18px;
}

.btn-hero.btn-outline {
    background: transparent;
}

/* Theme Toggle Icons */
#themeToggle .icon-moon {
    display: none;
}

[data-theme="dark"] #themeToggle .icon-sun {
    display: none;
}

[data-theme="dark"] #themeToggle .icon-moon {
    display: block;
}

/* Refresh Animation */
#refreshBtn.refreshing svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ============================================
   Breadcrumb
   ============================================ */
.breadcrumb {
    background: var(--bg-primary);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.breadcrumb-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.breadcrumb a {
    color: var(--primary);
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ============================================
   Main Content
   ============================================ */
.main {
    flex: 1;
    padding: 2rem 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.status-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-count {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* ============================================
   Posts Grid
   ============================================ */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* Post Card */
.post-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.post-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--gray-100);
}

[data-theme="dark"] .post-card-image {
    background: var(--gray-800);
}

.post-card-image.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.post-card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.post-category {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: var(--primary);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 50px;
}

.post-category.stocks {
    background: var(--success);
}

.post-category.research {
    background: var(--warning);
}

.post-date {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.post-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-title a {
    transition: color 0.2s ease;
}

.post-card-title a:hover {
    color: var(--primary);
}

.post-card-summary {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    margin-bottom: 1rem;
}

.post-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.post-author {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.post-author strong {
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-more {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: var(--gradient-3);
    color: var(--white);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.btn-more:hover {
    transform: translateX(3px);
    box-shadow: var(--shadow-md);
}

.btn-more svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.btn-more:hover svg {
    transform: translateX(3px);
}

/* ============================================
   Skeleton Loader
   ============================================ */
.skeleton-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}

[data-theme="dark"] .skeleton-image {
    background: linear-gradient(90deg, var(--gray-800) 25%, var(--gray-700) 50%, var(--gray-800) 75%);
    background-size: 200% 100%;
}

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

.skeleton-content {
    padding: 1.5rem;
}

.skeleton-line {
    height: 14px;
    background: var(--gray-200);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}

[data-theme="dark"] .skeleton-line {
    background: var(--gray-700);
}

.skeleton-line.short { width: 30%; }
.skeleton-line.medium { width: 60%; }
.skeleton-line.title { height: 20px; width: 85%; margin-bottom: 1rem; }

/* ============================================
   Error & No Results
   ============================================ */
.error-container {
    text-align: center;
    padding: 3rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.no-results h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--gradient-2);
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Load More */
.load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

#loadMoreBtn.loading {
    pointer-events: none;
    opacity: 0.7;
}

#loadMoreBtn.loading span {
    display: none;
}

#loadMoreBtn.loading::before {
    content: 'Loading...';
}

/* ============================================
   Footer (Matching WSD Tools)
   ============================================ */
.footer {
    background: var(--dark);
    color: var(--gray-300);
    padding: 3rem 1.5rem 1.5rem;
    margin-top: auto;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    color: var(--white);
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-section p {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--gray-400);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    font-size: 0.875rem;
    color: var(--gray-400);
    transition: color 0.2s ease;
}

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

.footer-bottom {
    max-width: 1400px;
    margin: 2rem auto 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-700);
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* ============================================
   Back to Top
   ============================================ */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--gradient-2);
    border: none;
    border-radius: 50%;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-5px);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 992px) {
    .nav {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--dark);
        flex-direction: column;
        padding: 1rem;
        gap: 0;
        transform: translateY(-150%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-xl);
    }

    .nav.active {
        transform: translateY(0);
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        width: 100%;
        justify-content: space-between;
        padding: 1rem;
    }

    .dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
        background: var(--dark);
        box-shadow: none;
        padding: 0 0 0 1rem;
    }

    .nav-item.active .dropdown {
        display: block;
    }

    .menu-toggle {
        display: flex;
    }

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

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

    .menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 3rem 1rem;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
    }

    .btn-hero {
        width: 100%;
        justify-content: center;
    }

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

    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .status-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

@media (max-width: 480px) {
    .header-container {
        height: 60px;
    }

    .logo {
        font-size: 1.25rem;
    }

    .logo-icon {
        width: 35px;
        height: 35px;
    }

    .logo span {
        display: none;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .search-container-hero {
        max-width: 100%;
    }

    .search-input-hero {
        height: 45px;
        font-size: 0.9rem;
    }

    .theme-text {
        display: none;
    }

    .post-card-content {
        padding: 1rem;
    }

    .post-card-title {
        font-size: 1rem;
    }

    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 44px;
        height: 44px;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .header,
    .footer,
    .back-to-top,
    .btn-more,
    .hero-actions,
    .menu-toggle {
        display: none !important;
    }
    
    .hero {
        background: none !important;
        color: #000 !important;
        padding: 1rem 0;
    }

    .hero h1, .hero p {
        color: #000 !important;
    }

    .posts-grid {
        display: block;
    }

    .post-card {
        break-inside: avoid;
        margin-bottom: 1rem;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
