/* =========================================
   DEMOGRAPHICS PAGE STYLES
   ========================================= */

/* --- 1. MASTER WRAPPER --- */
.demo-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    gap: 20px;
    box-sizing: border-box;
}

/* --- 2. LEFT COLUMN (Content) --- */
.demo-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 0;
}

/* --- 3. RIGHT COLUMN (Ad) --- */
.demo-right {
    width: 140px;
    flex-shrink: 0;
    position: sticky;
    top: 15px;
    z-index: 5;
}

/* --- 4. SHARED GLASS BOX STYLE --- */
.glass-box {
    background: var(--logo-color);
    border: 2px solid var(--black-color);
    border-radius: 12px;
    padding: 20px;
    color: white;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

/* --- 5. QUESTION SECTION --- */
.question-box {
    padding: 20px 25px;
}

.question-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
    color: #fff;
}

/* --- 6. VOTING & CONTROLS --- */
.details-vote-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

/* --- 7. FILTER TABS --- */
.demo-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 5px;
}

.demo-tab {
    padding: 6px 14px;
    border: 2px solid var(--black-color);
    border-radius: 20px;
    background: var(--logo-color);
    color: var(--white-color);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
    font-family: inherit;
}

.demo-tab:hover {
    opacity: 0.8;
}

.demo-tab.active {
    background: var(--white-color);
    color: var(--logo-color);
    box-shadow: none;
}

/* --- 8. CHARTS CONTAINER --- */
.demo-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    align-items: start;
}

.demo-chart-card {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.demo-chart-card h3 {
    margin: 0 0 5px 0;
    font-size: 0.95rem;
    color: var(--black-color);
}

.sub {
    font-size: 0.75rem;
    color: var(--black-color);
    margin-bottom: 10px;
    display: block;
}

/* --- 9. PIE CHARTS --- */
.pie {
    --size: 100px;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    margin: 5px auto;
    background: radial-gradient(circle closest-side, white 53%, transparent 54%), var(--dynamic-gradient);
    box-shadow: 0 0 15px rgba(0, 255, 153, 0.15);
    position: relative;
    transform: scaleX(-1);
}

.pie::after {
    content: "";
    position: absolute;
    inset: 20px;
    /* Donut Hole Size */
    background: var(--white-color);
    /* Match background color */
    border-radius: 50%;
}

.result-text {
    font-weight: 700;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--black-color);
    display: block;
    width: 100%;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.6;
}

.legend-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 5px;
    max-width: 100%;
}

.result-text.grid-4-layout {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: space-between;
    grid-template-rows: auto auto;
    grid-auto-flow: column;
    gap: 6px 10px;
    text-align: left;
    padding: 0 5px;
    box-sizing: border-box;
}

.result-text.grid-4-layout .legend-stat {
    display: flex;
    margin: 0;
}

.legend-name {
    flex: 1 1 auto;
    display: inline-block;
    word-break: break-word;
}

.legend-pct {
    white-space: nowrap;
    flex: 0 0 auto;
    font-weight: 800;
}

/* --- 10. AD BOX STYLING --- */
.ad-box {
    width: 100%;
    height: 400px;

    /* Dark Transparent Background with subtle Gradient */
    background: var(--logo-color);

    /* Neon Dashed Border */
    border: 1px dashed var(--logo-color);
    border-radius: 12px;

    /* Text Styling */
    color: var(--white-color);
    /* Neon Green Text */
    font-family: 'Courier New', Courier, monospace;
    /* Tech/Code Font */
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 5px;
    /* Spaced out letters */
    text-transform: uppercase;
    text-shadow: 0 0 8px var(--logo-color);
    /* Glowing Text */

    /* Alignment */
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    /* Vertical Text */
    text-orientation: upright;
    /* Letters stand upright */

    /* Smooth Transition */
    transition: all 0.3s ease;
    cursor: default;
}

/* Hover Effect - Makes it feel "active" */
.ad-box:hover {
    color: var(--logo-color);
    border-color: var(--white-color);
    /* Bright border on hover */
    background: var(--white-color);
    /* Slightly brighter background */
    box-shadow: 0 0 20px var(--white-color);
    /* Green Glow */
    cursor: pointer;
}

/* --- 11. SHARE SECTION --- */
.share-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 5px;
}

.share-label {
    font-weight: 600;
    color: var(--logo-color);
    margin-right: 5px;
}

.share-btn {
    width: auto;
    height: auto;
    padding: 8px 18px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    color: #fff;
    font-size: 1.1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
}

.share-count {
    font-size: 0.85rem;
    font-weight: 700;
    border-left: 1px solid rgba(255, 255, 255, 0.4);
    padding-left: 8px;
    line-height: 1;
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Brand Colors */
.share-btn.twitter {
    background: #000;
    border: 1px solid #333;
}

.share-btn.twitter:hover {
    background: #333;
}

.share-btn.facebook {
    background: #4267B2;
}

.share-btn.facebook:hover {
    background: #365899;
}

.share-btn.whatsapp {
    background: #25D366;
}

.share-btn.whatsapp:hover {
    background: #128C7E;
}

.share-btn.email {
    background: #EA4335;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
}

.share-btn.email:hover {
    background: #d93025;
    box-shadow: 0 5px 15px rgba(234, 67, 53, 0.4);
}

/* Hide all chart groups by default */
.chart-group {
    display: none;
}

/* --- 12. Snapshot Loader Section --- */
/* 1. The dark, blurred background overlay */
.coming-soon-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease-in-out;
    z-index: 9999;
}

