/*
Theme Name: TechChallengeTheme
Theme URI: https://example.com/
Author: AI Developer
Author URI: https://example.com/
Description: A modern, tech-focused custom WordPress theme for interactive quizzes and technical blogging.
Version: 2.0.0
License: GNU General Public License v2 or later
Text Domain: techchallengetheme
*/

/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables for Theme */
:root {
    --bg-color: #fafafa;
    --surface-color: #ffffff;
    --text-primary: #111827; /* Deep slate */
    --text-secondary: #4b5563; /* Lighter slate */
    --text-tertiary: #9ca3af;
    --primary-color: #4f46e5; /* Indigo */
    --primary-hover: #4338ca;
    --border-color: #e5e7eb;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.3s ease-in-out;
}

/* Reset and basic typography */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-secondary);
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#page {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.2;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff !important;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background-color: #ef4444;
    color: #fff !important;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* Header & Navbar */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.85); /* Glassmorphism */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.site-title a {
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 32px;
    align-items: center;
}

.main-navigation a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
}

.main-navigation a:hover {
    color: var(--text-primary);
}

/* Hero Section */
.hero-section {
    padding: 100px 0 80px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background-image: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.95)), url('./assets/images/hero-bg.png');
    background-size: cover;
    background-position: center;
    margin-bottom: 60px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 16px;
    background: linear-gradient(to right, #111827, #4f46e5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Post Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
    margin-bottom: 60px;
}

.post-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: #d1d5db;
}

.post-card-image {
    width: 100%;
    height: 220px;
    overflow: hidden;
    background-color: #f3f4f6;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.post-card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.post-categories {
    margin-bottom: 16px;
}

.post-categories a {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
    padding: 4px 10px;
    border-radius: 9999px;
    margin-right: 8px;
    transition: background var(--transition-fast);
}

.post-categories a:hover {
    background: rgba(79, 70, 229, 0.2);
}

.post-card-title {
    font-size: 1.35rem;
    margin-bottom: 12px;
    line-height: 1.4;
}

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

.post-excerpt {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    flex-grow: 1;
}

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

.post-meta {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    gap: 12px;
}

.read-article-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 4px;
}

.read-article-link::after {
    content: "→";
    transition: transform var(--transition-fast);
}

.post-card:hover .read-article-link::after {
    transform: translateX(4px);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 60px;
}

.page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.page-numbers.current, .page-numbers:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Footer */
.site-footer {
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 48px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: auto;
}

/* Single Article Layout */
.single-article {
    max-width: 800px;
    margin: 40px auto 60px;
    background: var(--surface-color);
    padding: 48px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.article-header {
    margin-bottom: 32px;
    text-align: center;
}

.article-title {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

.article-featured-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin-bottom: 40px;
    display: block;
}

.article-content {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.article-content h2, .article-content h3 {
    margin-top: 2em;
    margin-bottom: 1em;
    color: var(--text-primary);
}

.article-content p {
    margin-bottom: 1.5em;
}

.article-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.article-categories a {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
    padding: 6px 14px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: background var(--transition-fast);
    margin-right: 8px;
}

.article-categories a:hover {
    background: rgba(79, 70, 229, 0.2);
}

@media (max-width: 768px) {
    .single-article {
        padding: 24px;
        margin-top: 20px;
    }
    .article-title {
        font-size: 2rem;
    }
}

/* Quiz JSON Content Formatting */
.question-title p {
    margin: 0;
    display: inline;
}

.question-title code,
.option-content code,
#modal-explanation code {
    font-size: 0.9em;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--primary-color);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.option-content p {
    margin: 0;
}

#modal-explanation p {
    margin-bottom: 1rem;
}

#modal-explanation p:last-child {
    margin-bottom: 0;
}

/* Premium Quiz UX Override styles */
.premium-quiz-backdrop {
    background: linear-gradient(180deg, rgba(79, 70, 229, 0.04) 0%, rgba(255,255,255,0) 500px);
    border-bottom: 1px solid var(--border-color);
}

.premium-card {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    border: 1px solid #f1f5f9;
}

.premium-question-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.premium-question-title p {
    margin: 0;
    display: inline;
}

.premium-options-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 760px;
    margin: 0 auto;
}

.premium-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-option:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.premium-option.selected {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.02);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.premium-radio-hidden {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.premium-option-content {
    font-size: 0.95rem;
    color: #334155;
    font-weight: 500;
    flex-grow: 1;
    padding-right: 16px;
}

.premium-option-content p {
    margin: 0;
}

.premium-option-badge {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #94a3b8;
    background: #f8fafc;
    flex-shrink: 0;
    transition: all 0.2s;
}

.premium-option.selected .premium-option-badge {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
}

/* Premium Landing Page Design */
.premium-landing-hero {
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    padding: 160px 0 120px;
    border-bottom: 1px solid var(--border-color);
}

.hero-glass-card {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.hero-tech-title {
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #0f172a 0%, #4f46e5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 24px;
}

.hero-tech-subtitle {
    font-size: 1.4rem;
    color: #475569;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

.hero-cta-group {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 48px;
    flex-wrap: wrap;
}

.btn-tech-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: #ffffff !important;
    padding: 16px 36px;
    border-radius: 99px;
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
    transition: all 0.3s ease;
    border: none;
}

.btn-tech-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 15px 25px -5px rgba(79, 70, 229, 0.4);
}

.btn-tech-outline {
    background: white;
    color: #334155 !important;
    border: 2px solid #e2e8f0;
    padding: 14px 36px;
    border-radius: 99px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.btn-tech-outline:hover {
    border-color: #cbd5e1;
    color: #0f172a !important;
    background: #f8fafc;
}

/* Premium Article Grid */
.tech-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 40px;
    margin-top: -60px; /* Overlap hero boundary */
    position: relative;
    z-index: 10;
}

.tech-post-card {
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.tech-post-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 30px -12px rgba(0, 0, 0, 0.15), 0 15px 20px -8px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.tech-post-link {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    text-decoration: none;
    color: inherit;
}

.tech-post-image {
    height: 250px;
    width: 100%;
    overflow: hidden;
    position: relative;
    background: #f1f5f9;
}

.tech-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.tech-post-card:hover .tech-post-image img {
    transform: scale(1.08);
}

.fallback-gradient {
    background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    font-weight: 800;
    color: #818cf8;
    text-transform: uppercase;
}

.tech-post-content {
    padding: 32px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    border-top: 1px solid #f1f5f9;
}

.tech-post-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 16px;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.tech-post-excerpt {
    font-size: 1.05rem;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

.tech-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 80px;
}

.tech-pagination .page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    transition: all 0.2s;
}

.tech-pagination .page-numbers.current, 
.tech-pagination .page-numbers:hover {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}
