/*
Theme Name: Flavor
Theme URI: https://flavor.theme
Author: RTECH
Author URI: https://rtech.dev
Description: A clean, fast, and responsive WordPress theme with professional design.
Version: 1.0.2
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: flavor
Tags: blog, one-column, two-columns, custom-menu, featured-images, responsive-layout, minimalist
*/

/* ===== CSS Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primary: #3b82f6;
    --color-primary-dark: #2563eb;
    --color-text: #1e293b;
    --color-text-light: #64748b;
    --color-bg: #ffffff;
    --color-bg-alt: #f8fafc;
    --color-bg-body: #f1f5f9;
    --color-border: #e2e8f0;
    --color-accent: #10b981;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --max-width: 1400px;
    --content-width: 100%;
    --sidebar-width: 300px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.1);
    --transition: 0.2s ease;
}

/* Dark Mode */
html.dark-mode {
    --color-primary: #60a5fa;
    --color-primary-dark: #93c5fd;
    --color-text: #f1f5f9;
    --color-text-light: #94a3b8;
    --color-bg: #1e293b;
    --color-bg-alt: #334155;
    --color-bg-body: #0f172a;
    --color-border: #475569;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.4);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg-body);
    line-height: 1.6;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--color-primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== Typography ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-text);
    margin-bottom: 0.5em;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: 1.125rem;
}

h6 {
    font-size: 1rem;
}

p {
    margin-bottom: 1.25em;
}

/* ===== Layout ===== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 100px;
}

.site-layout {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: 2rem;
    align-items: start;
}

/* Layout Variations */
body.layout-left-sidebar .site-layout {
    grid-template-columns: var(--sidebar-width) 1fr;
}

body.layout-left-sidebar .primary-content {
    grid-column: 2;
    grid-row: 1;
}

body.layout-left-sidebar .sidebar {
    grid-column: 1;
    grid-row: 1;
}

body.layout-full-width .site-layout {
    grid-template-columns: 1fr;
}

body.layout-full-width .sidebar {
    display: none;
}

.primary-content {
    background: var(--color-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.content-area {
    max-width: var(--content-width);
    margin: 0 auto;
}

/* ===== Header ===== */
.site-header {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.02em;
}

.site-title a {
    color: var(--color-text);
}

.site-title a:hover {
    color: var(--color-primary);
}

.site-description {
    display: none;
}

/* ===== Navigation ===== */
.main-navigation ul {
    display: flex;
    list-style: none;
    gap: 0.25rem;
}

.main-navigation a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.9375rem;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.main-navigation a:hover,
.main-navigation .current-menu-item a {
    background: var(--color-bg-alt);
    color: var(--color-primary);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    margin: 5px 0;
    transition: var(--transition);
}

/* ===== Main Content ===== */
.site-main {
    padding: 3rem 0;
    min-height: calc(100vh - 70px - 200px);
}

/* ===== Posts Grid ===== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.25rem;
}

/* ===== Article Card ===== */
.article-card {
    background: var(--color-bg);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.article-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}

.article-thumbnail {
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--color-bg-alt);
    display: block;
}

.article-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.article-card:hover .article-thumbnail img {
    transform: scale(1.05);
}

/* Placeholder Thumbnail */
.article-thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
    transition: transform 0.3s ease;
}

.article-card:hover .article-thumbnail-placeholder {
    transform: scale(1.02);
}

.placeholder-title {
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.article-content {
    padding: 0.75rem;
}

.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
}

.article-meta time {
    white-space: nowrap;
}

