/*
 * File: /assets/css/base/global.css
 * Description: Foundational stylesheet for Priceyoo theme.
 * VERSION 7.0: 100% Full Code - Layout Preserved, SVG & AdSense CLS Fixed.
 */

/* ==========================================================================
   1. CSS Variables (Root Configuration)
   ========================================================================== */
:root {
    /* Colors */
    --py-primary-color: #C8102E;
    --py-primary-dark: #a20d24;
    --py-primary-rgb: 200, 16, 46;
    
    --py-secondary-color: #1a202c;
    --py-accent-color: #f5af19;
    
    --py-text-color: #2d3748;
    --py-text-light: #4A5568;
    
    --py-border-color: #e2e8f0;
    
    --py-bg-color: #ffffff;
    --py-card-bg: #ffffff;
    --py-footer-text-color: #a0aec0;

    /* Typography */
    --py-font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --py-font-secondary: 'Poppins', sans-serif;
    
    /* Spacing & Layout */
    --py-container-width: 1200px;
    --py-border-radius: 8px;
}

/* ==========================================================================
   2. Base Resets & Body Defaults
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--py-font-primary);
    font-size: 16px;
    line-height: 1.7;
    color: var(--py-text-color);
    background-color: var(--py-bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden; /* Prevents AdSense Auto Ads from causing horizontal scroll */
}

/* ==========================================================================
   3. Global Layout
   ========================================================================== */
#page { 
    overflow-x: clip; 
    overflow-y: visible; 
    position: relative;
}

.site-content {
    overflow: visible !important; 
}

