/*
Theme Name: Bitelet
Description: A modern, scalable WordPress theme with advanced single post layouts. Features four distinct layout styles, OOP architecture, and a comprehensive admin dashboard for layout configuration.
Author: Bitelet Theme Developer
Version: 1.0.0
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: bitelet
Domain Path: /languages
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4
Tags: blog, custom-layout, featured-images, threaded-comments, translation-ready, responsive-design, custom-colors, editor-style
*/

/* ==========================================================================
   FAQ ANSWER VISIBILITY - HIGHEST PRIORITY (MUST BE FIRST)
   ========================================================================== */

/* Force hide ALL FAQ answers by default - this MUST override everything */
p.faq-answer,
p[data-answer-prefix],
p[class*="faq-answer"],
.faq-answer,
p:has([data-answer-prefix]) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    position: absolute !important;
    left: -9999px !important;
    z-index: -9999 !important;
}

/* Show answers ONLY when question is expanded */
p.faq-expanded + p.faq-answer,
p.faq-expanded + p[data-answer-prefix],
p.faq-expanded + p[class*="faq-answer"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
    margin: 1rem 0 !important;
    padding: 1.5rem !important;
    border-left: 4px solid #007bff !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06) !important;
    background: white !important;
    position: static !important;
    left: auto !important;
    z-index: auto !important;
}



/* Force hide when collapsed */
p.faq-collapsed + p.faq-answer,
p.faq-collapsed + p[data-answer-prefix],
p.faq-collapsed + p[class*="faq-answer"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    position: absolute !important;
    left: -9999px !important;
    z-index: -9999 !important;
}

/* ==========================================================================
   CSS Variables for Theme Customization
   ========================================================================== */

/* Dynamic CSS variables (fonts/colors) are injected globally by CSSGenerator.php. */
:root {
    /* Only non-color sizing/spacing defaults remain */
    --bitelet-container-width: 1200px;
    --bitelet-content-width: 800px;
    --bitelet-sidebar-width: 300px;
    --bitelet-spacing-unit: 1rem;
    --bitelet-border-radius: 8px;
    --bitelet-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --bitelet-transition: all 0.3s ease;
    
    /* Additional CSS variables for new elements */
    --bitelet-color-border-primary: #d1d5db;
    --bitelet-color-bg-secondary: #f9fafb;
    --bitelet-color-meta-text: #6b7280;
    --bitelet-color-accent: #0073aa;
    --bitelet-color-heading: #333;
}

/* ==========================================================================
   CSS Reset and Base Styles
   ========================================================================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.6;
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ==========================================================================
   Global Layout Containers
   ========================================================================== */

.bitelet-container {
    max-width: var(--bitelet-container-width);
    margin: 0 auto;
    padding: 0 var(--bitelet-spacing-unit);
}

.bitelet-content {
    max-width: var(--bitelet-content-width);
    margin: 0 auto;
}

.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-content {
    flex: 1;
}

/* ==========================================================================
   Base Typography (Structure Only)
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

/* ==========================================================================
   Lists and List Items
   ========================================================================== */

ul, ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
    line-height: 1.7;
}

ul {
    list-style-type: disc;
}

ol {
    list-style-type: decimal;
}

li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

ul ul, ol ol, ul ol, ol ul {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   Blockquotes and Citations
   ========================================================================== */

blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--bitelet-color-accent, #0073aa);
    background-color: rgba(0, 115, 170, 0.05);
    font-style: italic;
    line-height: 1.7;
}

blockquote p {
    margin-bottom: 0.75rem;
}

blockquote p:last-child {
    margin-bottom: 0;
}

blockquote cite {
    display: block;
    font-size: 0.875rem;
    color: var(--bitelet-color-meta-text, #6b7280);
    font-style: normal;
    margin-top: 0.5rem;
}

/* ==========================================================================
   Tables
   ========================================================================== */

/* WordPress Block Table */
.wp-block-table {
    margin: 1.5rem 0;
    overflow: hidden;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    background: #ffffff;
    border: 1px solid #d1d5db;
}

.wp-block-table table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: #ffffff;
}