/* 2. Professional High-Contrast Loader Box */
.coming-soon-box {
    background: #ffffff;
    color: #155724;
    padding: 25px 45px;
    border-radius: 12px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.5px;
    border-bottom: 5px solid #28a745;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2), 0 0 20px rgba(40, 167, 69, 0.1);
    transform: scale(0.7);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* 3. The custom green animated ring */
.loader-spinner {
    width: 26px;
    height: 26px;
    /* Light green track */
    border: 3px solid rgba(40, 167, 69, 0.2);
    /* Solid green moving tip */
    border-top-color: #28a745;
    border-radius: 50%;
    animation: loader-spin 1s linear infinite;
}


/* 4. Show the background and block clicks */
.coming-soon-modal.show {
    opacity: 1;
    pointer-events: auto;
}

/* 5. Pop-in and start the continuous gentle pulse */
.coming-soon-modal.show .coming-soon-box {
    opacity: 1;
    transform: scale(1);
    animation: loader-pulse 2s infinite ease-in-out;
}


/* 6. Keyframes to make the green shadow breathe in and out */
@keyframes loader-pulse {
    0% {
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2), 0 0 20px rgba(40, 167, 69, 0.2);
    }

    50% {
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2), 0 0 60px rgba(40, 167, 69, 0.6);
    }

    100% {
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2), 0 0 20px rgba(40, 167, 69, 0.2);
    }
}

/* Make it spin */
@keyframes loader-spin {
    to {
        transform: rotate(360deg);
    }
}


.chart-group.active-group {
    display: grid;
    /* This creates exactly 3 equal columns. A single card will only take up 1/3 of the space */
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
}

.demo-chart-card {
    width: 100%;
    /* Ensure it fills its specific grid column, but no more */
    /* Make sure to REMOVE "flex: 1;" if you still have it here */
    /* ... keep your background, border, etc. */
}

/* =========================================
   REPORT QUESTION FEATURE
========================================= */

/* 1. The Container (Pushes button to the bottom right) */
.report-action-container {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-top: 15px;
}

/* 2. The Button (Subtle, blends into the green card) */
.report-question-btn {
    background: transparent !important;
    /* Overrides default browser button styles */
    border: none;
    color: var(--white-color);
    /* Faded white text */
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;

    /* Flexbox keeps the flag icon and text perfectly aligned */
    display: inline-flex;
    align-items: center;
    gap: 6px;

    transition: color 0.3s ease;
}

/* 3. The Hover State (Highlights so the user knows it is clickable) */
.report-question-btn:hover {
    color: var(--white-color);
    text-decoration: underline;
}

/* ===== DESKTOP VIEW (Side-by-Side) ===== */
.title-row-wrapper {
    display: flex;
    justify-content: space-between;
    /* Pushes title to the left, button to the right */
    align-items: center;
    /* Vertically centers them on the same line */
    gap: 20px;
    /* Prevents them from touching if the title gets very long */
    margin-bottom: 10px;
}

.title-row-wrapper .question-title {
    margin: 0 !important;
    flex: 1;
    min-width: 0;
    white-space: normal;
    word-break: break-all;
    overflow-wrap: break-word;
}

/* Reset the container we made earlier since the new wrapper is handling the layout */
.report-action-container {
    margin-top: 0;
    width: auto;
    flex-shrink: 0;
    /* Prevents the button text from getting squished */
}

/* ===== REPORT STATUS BADGES ===== */