.container {
    max-width: var(--py-container-width);
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

.container-fluid { width: 100%; padding-left: 20px; padding-right: 20px; }

/* ==========================================================================
   4. Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.75em;
    font-family: var(--py-font-secondary);
    font-weight: 700;
    line-height: 1.3;
    color: var(--py-secondary-color);
}

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-top: 0; margin-bottom: 1.25em; }

a { color: var(--py-primary-color); text-decoration: none; transition: color 0.2s ease-in-out; }
a:hover { color: var(--py-primary-dark); }

.archive-title { font-size: 1.8rem; margin-top: 15px; }

/* ==========================================================================
   5. Default Element Styling (Buttons, Forms, Tables)
   ========================================================================== */

/* --- Buttons --- */
.button, button, input[type="button"], input[type="reset"], input[type="submit"] {
    display: inline-block; padding: 10px 20px; font-size: 1rem; font-weight: 600;
    font-family: var(--py-font-primary); text-align: center; text-decoration: none;
    cursor: pointer; border: 1px solid transparent; border-radius: var(--py-border-radius);
    transition: all 0.2s ease-in-out; line-height: 1.5;
}
.button-primary, button.button-primary, input[type="submit"] { background-color: var(--py-primary-color); color: #fff; }
.button-primary:hover, button.button-primary:hover, input[type="submit"]:hover { background-color: var(--py-primary-dark); color: #fff; }

/* --- Forms --- */
input[type="text"], input[type="email"], input[type="search"], input[type="password"], textarea {
    width: 100%; padding: 10px 15px; border: 1px solid var(--py-border-color);
    border-radius: var(--py-border-radius); font-family: var(--py-font-primary);
    font-size: 1rem; background-color: #fff;
}
input:focus, textarea:focus {
    outline: none; border-color: var(--py-primary-color);
    box-shadow: 0 0 0 2px rgba(var(--py-primary-rgb), 0.2);
}

/* --- Lists --- */
ul, ol { margin: 0 0 1.5em 1.5em; padding: 0; }

/* --- GLOBAL TABLE STYLES (Standard & WP Block) --- */
table, .wp-block-table table { width: 100%; border-collapse: collapse; margin-bottom: 1.5em; border: 1px solid var(--py-border-color); background-color: #fff; font-size: 0.95rem; }
th, td { padding: 12px 15px; border: 1px solid var(--py-border-color); text-align: left; vertical-align: middle; color: var(--py-text-color); }
th { background-color: #f8f9fa; font-weight: 600; color: var(--py-secondary-color); text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.5px; }
tbody tr:nth-child(even) { background-color: #fcfcfc; }
tbody tr:hover { background-color: #f1f3f5; }
.wp-block-table { margin: 0 0 1.5em 0; width: 100%; overflow-x: auto; display: block; }
.wp-block-table table { width: 100% !important; max-width: 100%; border-collapse: collapse; }
.wp-block-table figcaption { font-size: 0.9rem; color: var(--py-text-light); text-align: center; margin-top: 0.5em; font-style: italic; }
.wp-block-table.is-style-stripes table tbody tr:nth-child(odd) { background-color: #f8f9fa; }
@media (max-width: 768px) {
    table { display: block; overflow-x: auto; white-space: nowrap; }
    .wp-block-table table, .py-plan-table-wrapper table { display: table; white-space: normal; min-width: 600px; }
    .wp-block-table th, .wp-block-table td, .py-plan-table-wrapper th, .py-plan-table-wrapper td { white-space: nowrap; }
}

/* ==========================================================================
   6. WordPress Core Styles
   ========================================================================== */
.screen-reader-text {
    border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%);
    height: 1px; margin: -1px; overflow: hidden; padding: 0;
    position: absolute !important; width: 1px; word-wrap: normal !important;
}

/* ==========================================================================
   7. NEW: GUTENBERG BLOCK STYLES
   ========================================================================== */

/* --- General Block Spacing --- */
.wp-block-heading,
.wp-block-paragraph,
.wp-block-list,
.wp-block-quote,
.wp-block-image,
.wp-block-separator {
    margin-bottom: 1.5em;
}

/* --- Headings --- */
.wp-block-heading {
    margin-top: 1.5em;
    margin-bottom: 0.75em;
}

/* --- Lists --- */
.wp-block-list {
    padding-left: 1.5em;
}
.wp-block-list li {
    margin-bottom: 0.5em;
}

/* --- Quotes --- */
.wp-block-quote {
    border-left: 4px solid var(--py-primary-color);
    padding: 15px 20px;
    background-color: #f8f9fa;
    font-size: 1.1rem;
    font-style: italic;
    margin-left: 0;
    margin-right: 0;
}
.wp-block-quote p {
    margin-bottom: 0.5em;
}
.wp-block-quote cite {
    display: block;
    margin-top: 1em;
    font-size: 0.9rem;
    font-style: normal;
    color: var(--py-text-light);
}
.wp-block-quote cite::before {
    content: "— ";
}

/* --- Images --- */
.wp-block-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--py-border-radius);
}
.wp-block-image figcaption {
    font-size: 0.9rem;
    color: var(--py-text-light);
    text-align: center;
    margin-top: 0.5em;
}
.wp-block-image.aligncenter {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}
.wp-block-image.alignleft {
    float: left;
    margin-right: 1.5em;
    margin-bottom: 1em;
}
.wp-block-image.alignright {
    float: right;
    margin-left: 1.5em;
    margin-bottom: 1em;
}

/* --- Separators --- */
hr,
.wp-block-separator {
    border: none;
    border-top: 1px solid var(--py-border-color);
    margin: 2em auto;
    max-width: 100px;
}
.wp-block-separator.is-style-wide {
    max-width: 100%;
}
.wp-block-separator.is-style-dots::before {
    content: "···";
    font-size: 1.5rem;
    color: var(--py-border-color);
    letter-spacing: 0.5em;
}
.wp-block-separator.is-style-dots {
    border: none;
    background: none;
    text-align: center;
}

/* ==========================================================================
   8. Pagination
   ========================================================================== */
.py-pagination { margin-top: 50px; margin-bottom: 40px; width: 100%; text-align: center; display: block; }
.py-pagination ul.page-numbers { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; padding: 0; margin: 0; list-style: none; border: none; }
.py-pagination ul.page-numbers li { margin: 0; padding: 0; border: none; background: none; display: block; }
.py-pagination ul.page-numbers .page-numbers { display: flex; align-items: center; justify-content: center; height: 44px; padding: 0 18px; background-color: #fff; border: 1px solid var(--py-border-color); color: var(--py-text-light); border-radius: 6px; text-decoration: none; font-weight: 600; font-size: 0.95rem; line-height: 1; transition: all 0.2s ease-in-out; }
.py-pagination ul.page-numbers a.page-numbers:hover { background-color: #fff; color: var(--py-primary-color); border-color: var(--py-primary-color); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.py-pagination ul.page-numbers span.page-numbers.current { background-color: var(--py-primary-color); color: #fff; border-color: var(--py-primary-color); cursor: default; transform: none; box-shadow: none; }
.py-pagination .page-numbers i { font-size: 0.85rem; }

/* ==========================================================================
   9. Mobile Responsiveness (Global)
   ========================================================================== */
@media (max-width: 768px) {
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.6rem; }
    h3 { font-size: 1.4rem; }
    h4 { font-size: 1.2rem; }
    h5 { font-size: 1.1rem; }
    .container, .container-fluid { padding-left: 15px; padding-right: 15px; }
    .archive-title { font-size: 1.0rem; margin-top: 15px; }
}

/* ==========================================================================
   10. Breadcrumbs
   ========================================================================== */
.breadcrumbs { list-style: none; margin: 0 0 20px 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; font-size: 0.9rem; color: var(--py-text-light); }
.breadcrumbs li { display: inline-flex; align-items: center; }
.breadcrumbs a { color: var(--py-text-light); text-decoration: none; transition: color 0.2s; }
.breadcrumbs a:hover { color: var(--py-primary-color); }
.breadcrumbs .separator { margin: 0 8px; font-size: 0.7rem; color: #cbd5e0; }
.breadcrumbs .bread-current { color: var(--py-text-color); font-weight: 600; }
@media (max-width: 768px) { .breadcrumbs { font-size: 0.8rem; margin-bottom: 15px; } }

/* ==========================================================================
   11. Theme Specifics
   ========================================================================== */
.plan-card-wrapper .operator-logo { object-fit: contain; }

/* Read More Toggle */
.py-read-more-wrap { position: relative; margin-bottom: 25px; }
.py-read-more-content { overflow: hidden; transition: max-height 0.4s ease-out; position: relative; }
.py-read-more-content.collapsed { max-height: 120px; }
.py-read-more-content.collapsed::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 50px; background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1)); pointer-events: none; }
.py-read-more-btn { background: none; border: none; color: var(--py-primary-color); padding: 8px 0; font-weight: 600; cursor: pointer; font-size: 0.95rem; display: inline-flex; align-items: center; gap: 5px; transition: color 0.2s; }
.py-read-more-btn:hover { color: var(--py-primary-dark); text-decoration: underline; }
.py-read-more-btn i { font-size: 0.8em; transition: transform 0.3s ease; }
.py-read-more-btn.active i { transform: rotate(180deg); }

/* FAQ Accordion */
.py-faq-section { margin-top: 40px; margin-bottom: 40px; background: var(--py-card-bg); padding: 30px; border-radius: var(--py-border-radius); box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid var(--py-border-color); }
.py-faq-title { text-align: center; margin-bottom: 30px; font-size: 1.8rem; color: var(--py-secondary-color); }
.py-faq-list { display: flex; flex-direction: column; }
.py-faq-item { border-bottom: 1px solid var(--py-border-color); }
.py-faq-item:last-child { border-bottom: none; }
.py-faq-question { width: 100%; text-align: left; padding: 18px 0; background: none; border: none; font-weight: 600; font-size: 1.05rem; color: var(--py-secondary-color); cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: color 0.2s; }
.py-faq-question:hover { color: var(--py-primary-color); }
.py-faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; color: var(--py-text-light); line-height: 1.7; }
.py-faq-answer-inner { padding-bottom: 20px; }
.py-faq-icon { transition: transform 0.3s ease; color: #cbd5e0; }
.py-faq-item.active .py-faq-question { color: var(--py-primary-color); }
.py-faq-item.active .py-faq-icon { transform: rotate(180deg); color: var(--py-primary-color); }

/* ==========================================================================
   12. CLS (Cumulative Layout Shift) & AdSense FIXES
   ========================================================================== */

/* 1. Reserve space for Sticky Bar to prevent content jump */
#sticky-bars-wrapper {
    min-height: 62px; 
    display: block;
    contain: size layout;
}

/* 2. Lock Logo aspect ratio (Based on 460x115) */
.site-branding img.custom-logo {
    width: 120px; 
    height: auto;
    aspect-ratio: 460 / 115;
    display: block;
}

/* 3. Stabilize Site Content */
#content.site-content {
    display: block;
    clear: both;
    min-height: 100vh !important; 
}

/* 4. Fix Header Height */
.site-header {
    min-height: 60px;
}

/* 5. Stabilize SVG Images (CRITICAL CLS FIX FOR LIGHTHOUSE) */
img.sp-hero-image { width: 90px; height: 90px; aspect-ratio: 1 / 1; object-fit: contain; display: block; }
img.py-table-logo { width: 24px; height: 24px; aspect-ratio: 1 / 1; object-fit: contain; display: block; }
img.operator-logo { height: 40px; width: auto; aspect-ratio: 2 / 1; object-fit: contain; display: block; }
.fp-operator-logo img { width: 40px; height: 40px; aspect-ratio: 1 / 1; object-fit: contain; display: block; }
img[src$=".svg"] { max-width: 100%; height: auto; } 

/* 6. AdSense Auto Ads Stability Fix */
.google-auto-placed { 
    margin-bottom: 20px; 
    text-align: center; 
    clear: both; 
    width: 100%; 
    overflow: hidden; 
}
ins.adsbygoogle { 
    display: block !important; 
    text-align: center; 
    overflow: hidden; 
}

/* 7. Stabilize Collapsible Boxes & Charts */
.sp-collapsible-box { contain: layout; min-height: 58px; margin-bottom: 20px; background: #fff; }
.sp-price-chart-section { min-height: 350px; contain: layout; }
.sp-favorite-wrapper { min-width: 40px; min-height: 40px; display: inline-block; }

/* 8. Font swap ke waqt shift kam karne ke liye */
body { font-display: swap; }


/* ==========================================================================
   13. SMOOTH PAGE LOAD FADE-IN
   ========================================================================== */
body {
    animation: themeFadeIn 0.4s ease-in-out forwards;
}
@keyframes themeFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* ==========================================================================
   14. DARK MODE VARIABLES
   ========================================================================== */
body.dark-mode {
    --py-bg-color: #121826;
    --py-card-bg: #1e293b;
    --py-text-color: #e2e8f0;
    --py-text-light: #94a3b8;
    --py-secondary-color: #f8fafc;
    --py-border-color: #334155;
}
body.dark-mode .site-header,
body.dark-mode .footer-bottom-bar,
body.dark-mode .sp-hero,
body.dark-mode .sp-plan-details-table-fixed,
body.dark-mode .sp-collapsible-box,
body.dark-mode .sp-comment-section,
body.dark-mode .sp-latest-post-item,
body.dark-mode .sp-info-box,
body.dark-mode .py-plan-card,
body.dark-mode .py-blog-post-card,
body.dark-mode .archive-hero-modern,
body.dark-mode .filter-container-wrapper,
body.dark-mode .plan-card-wrapper,
body.dark-mode .py-plan-table-wrapper {
    background-color: var(--py-card-bg);
    border-color: var(--py-border-color);
}
body.dark-mode .sp-hero-image,
body.dark-mode .archive-brand-logo {
    background-color: #cbd5e0; /* Keep logos visible */
}

/* ==========================================================================
   15. TOAST NOTIFICATIONS
   ========================================================================== */
#py-toast-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.py-toast {
    background: var(--py-secondary-color);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastSlideIn 0.3s ease forwards;
    transition: opacity 0.3s ease;
}
.py-toast.fade-out { opacity: 0; }
@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   16. TABLE OF CONTENTS (TOC)
   ========================================================================== */
.py-toc {
    background: var(--py-card-bg);
    border: 1px solid var(--py-border-color);
    border-radius: var(--py-border-radius);
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}
.py-toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.py-toc-header h3 { margin: 0; font-size: 1.2rem; }
.py-toc-toggle { background: none; border: none; cursor: pointer; color: var(--py-text-light); }
.py-toc-list { list-style: none; padding: 0; margin: 0; transition: all 0.3s ease; }
.py-toc-list.hidden { display: none; }
.py-toc-list li { margin-bottom: 8px; }
.py-toc-list .toc-sub { padding-left: 20px; font-size: 0.95em; }
.py-toc-list a { color: var(--py-text-color); text-decoration: none; }
.py-toc-list a:hover { color: var(--py-primary-color); text-decoration: underline; }