.article-category {
    background: var(--color-primary);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.article-title {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-title a {
    color: var(--color-text);
}

.article-title a:hover {
    color: var(--color-primary);
}

.article-excerpt {
    display: none;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.read-more svg {
    transition: transform var(--transition);
}

.read-more:hover svg {
    transform: translateX(3px);
}

/* ===== Single Post ===== */
.single-post {
    max-width: 100%;
    margin: 0;
}

.post-header {
    text-align: left;
    margin-bottom: 2rem;
}

.post-header .article-meta {
    justify-content: flex-start;
    margin-bottom: 1rem;
}

.post-title {
    font-size: 2.5rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.featured-image {
    margin-bottom: 2.5rem;
    border-radius: var(--radius);
    overflow: hidden;
}

.featured-image img {
    width: 100%;
}

.post-content {
    font-size: 1.0625rem;
    line-height: 1.8;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    margin-top: 2em;
}

.post-content blockquote {
    border-left: 4px solid var(--color-primary);
    padding: 1rem 1.5rem;
    margin: 1.5em 0;
    background: var(--color-bg-alt);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
}

.post-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1.25rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    margin: 1.5em 0;
}

.post-content code {
    font-family: var(--font-mono);
    background: var(--color-bg-alt);
    padding: 0.125em 0.375em;
    border-radius: 4px;
    font-size: 0.9em;
}

.post-content pre code {
    background: none;
    padding: 0;
}

.post-content ul,
.post-content ol {
    margin: 1.25em 0;
    padding-left: 1.5em;
}

.post-content li {
    margin-bottom: 0.5em;
}

.post-content img {
    border-radius: var(--radius);
    margin: 1.5em 0;
}

/* ===== Post Footer ===== */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.post-tags a {
    background: var(--color-bg-alt);
    color: var(--color-text-light);
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all var(--transition);
}

.post-tags a:hover {
    background: var(--color-primary);
    color: white;
}

/* ===== Author Box ===== */
.author-box {
    display: flex;
    gap: 1.5rem;
    padding: 2rem;
    background: var(--color-bg-alt);
    border-radius: calc(var(--radius) * 1.5);
    margin-top: 2.5rem;
}

.author-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

.author-info h4 {
    margin-bottom: 0.375rem;
}

.author-info p {
    color: var(--color-text-light);
    font-size: 0.9375rem;
    margin: 0;
}

/* ===== Comments ===== */
.comments-area {
    margin-top: 3rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--color-border);
}

.comments-title {
    margin-bottom: 1.5rem;
}

.comment-list {
    list-style: none;
}

.comment {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.comment-author img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.comment-author .fn {
    font-weight: 600;
}

.comment-meta {
    font-size: 0.8125rem;
    color: var(--color-text-light);
}

.comment-content p {
    margin: 0;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color var(--transition);
    margin-bottom: 1rem;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.comment-form textarea {
    min-height: 150px;
    resize: vertical;
}

.comment-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.375rem;
}

.comment-form .submit {
    background: var(--color-primary);
    color: white;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}

.comment-form .submit:hover {
    background: var(--color-primary-dark);
}

/* ===== Sidebar ===== */
.sidebar {
    position: sticky;
    top: 90px;
    background: var(--color-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.widget {
    margin-bottom: 2rem;
}

.widget:last-child {
    margin-bottom: 0;
}

.widget-title {
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-primary);
}

.widget ul {
    list-style: none;
}

.widget li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.widget li:last-child {
    border-bottom: none;
}

.widget li a {
    color: var(--color-text);
    font-size: 0.9rem;
}

.widget li a:hover {
    color: var(--color-primary);
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    transition: all var(--transition);
}

.pagination a {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.pagination a:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.pagination .current {
    background: var(--color-primary);
    color: white;
}

/* ===== Footer ===== */
.site-footer {
    background: var(--color-text);
    color: rgba(255, 255, 255, 0.8);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
}

.footer-widgets {
    display: grid;
    grid-template-columns: 1.5fr repeat(3, 1fr);
    gap: 2.5rem;
    margin-bottom: 3rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-brand {
    padding-right: 2rem;
}

.footer-logo {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.footer-logo a {
    color: white;
}

.footer-tagline {
    font-size: 0.9rem;
    opacity: 0.7;
    margin: 0;
}

.footer-widget-title {
    color: white;
    font-size: 0.9375rem;
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: white;
}

.footer-newsletter-text {
    font-size: 0.875rem;
    opacity: 0.7;
    margin-bottom: 1rem;
}

.newsletter-form {
    display: flex;
    gap: 0.5rem;
}

.newsletter-form input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.875rem;
}

.newsletter-form input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.newsletter-form input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.newsletter-form button {
    padding: 0.625rem 0.875rem;
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
    transition: background var(--transition);
}

.newsletter-form button:hover {
    background: var(--color-primary-dark);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.copyright {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8125rem;
    margin: 0;
}

.copyright a {
    color: white;
}

.footer-social {
    display: flex;
    gap: 0.5rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    transition: all var(--transition);
}

.social-link:hover {
    background: var(--color-primary);
    color: white;
}

.meta-separator {
    color: var(--color-text-light);
}

/* ===== 404 Page ===== */
.error-404 {
    text-align: center;
    padding: 4rem 0;
}

.error-404 h1 {
    font-size: 8rem;
    color: var(--color-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.error-404 h2 {
    margin-bottom: 1rem;
}

.error-404 p {
    color: var(--color-text-light);
    margin-bottom: 2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-primary);
    color: white;
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius);
    font-weight: 600;
    transition: background var(--transition);
}

.btn:hover {
    background: var(--color-primary-dark);
    color: white;
}

/* ===== Page Template ===== */
.page-header {
    text-align: center;
    padding: 2rem 0 3rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 3rem;
}

.page-title {
    font-size: 2.5rem;
    letter-spacing: -0.02em;
}

.archive-description {
    color: var(--color-text-light);
    max-width: 600px;
    margin: 1rem auto 0;
}

/* ===== Breadcrumbs ===== */
.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    font-size: 0.8125rem;
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--color-bg-alt);
    border-radius: var(--radius-sm);
}

.breadcrumbs a {
    color: var(--color-text-light);
    transition: color var(--transition);
}

.breadcrumbs a:hover {
    color: var(--color-primary);
}

.breadcrumbs .separator {
    display: flex;
    align-items: center;
    color: var(--color-border);
}

.breadcrumbs .current {
    color: var(--color-text);
    font-weight: 500;
}

/* ===== Social Share ===== */
.social-share {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.share-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text);
}

.share-buttons {
    display: flex;
    gap: 0.5rem;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-bg-alt);
    color: var(--color-text-light);
    transition: all var(--transition);
}

.share-btn:hover {
    transform: translateY(-2px);
}

.share-facebook:hover {
    background: #1877f2;
    color: white;
}

.share-twitter:hover {
    background: #000;
    color: white;
}

.share-whatsapp:hover {
    background: #25d366;
    color: white;
}

.share-telegram:hover {
    background: #0088cc;
    color: white;
}

.share-copy:hover {
    background: var(--color-primary);
    color: white;
}

.share-copy.copied {
    background: var(--color-accent);
    color: white;
}

/* ===== Related Posts ===== */
.related-posts {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.related-title {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.related-item {
    display: block;
    background: var(--color-bg-alt);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: all var(--transition);
}

.related-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.related-thumbnail {
    aspect-ratio: 16/10;
    overflow: hidden;
}

.related-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    text-align: center;
}

.related-placeholder span {
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.related-info {
    padding: 0.75rem;
}

.related-info h4 {
    font-size: 0.8125rem;
    margin: 0 0 0.25rem;
    line-height: 1.4;
    color: var(--color-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-info time {
    font-size: 0.6875rem;
    color: var(--color-text-light);
}

/* ===== Popular Posts ===== */
.popular-posts {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.popular-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--color-bg-alt);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.popular-item:hover {
    background: var(--color-bg);
    box-shadow: var(--shadow-sm);
}

.popular-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    border-radius: 50%;
}

.popular-info h4 {
    font-size: 0.8125rem;
    margin: 0 0 0.25rem;
    line-height: 1.4;
    color: var(--color-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-info time {
    font-size: 0.6875rem;
    color: var(--color-text-light);
}

/* ===== Dark Mode Toggle ===== */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--color-bg-alt);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--color-text);
}

.dark-mode-toggle:hover {
    background: var(--color-border);
}

.dark-mode-toggle .icon-sun,
.dark-mode-toggle .icon-moon {
    width: 20px;
    height: 20px;
}

.dark-mode-toggle .icon-moon {
    display: block;
}

.dark-mode-toggle .icon-sun {
    display: none;
}

/* ===== Dark Mode Styles ===== */
html.dark-mode {
    --color-primary: #60a5fa;
    --color-primary-dark: #3b82f6;
    --color-text: #f8fafc;
    --color-text-light: #94a3b8;
    --color-bg: #121212;
    --color-bg-alt: #1a1a1a;
    --color-bg-body: #000000;
    --color-border: #333333;
}

html.dark-mode .site-header {
    background: rgba(18, 18, 18, 0.95);
    border-bottom: 1px solid var(--color-border);
}

html.dark-mode .site-footer {
    background: #000000;
    border-top: 1px solid var(--color-border);
}

html.dark-mode .footer-widgets {
    border-bottom: 1px solid #333;
}

html.dark-mode .newsletter-form input {
    background: #222;
    border-color: #333;
}

html.dark-mode .social-link {
    background: #222;
}

html.dark-mode .social-link:hover {
    background: var(--color-primary);
}

html.dark-mode .dark-mode-toggle .icon-moon {
    display: none;
}

html.dark-mode .dark-mode-toggle .icon-sun {
    display: block;
}


/* ===== Search Form ===== */
.search-form {
    width: 100%;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: all var(--transition);
}

.search-input-wrapper:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-form .search-field {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--color-text);
    outline: none;
}

.search-form .search-field::placeholder {
    color: var(--color-text-light);
}

.search-form .search-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem 0.625rem 0.5rem;
    background: transparent;
    border: none;
    color: var(--color-text-light);
    cursor: pointer;
    transition: color var(--transition);
}

.search-form .search-submit:hover {
    color: var(--color-primary);
}

/* ===== Responsive ===== */
@media (min-width: 1600px) {
    .container {
        padding: 0 4rem;
    }
}

@media (max-width: 1400px) {
    .container {
        padding: 0 5rem;
    }

    .posts-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1200px) {
    .container {
        padding: 0 3.5rem;
    }

    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .site-layout {
        grid-template-columns: 1fr 280px;
        gap: 1.5rem;
    }
}

@media (max-width: 992px) {
    .container {
        padding: 0 2.5rem;
    }

    .site-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .sidebar {
        position: static;
    }

    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .primary-content {
        padding: 1rem;
        border-radius: var(--radius-sm);
    }

    .sidebar {
        padding: 1rem;
        border-radius: var(--radius-sm);
    }
}

@media (max-width: 768px) {
    :root {
        --max-width: 100%;
    }

    h1,
    .post-title {
        font-size: 1.875rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .header-inner {
        height: 60px;
    }

    .site-title {
        font-size: 1.25rem;
    }

    .menu-toggle {
        display: block;
    }

    .main-navigation {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--color-bg);
        border-bottom: 1px solid var(--color-border);
        padding: 1rem;
    }

    .main-navigation.active {
        display: block;
    }

    .main-navigation ul {
        flex-direction: column;
        gap: 0;
    }

    .main-navigation a {
        padding: 0.75rem 1rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .related-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .social-share {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .site-main {
        padding: 2rem 0;
    }

    .author-box {
        flex-direction: column;
        text-align: center;
    }

    .error-404 h1 {
        font-size: 5rem;
    }

    .footer-widgets {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .article-content {
        padding: 1.25rem;
    }

    .footer-widgets {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* ===== WordPress Alignment Classes ===== */
.alignleft {
    float: left;
    margin-right: 1.5em;
    margin-bottom: 1em;
}

.alignright {
    float: right;
    margin-left: 1.5em;
    margin-bottom: 1em;
}

.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.alignwide {
    margin-left: -100px;
    margin-right: -100px;
    max-width: calc(100% + 200px);
}

.alignfull {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    max-width: 100vw;
    width: 100vw;
}

/* ===== Optimization & Polish ===== */

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#preloader.loaded {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--color-bg-alt);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Scroll to Top */
.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 45px;
    height: 45px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background: var(--color-primary-dark);
    transform: translateY(-3px);
}

/* Micro-interactions & Polish */
.btn-primary,
.newsletter-form button,
.search-submit,
.read-more {
    position: relative;
    overflow: hidden;
}

.btn-primary:active,
.newsletter-form button:active,
.search-submit:active {
    transform: scale(0.98);
}

/* Smooth Image Loading */
img {
    transition: opacity 0.3s ease;
}

img.lazyalert {
    opacity: 0;
}

/* Just a class name I made up, actual WP lazy loading handles classes differently usually, but we will rely on browser native loading="lazy" transparency */

/* Card Hover Polish */
.article-card {
    will-change: transform, box-shadow;
}

@media (max-width: 920px) {
    .alignwide {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }
}

/* ===== Screen Reader Text ===== */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

.screen-reader-text:focus {
    background: var(--color-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    clip: auto !important;
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    height: auto;
    left: 5px;
    padding: 1rem;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* ===== Android App Template ===== */
.app-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
}

.app-icon img {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    object-fit: cover;
}

.app-meta-header {
    flex: 1;
    min-width: 250px;
}

.app-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--color-heading);
}

.app-developer {
    color: var(--color-text-light);
    margin-bottom: 1rem;
}

.app-badges {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.app-badge {
    background: var(--color-bg-alt);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.app-badge.score {
    background: #FFD700;
    color: #333;
}

.app-badge.version {
    background: var(--color-primary);
    color: white;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: #01875f;
    /* Play Store Green */
    color: white;
    padding: 0.875rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(1, 135, 95, 0.2);
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(1, 135, 95, 0.3);
    color: white;
}

/* Gallery */
.app-gallery {
    margin: 2rem 0;
}

.gallery-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.gallery-item {
    scroll-snap-align: start;
    flex: 0 0 auto;
    width: 200px;
}

.gallery-item img {
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    width: 100%;
    height: auto;
}

/* Info Table */
.app-info-table {
    margin-top: 3rem;
    background: var(--color-bg-alt);
    border-radius: 12px;
    padding: 2rem;
}

.app-info-table table {
    width: 100%;
    border-collapse: collapse;
}

.app-info-table th,
.app-info-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.app-info-table tr:last-child th,
.app-info-table tr:last-child td {
    border-bottom: none;
}

@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        text-align: center;
    }

    .app-meta-header {
        width: 100%;
    }

    .app-badges {
        justify-content: center;
    }

    .btn-download {
        width: 100%;
        justify-content: center;
    }
}

.app-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.btn-custom-link {
    background: var(--color-primary);
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
}

.btn-custom-link:hover {
    background: var(--color-primary-dark);
    /* Ensure you have this ref or darken */
    filter: brightness(0.9);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.3);
}

/* ===== Homepage App Cards ===== */
.app-card .app-thumbnail-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    background: #f9fafb;
    position: relative;
    /* aspect-ratio: 1/1; Removed to allow flexible height but keep centered */
    min-height: 160px;
}

.app-icon-img {
    width: 90px;
    height: 90px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    object-fit: cover;
    transition: transform 0.3s ease;
}

.app-card:hover .app-icon-img {
    transform: scale(1.05);
}

.app-version-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
}

.app-card .article-content {
    text-align: center;
    padding-top: 1rem;
}

.app-card .article-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.app-card .article-meta {
    justify-content: center;
    margin-bottom: 0.5rem;
}

.app-card .read-more {
    margin: 0 auto;
    font-size: 0.9rem;
    padding: 0.4rem 1rem;
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.app-card .read-more:hover {
    background: var(--color-primary);
    color: white;
}

/* ===== App Search Form ===== */
.app-search-form {
    background: var(--color-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.app-search-form .search-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.app-search-form .search-input-group {
    flex: 2;
    min-width: 200px;
}

.app-search-form .search-field {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: var(--color-bg);
    color: var(--color-text);
}

.app-search-form .search-filter-group {
    flex: 1;
    min-width: 140px;
}

.app-search-form .search-filter {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
}

.app-search-form .search-submit-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}

.app-search-form .search-submit-btn:hover {
    background: var(--color-primary-dark);
}

/* ===== Pagination ===== */
.pagination,
.nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination .page-numbers,
.nav-links .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
}

.pagination .page-numbers:hover,
.nav-links .page-numbers:hover {
    background: var(--color-bg-alt);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.pagination .page-numbers.current,
.nav-links .page-numbers.current {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.pagination .page-numbers.dots {
    border: none;
    background: transparent;
}

/* ===== Archive Header ===== */
.archive-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.archive-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.archive-description {
    color: var(--color-text-light);
    font-size: 1.1rem;
}

@media (max-width: 600px) {
    .app-search-form .search-fields {
        flex-direction: column;
    }

    .app-search-form .search-input-group,
    .app-search-form .search-filter-group,
    .app-search-form .search-submit-btn {
        width: 100%;
    }
}