/* Base styling for all status text */
.report-status-badge {
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: default;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Specific Colors based on Admin Status */
.report-status-badge.pending {
    color: var(--white-color);
    /* White for pending */
}

.report-status-badge.compliant {
    color: var(--white-color);
}

.report-status-badge.action-taken {
    color: var(--white-color);
}

/* ===== QUESTION STATS TEXT ===== */
.question-stats-text {
    color: var(--white-color);
    font-size: 0.7rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.question-stats-text+.vote-ovals-container {
    margin-top: 10px;
    /* Increase or decrease to get the perfect gap */
}

/* ===== DESKTOP ONLY SOCIAL SHARE FIX ===== */
@media screen and (min-width: 769px) {
    .toggle-more {
        display: none !important;
    }

    .extra-social {
        display: contents !important;
    }
}

/* =========================================
   MOBILE RESPONSIVE FIXES (ALL-IN-ONE)
   ========================================= */
@media screen and (max-width: 768px) {

    /* 1. MASTER WRAPPER & COLUMNS */
    .demo-wrapper {
        flex-direction: column;
        padding: 15px;
    }

    .demo-left {
        width: 100%;
    }

    /* 2. AD BOX (Moves to bottom, switches to horizontal) */
    .demo-right {
        width: 100%;
        position: static;
        margin-top: 15px;
    }

    .ad-box {
        writing-mode: horizontal-tb;
        height: 80px;
        letter-spacing: 2px;
    }

    /* 3. FILTER TABS */
    .demo-tabs {
        flex-wrap: wrap;
        /* Allows tabs to drop to the next line */
        justify-content: center;
        /* Centers the rows of tabs neatly */
        overflow-x: visible;
        /* Removes the horizontal scroll */
        padding-bottom: 0;
        gap: 8px;
    }

    .demo-tab {
        flex-shrink: 1;
        padding: 5px 12px;
        /* Slightly tighter padding so more fit per line */
        font-size: 0.75rem;
        /* Shrinks the text slightly to prevent crowding */
    }

    /* 4. CHARTS GRID (Auto-fits 1 or 2 columns, shrinks pie charts slightly) */
    .chart-group.active-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        justify-items: center;
    }

    .pie {
        --size: 75px;
    }

    .demo-chart-card {
        padding: 5px;
        width: 100%;
        max-width: 180px;
    }

    .demo-chart-card:only-child {
        grid-column: 1 / -1;
        max-width: 210px;
    }

    .demo-chart-card h3 {
        font-size: 0.9rem;
    }

    .sub {
        font-size: 0.7rem;
    }

    .result-text {
        font-size: 0.6rem;
    }

    .result-text.grid-4-layout .legend-name {
        display: inline-block;
    }

    /* 5. QUESTION HEADER & SHARE SECTION */
    .question-title {
        font-size: 1.1rem;
    }

    .share-section {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .share-btn {
        padding: 6px 14px;
        font-size: 0.95rem;
    }

    .share-count {
        font-size: 0.75rem;
        padding-left: 6px;
    }

    /* 6. LOADER MODAL (Stacks the spinner above the text so it fits the screen) */
    .coming-soon-box {
        flex-direction: column;
        justify-content: center;
        padding: 25px 20px;
        font-size: 18px;
        width: 85%;
        max-width: 320px;
        gap: 15px;
        white-space: normal;
        /* Allows the "Preparing your share link..." text to wrap if needed */
    }

    .loader-spinner {
        margin: 0 auto;
        /* Ensures the spinner is perfectly centered */
    }

    .title-row-wrapper {
        flex-direction: column;
        /* Stacks them one below the other */
        align-items: flex-start;
        /* Aligns both elements to the left edge */
        gap: 12px;
        /* Adds a small gap between the title and the button */
    }
}

/* Styling for the text-based toggle buttons */
.btn-label-text {
    font-size: 11px;
    font-weight: 800;
    color: #FFFFFF;

    letter-spacing: 0.8px;
    pointer-events: none;
}

/* Slight hover effect for the text */
.toggle-more:hover .btn-label-text {
    color: #2ce5a7;
    transition: color 0.2s ease;
}

/* ===== SHARE SECTION LAYOUT ===== */
.share-label-top {
    align-self: flex-start;
    margin-top: 8px;
}

.share-buttons-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    flex: 1;
    justify-content: flex-start;
}

/* Custom CSS classes replacing inline styles */
.truth-social-text-icon {
    font-family: sans-serif;
    cursor: pointer;
    padding: 0 4px;
}

.ad-icon-rect {
    font-size: 3rem;
    opacity: 0.5;
}

/* Cleanup styles replacing inline styles */
.demo-chart-card.no-data-card {
    display: flex;
    justify-content: center;
    align-items: center;
}

.share-btn.toggle-more {
    background: #333;
    border: none;
    cursor: pointer;
}

.extra-social {
    display: none;
    flex-basis: 100%;
    gap: 12px;
}

.share-btn.truth {
    background: #5A12F6;
}

.share-btn.bsky {
    background: #0085FF;
    color: #FFFFFF;
}

/* ===============================
   CUSTOM MODAL POPUP (Report Question)
=============================== */
.report-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.report-modal-box {
  background: #ffffff;
  color: #333;
  padding: 40px 30px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  width: 90%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.report-modal-icon-circle {
  width: 60px;
  height: 60px;
  background-color: #e8f5e9; /* Light green */
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

.report-modal-icon-circle i {
  color: #4CAF50; /* Green */
  font-size: 30px;
}

.report-modal-box h3 {
  margin: 0 0 10px 0;
  color: #1a1a1a;
  font-size: 1.5rem;
  font-weight: bold;
}

.report-modal-box p {
  margin: 0 0 30px 0;
  color: #666;
  font-size: 1rem;
}

.report-modal-buttons {
  display: flex;
  gap: 15px;
  width: 100%;
}

.btn-report-confirm {
  background: #388E3C; /* Green */
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  flex: 1;
  transition: background 0.3s ease;
}

.btn-report-confirm:hover {
  background: #2E7D32;
}

.btn-report-cancel {
  background: #f1f1f1;
  color: #333;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  flex: 1;
  transition: background 0.3s ease;
}

.btn-report-cancel:hover {
  background: #e0e0e0;
}