/*
Theme Name: MS Press
Theme URI: https://example.com/ms-press
Author: Custom Brainly Dev
Description: Brainly-like Educational Q&A Theme with Advanced Formatting, Customizer, Dynamic Layouts & Fonts
Version: 2.8.4
License: GNU General Public License v2 or later
Text Domain: ms-press
*/

/* ==========================================================================
   1. GLOBAL STYLES & DYNAMIC VARIABLES
   ========================================================================== */
:root {
    --primary-color: #2563eb;
    --qam-q-border: #27ae60;
    --qam-expert-border: #27ae60;
    --qam-user-border: #1062fe;
    --bg-light: #f8fafc;
    --text-dark: #1e293b;
    --sidebar-box-bg: #ffffff;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--site-font, 'Poppins', sans-serif);
    background-color: var(--bg-light);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Global Responsive Images & Tables Fix */
img, iframe, object, embed {
    max-width: 100% !important;
    height: auto !important;
}

table {
    width: 100% !important;
    display: block;
    overflow-x: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ==========================================================================
   2. DYNAMIC WEBSITE LAYOUT GRID (SIDEBAR POSITIONS)
   ========================================================================== */
.site-main-layout-wrapper {
    display: flex;
    gap: 24px;
    margin-top: 25px;
    margin-bottom: 40px;
}

.layout-right_sidebar .main-content-column,
.layout-left_sidebar .main-content-column,
body.layout-right_sidebar .main-content-column,
body.layout-left_sidebar .main-content-column {
    width: 70%;
}

.layout-left_sidebar .site-main-layout-wrapper,
body.layout-left_sidebar .site-main-layout-wrapper {
    flex-direction: row-reverse;
}

.layout-no_sidebar .main-content-column,
body.layout-no_sidebar .main-content-column {
    width: 100%;
}

.layout-both_sidebars .main-content-column,
body.layout-both_sidebars .main-content-column {
    width: 50%;
}

.layout-both_sidebars .sidebar-column-left,
.layout-both_sidebars .sidebar-column-right,
body.layout-both_sidebars .sidebar-column-left,
body.layout-both_sidebars .sidebar-column-right {
    width: 25%;
}

.sidebar-column {
    width: 30%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-box {
    background: var(--sidebar-box-bg);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid #e2e8f0;
}

/* ==========================================================================
   3. THREE-LAYER HEADER STYLES
   ========================================================================== */
.site-header-three-layer {
    width: 100%;
    position: relative;
    z-index: 9999;
}

.middle-header.is-fixed-sticky {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 99999 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08) !important;
}

.lower-header.is-fixed-sticky {
    position: fixed !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 99998 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12) !important;
}

/* BRANDING ANIMATIONS */
.middle-brand-section {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.anim-effect-pulse:hover,
.is-fixed-sticky .anim-effect-pulse {
    animation: brandPulse 2s infinite ease-in-out;
}
@keyframes brandPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

/* UPPER HEADER */
.upper-header {
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
    color: #64748b;
}
.upper-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.upper-header-meta span {
    margin-right: 15px;
    font-weight: 500;
}
.upper-menu-wrap {
    display: flex;
    flex-grow: 1;
}

.upper-sub-navigation ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 15px !important;
}
.upper-sub-navigation ul li { display: inline-block !important; }
.upper-sub-navigation ul li a {
    text-decoration: none;
    color: #64748b;
    font-weight: 500;
    transition: color 0.2s;
}

/* MIDDLE MAIN HEADER */
.middle-header {
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.3s ease;
}
.middle-header-container {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.middle-brand-section {
    width: 30%;
    display: flex;
    align-items: center;
    gap: 12px;
}
.site-identity-text .site-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
}
.site-identity-text .site-title a { color: #0f172a; text-decoration: none; }

.middle-nav-section {
    width: 70%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.main-navigation ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
}
.main-navigation ul li { position: relative; display: inline-block !important; }
.main-navigation ul li a {
    text-decoration: none;
    color: #334155;
    font-weight: 600;
    padding: 8px 14px;
    display: block;
    border-radius: 20px;
}

/* LOWER SEARCH HEADER */
.lower-header-flex-grid {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px;
}

.lower-search-section { width: 80%; }
.search-input-wrapper {
    display: flex !important;
    align-items: center !important;
    background: #f1f5f9;
    border-radius: 30px;
    padding: 4px 6px 4px 18px;
}
.search-input-wrapper .search-field {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    padding: 6px;
}
.search-submit-btn {
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 8px 22px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    min-height: 40px;
}

.lower-button-section {
    width: 20%;
    display: flex !important;
    justify-content: flex-end !important;
}

.btn-lower-custom {
    padding: 10px 22px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    border-radius: 20px;
    min-height: 42px;
}

/* ==========================================================================
   4. ADVANCED RESPONSIVE MEDIA QUERIES (MOBILE & TABLET)
   ========================================================================== */
@media (max-width: 992px) {
    .site-main-layout-wrapper {
        flex-direction: column !important;
    }
    .main-content-column, 
    .sidebar-column,
    .layout-both_sidebars .main-content-column,
    .layout-both_sidebars .sidebar-column-left,
    .layout-both_sidebars .sidebar-column-right {
        width: 100% !important;
    }
}

@media (max-width: 768px) {
    .upper-header-container {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    .middle-header-container {
        flex-direction: column !important;
        gap: 12px;
    }
    .middle-brand-section, 
    .middle-nav-section {
        width: 100% !important;
        justify-content: center !important;
    }
    .main-navigation ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    .lower-header-flex-grid {
        flex-direction: column !important;
        gap: 12px;
    }
    .lower-search-section, 
    .lower-button-section {
        width: 100% !important;
        justify-content: center !important;
    }
    .btn-lower-custom {
        width: 100%;
        text-align: center;
    }
}

/* ==========================================================================
   5. QUESTION BOX USER HEADER ADDITIONS
   ========================================================================== */
.question-author-avatar img {
    border: 2px solid #2563eb;
    object-fit: cover;
}

/* ==========================================================================
   6. CATEGORY BADGE & CUSTOMIZER STYLING
   ========================================================================== */
.qam-cat-badge {
    position: absolute;
    z-index: 10;
}
.qam-cat-pos-top-right {
    top: 15px;
    right: 15px;
}
.qam-cat-pos-top-left {
    top: 15px;
    left: 15px;
}

.qam-cat-badge a {
    display: inline-block;
    padding: 4px 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

/* Category Badge Visual Styles */
.qam-cat-fx-badge-solid a {
    border-style: solid;
}
.qam-cat-fx-badge-outline a {
    background-color: transparent !important;
    border-style: solid;
}
.qam-cat-fx-badge-glow a {
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.25);
}
.qam-cat-fx-badge-noborder a {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

/* Category Shapes */
.qam-cat-shape-rounded a { border-radius: 6px; }
.qam-cat-shape-square a  { border-radius: 0px; }
.qam-cat-shape-pill a    { border-radius: 50px; }

/* Report Flag Button */
.qam-report-btn {
    border: none;
    background: transparent;
    color: #dc2626;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}
.qam-report-btn:hover {
    color: #991b1b;
    transform: scale(1.05);
}
.qam-report-btn.disabled {
    color: #94a3b8;
    cursor: not-allowed;
}

/* Box Customizer Animations & Effects */
.qb-anim-hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.qb-anim-hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.qb-anim-fade-in {
    animation: qbFadeIn 0.6s ease-in-out;
}
@keyframes qbFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.qb-anim-slide-up {
    animation: msSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.qb-anim-zoom-in {
    animation: msZoomIn 0.4s ease forwards;
}

.qb-anim-hover-bounce:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.qb-anim-border-glow:hover {
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.3);
    transition: box-shadow 0.3s ease;
}

/* Entrance Animations & Keyframes */
.ms-anim-fade-in { animation: msFadeIn 0.6s ease-in-out forwards; }
@keyframes msFadeIn { from { opacity: 0; } to { opacity: 1; } }

.ms-anim-slide-up { animation: msSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes msSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.ms-anim-zoom-in { animation: msZoomIn 0.4s ease forwards; }
@keyframes msZoomIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.ms-anim-hover-bounce:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08); }

/* EXPERT ANSWER BOX STYLING */
.expert-answer-card {
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.08);
}
.expert-answer-card:hover {
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.15);
}

/* ==========================================================================
   SIDEBAR PROFILE CARD (Login/Sign-Up button + Logged-in profile + Logout)
   ========================================================================== */
.brainly-profile-card {
    text-align: center;
    padding: 20px 16px;
}
.brainly-profile-card .profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}
.brainly-profile-card .profile-header h3 {
    margin: 0 0 4px 0;
    font-size: 15px;
    color: var(--text-dark);
}
.brainly-profile-card .badge-rank {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: #b45309;
    background: #fef3c7;
    padding: 2px 8px;
    border-radius: 10px;
}
.brainly-profile-card .divider {
    border: none;
    border-top: 1px solid #f1f5f9;
    margin: 14px 0;
}
.brainly-profile-card .points-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 14px;
}
.brainly-profile-card .stat-item {
    display: flex;
    flex-direction: column;
}
.brainly-profile-card .stat-num {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color, #2563eb);
}
.brainly-profile-card .stat-label {
    font-size: 12px;
    color: #64748b;
}
.brainly-profile-card .guest-desc {
    font-size: 13.5px;
    color: #64748b;
    margin: 8px 0 16px 0;
}

.sidebar-login-btn,
.sidebar-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    box-sizing: border-box;
    cursor: pointer;
}
.sidebar-login-btn {
    background: var(--primary-color, #2563eb);
    color: #ffffff;
}
.sidebar-login-btn:hover { background: #1d4ed8; color: #ffffff; }

.sidebar-logout-btn {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.sidebar-logout-btn:hover { background: #fee2e2; }