.wp-block-table th,
.wp-block-table td {
    padding: 0.875rem 1.25rem;
    text-align: left;
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    line-height: 1.5;
    vertical-align: top;
}

.wp-block-table th {
    background: #374151;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #1f2937;
}

.wp-block-table td {
    background-color: #ffffff;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 400;
}

.wp-block-table tr:hover td {
    background-color: #f9fafb;
}

/* Remove right border from last column */
.wp-block-table th:last-child,
.wp-block-table td:last-child {
    border-right: none;
}

/* Remove bottom border from last row */
.wp-block-table tr:last-child td {
    border-bottom: none;
}

/* Standard HTML Tables */
table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    background: #ffffff;
    border: 1px solid #d1d5db;
}

th, td {
    padding: 0.875rem 1.25rem;
    text-align: left;
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    line-height: 1.5;
    vertical-align: top;
}

th {
    background: #374151;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #1f2937;
}

td {
    background-color: #ffffff;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 400;
}

tr:hover td {
    background-color: #f9fafb;
}

/* Remove right border from last column */
th:last-child,
td:last-child {
    border-right: none;
}

/* Remove bottom border from last row */
tr:last-child td {
    border-bottom: none;
}

/* Responsive tables */
@media (max-width: 768px) {
    .wp-block-table,
    table {
        margin: 1rem 0;
        border-radius: 4px;
    }
    
    .wp-block-table th,
    .wp-block-table td,
    th, td {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .wp-block-table,
    table {
        margin: 0.75rem 0;
        border-radius: 4px;
    }
    
    .wp-block-table th,
    .wp-block-table td,
    th, td {
        padding: 0.625rem 0.875rem;
        font-size: 0.8rem;
    }
}

/* ==========================================================================
   Images and Media
   ========================================================================== */

img {
    max-width: 100%;
    height: auto;
    border-radius: var(--bitelet-border-radius);
    margin-bottom: 1rem;
}

figure {
    margin: 1.5rem 0;
    text-align: center;
}

figcaption {
    font-size: 0.875rem;
    color: var(--bitelet-color-meta-text, #6b7280);
    margin-top: 0.5rem;
    font-style: italic;
}

/* ==========================================================================
   Code and Preformatted Text
   ========================================================================== */

code {
    background-color: var(--bitelet-color-bg-secondary, #f9fafb);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    color: var(--bitelet-color-accent, #0073aa);
}

pre {
    background-color: var(--bitelet-color-bg-secondary, #f9fafb);
    padding: 1rem;
    border-radius: var(--bitelet-border-radius);
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid var(--bitelet-color-border-primary, #d1d5db);
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* ==========================================================================
   FAQ Styling
   ========================================================================== */

/* FAQ Container */
.faq-section {
    margin: 2rem 0;
    padding: 0;
}

/* FAQ Title */
.faq-section h1,
.faq-section h2,
.faq-section h3,
.faq-section h4,
.faq-section h5,
.faq-section h6 {
    color: #1f2937;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}

/* FAQ Questions and Answers */
.faq-item {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.faq-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* FAQ Question */
.faq-question {
    font-weight: 700;
    font-size: 1rem;
    color: #1f2937;
    margin-bottom: 0.75rem;
    padding: 0;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.faq-question::before {
    content: "Q:";
    background: #3b82f6;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    min-width: 24px;
    text-align: center;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

/* FAQ Answer */
.faq-answer {
    color: #4b5563;
    line-height: 1.6;
    margin: 0;
    padding-left: 2rem;
    position: relative;
}

.faq-answer::before {
    content: "A:";
    background: #10b981;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    position: absolute;
    left: 0;
    top: 0;
    min-width: 24px;
    text-align: center;
}

/* Simple FAQ Styling */
/* Only styles actual FAQ content, not random bold text */

/* FAQ Auto-Detection Classes */
/* These classes are automatically added by JavaScript */

/* Professional FAQ Styling - HIGH PRIORITY */
p.faq-question,
p[class*="faq-question"],
p[data-question-prefix] {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border: 2px solid #dee2e6 !important;
    border-radius: 12px !important;
    padding: 1.25rem 1.5rem !important;
    margin-bottom: 0.75rem !important;
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    color: #2c3e50 !important;
    position: relative !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    user-select: none !important;
}

/* Tighter spacing when next answer is hidden */
p.faq-question + p.faq-answer.faq-answer-hidden {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* FAQ Chevron Icon */
.faq-chevron {
    font-size: 1.2rem !important;
    color: #007bff !important;
    font-weight: bold !important;
    transition: transform 0.3s ease !important;
    flex-shrink: 0 !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: auto !important;
}

/* FAQ Question Text */
.faq-question-text {
    flex: 1 !important;
    margin-right: 0.5rem !important;
}

/* Professional FAQ Answer Hiding - REMOVED (now handled at top of file) */

/* FAQ States */
.faq-expanded {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
    border-color: #007bff !important;
}

.faq-collapsed {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
}

.faq-collapsed:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}



p.faq-question::before,
p[class*="faq-question"]::before,
p[data-question-prefix]::before {
    content: attr(data-question-prefix, "Q:") !important;
    width: 32px !important;
    height: 32px !important;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-weight: 700 !important;
    font-size: 0.75rem !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3) !important;
    text-align: center !important;
    line-height: 1 !important;
}

.faq-question:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.15);
    color: #1565c0;
}

.faq-question:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
}

p.faq-answer,
p[class*="faq-answer"],
p[data-answer-prefix] {
    background: white !important;
    border-left: 4px solid #007bff !important;
    padding: 1.5rem 1.5rem 1.5rem 2rem !important;
    margin-bottom: 1rem !important;
    color: #495057 !important;
    line-height: 1.7 !important;
    position: relative !important;
    border-radius: 0 8px 8px 0 !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06) !important;
    transition: all 0.3s ease !important;
    margin-top: 0.5rem !important;
    margin-left: 12px !important; /* Space for the A: prefix */
    /* display property controlled by visibility rules above */
    align-items: flex-start !important;
    gap: 0.75rem !important;
    animation: slideDown 0.3s ease-out !important;
}



/* FAQ Answer Animation */
@keyframes slideDown {
    from {
        opacity: 0 !important;
        transform: translateY(-10px) !important;
    }
    to {
        opacity: 1 !important;
        transform: translateY(0) !important;
    }
}

p.faq-answer::before,
p[class*="faq-answer"]::before,
p[data-answer-prefix]::before {
    content: attr(data-answer-prefix, "A:") !important;
    width: 24px !important;
    height: 24px !important;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-weight: 700 !important;
    font-size: 0.7rem !important;
    text-align: center !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3) !important;
    position: absolute !important;
    top: 1rem !important;
    left: -12px !important;
}

.faq-answer:hover {
    border-left-color: #28a745;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transform: translateX(4px);
}



/* FAQ Container Styling */
.faq-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.faq-section h2,
.faq-section h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-weight: 700;
    font-size: 1.75rem;
    text-align: center;
    position: relative;
}

.faq-section h2::after,
.faq-section h3::after {
    content: "";
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #007bff, #28a745);
    border-radius: 2px;
}

/* Responsive FAQ Styling */
@media (max-width: 768px) {
    .faq-question {
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }
    
    .faq-answer {
        padding: 1.25rem 1.25rem 1.25rem 1.75rem;
        margin-bottom: 1.5rem;
    }
    
    .faq-section {
        padding: 1.5rem;
        margin: 1.5rem 0;
    }
    
    .faq-section h2,
    .faq-section h3 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .faq-question {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .faq-answer {
        padding: 1rem 1rem 1rem 1.5rem;
        margin-bottom: 1.25rem;
    }
    
    .faq-section {
        padding: 1.25rem;
        margin: 1.25rem 0;
    }
}

/* ==========================================================================
   Definition Lists
   ========================================================================== */

dl {
    margin-bottom: 1.5rem;
}

dt {
    font-weight: 600;
    color: var(--bitelet-color-heading, #333);
    margin-bottom: 0.25rem;
}

dd {
    margin-bottom: 1rem;
    margin-left: 1rem;
    line-height: 1.6;
}

/* ==========================================================================
   Horizontal Rules
   ========================================================================== */

hr {
    border: none;
    border-top: 1px solid var(--bitelet-color-border-primary, #d1d5db);
    margin: 2rem 0;
}

/* ==========================================================================
   Address and Contact
   ========================================================================== */

address {
    font-style: italic;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* ==========================================================================
   Small Text and Subscript/Superscript
   ========================================================================== */

small {
    font-size: 0.875rem;
    color: var(--bitelet-color-meta-text, #6b7280);
}

sub, sup {
    font-size: 0.75rem;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

sup {
    top: -0.5em;
}

sub {
    bottom: -0.25em;
}

a {
    text-decoration: none;
    transition: var(--bitelet-transition);
}

a:hover,
a:focus {
    text-decoration: underline;
}

/* Focus styles for accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--bitelet-color-accent);
    outline-offset: 2px;
}

/* ==========================================================================
   Basic Form Elements (Structure Only)
   ========================================================================== */

button,
input[type="submit"],
input[type="button"] {
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--bitelet-border-radius);
    cursor: pointer;
    transition: var(--bitelet-transition);
    font-family: inherit;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--bitelet-color-border-primary);
    border-radius: var(--bitelet-border-radius);
    font-family: inherit;
    transition: var(--bitelet-transition);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--bitelet-color-accent);
}

/* ==========================================================================
   Default Page Template Styles
   ========================================================================== */

.bitelet-page .entry-content {
    margin-top: 2rem;
}

/* ==========================================================================
   WordPress Core Styles
   ========================================================================== */

.alignleft {
    float: left;
    margin: 0 1.5rem 1rem 0;
}

.alignright {
    float: right;
    margin: 0 0 1rem 1.5rem;
}

.aligncenter {
    display: block;
    margin: 0 auto 1rem;
}

.alignwide {
    margin-left: calc(25% - 25vw);
    margin-right: calc(25% - 25vw);
    max-width: 1000%;
    width: auto;
}

.alignfull {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    max-width: 1000%;
    width: auto;
}

.wp-caption {
    max-width: 100%;
    margin-bottom: 1.5rem;
}

.wp-caption img {
    display: block;
    margin: 0 auto;
}

.wp-caption-text {
    text-align: center;
    font-size: 0.875rem;
    color: var(--bitelet-color-meta-text);
    margin-top: 0.5rem;
}

/* ==========================================================================
   Responsive Typography
   ========================================================================== */

@media (max-width: 768px) {
    :root {
        --bitelet-spacing-unit: 0.75rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    
    /* Mobile page template adjustments */
    .bitelet-page .entry-header {
        padding: 1.5rem 1.5rem 1rem;
    }
    
    .bitelet-page .entry-title {
        font-size: 2rem;
    }
    
    .bitelet-page .entry-content h1 { font-size: 1.75rem; }
    .bitelet-page .entry-content h2 { font-size: 1.5rem; }
    .bitelet-page .entry-content h3 { font-size: 1.25rem; }
}

@media (max-width: 480px) {
    .bitelet-page .entry-header {
        padding: 1rem;
    }
    
    .bitelet-page .entry-content h1 { font-size: 1.5rem; }
    .bitelet-page .entry-content h2 { font-size: 1.25rem; }
    .bitelet-page .entry-content h3 { font-size: 1.1rem; }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Screen reader only */
.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;
}

/* Text alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Display utilities */
.hidden { display: none !important; }
.visible { display: block !important; }

/* Spacing utilities */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 1rem !important; }
.mb-2 { margin-bottom: 2rem !important; }

/* Skip link */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    position: fixed;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    z-index: 999999;
    padding: 1rem;
    background: var(--bitelet-primary-color);
    color: white;
    text-decoration: none;
} 