/**
 * MyTasbih Common Styles
 * Shared styles for all MyTasbih custom pages
 * 
 * @package MyTasbih Theme
 * @version 1.0.0
 */

/* ========================================
   CSS Variables
   ======================================== */
:root {
    --bg: #f5f0e8;
    --bg-dark: #1a1a2e;
    --text: #2d3748;
    --text-dark: #e2e8f0;
    --accent: #d4af37;
    --accent-hover: #c9a227;
}

/* ========================================
   Reset & Base
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base form element resets (replaces Astra defaults) */
input, button, select, textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

/* Global focus styles: replace browser default blue outline with gold accent */
button:focus,
a:focus,
select:focus,
input:focus,
textarea:focus,
summary:focus,
[role="button"]:focus {
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

html {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
    font-size: 16px;
    line-height: 1.5;
}

/* Scroll lock for modals - applied to both html and body */
html.modal-open,
html.modal-open body {
    overflow: hidden !important;
    height: 100% !important;
    touch-action: none;
}

/* Hide Astra default elements and force full width */
.ast-container, #page, .site-content, .ast-separate-container, 
.ast-separate-container .ast-article-single, .ast-separate-container .ast-article-post,
.ast-plain-container, #primary, #main, .site-main, .entry-content {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow-x: hidden !important;
}

header.site-header, footer.site-footer, .ast-footer-overlay {
    display: none !important;
}

/* Hide Astra scroll-to-top button (unstyled when Astra CSS is dequeued) */
#ast-scroll-top, .ast-scroll-top-icon, [data-section="section-scroll-to-top"] {
    display: none !important;
}

/* Custom Scroll-to-Top Button */
.scroll-top-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(100, 116, 139, 0.5);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s, visibility .3s, background .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    backdrop-filter: blur(4px);
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top-btn:hover {
    background: rgba(100, 116, 139, 0.75);
}

.page-wrapper.dark .scroll-top-btn {
    background: rgba(148, 163, 184, 0.35);
}

.page-wrapper.dark .scroll-top-btn:hover {
    background: rgba(148, 163, 184, 0.55);
}

/* Force page wrapper full width - removed calc margins that cause overflow */
.page-wrapper {
    max-width: 100vw !important;
    width: 100% !important;
    margin: 0 !important;
    overflow-x: hidden !important;
}

/* ========================================
   Page Wrapper
   ======================================== */
.page-wrapper {
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    background: linear-gradient(160deg, #e8f4f8 0%, #f0ebe3 25%, #faf6f0 50%, #e8efe8 75%, #f5f0e8 100%);
    position: relative;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    overflow-x: hidden;
    box-sizing: border-box;
}

.page-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    opacity: .08;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5L35 15L45 15L37 22L40 32L30 26L20 32L23 22L15 15L25 15Z' fill='none' stroke='%23d4af37' stroke-width='0.5'/%3E%3Ccircle cx='30' cy='30' r='20' fill='none' stroke='%23d4af37' stroke-width='0.3'/%3E%3C/svg%3E");
    background-size: 80px 80px;
    pointer-events: none;
    overflow: hidden;
}

/* Counter Page Background Image - Mobile (Light Mode) */
@media (max-width: 1024px) {
    .page-wrapper.counter-page {
        background: url('https://mytasbih.com/wp-content/uploads/2026/02/phone-background-1-scaled.jpg') center center no-repeat;
        background-size: cover;
        background-attachment: scroll;
    }
    
    .page-wrapper.counter-page::before {
        display: none;
    }
}

/* Counter Page Background Image - Desktop Only (Light Mode) */
@media (min-width: 1025px) {
    .page-wrapper.counter-page {
        background: url('https://mytasbih.com/wp-content/uploads/2026/02/background.png') center center no-repeat fixed;
        background-size: 100% 100%;
    }
    
    /* Hide the pattern overlay on counter page desktop */
    .page-wrapper.counter-page::before {
        display: none;
    }
}

/* Dark Mode */
.page-wrapper.dark {
    background: linear-gradient(160deg, #1a1a2e 0%, #16213e 25%, #1a1a2e 50%, #0f1624 75%, #1a1a2e 100%);
    color: var(--text-dark);
}

.page-wrapper.dark::before {
    opacity: .05;
}

/* ========================================
   Navigation
   ======================================== */
.top-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.page-wrapper.dark .top-nav {
    background: rgba(30, 30, 50, 0.7);
}

.nav-link {
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all .2s;
}

.nav-link:hover {
    color: var(--accent);
    background: rgba(212, 175, 55, .1);
}

.nav-link.active {
    color: var(--accent);
    font-weight: 600;
}

.page-wrapper.dark .nav-link {
    color: #94a3b8;
}

/* ========================================
   Header
   ======================================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    position: sticky;
    top: 36px;
    z-index: 99;
    width: 100%;
}

/* Counter page header - not sticky */
.counter-page .header {
    position: relative;
    top: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.brand-logo {
    width: 80px;
    height: 80px;
    border-radius: 14px;
    object-fit: contain;
}

.brand-text h1,
.brand-text .brand-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    display: block;
    line-height: 1.2;
}

.page-wrapper.dark .brand-text h1,
.page-wrapper.dark .brand-text .brand-name {
    color: var(--text-dark);
}

.brand-text span {
    font-size: 11px;
    color: #718096;
    line-height: 1.2;
    margin-top: 0;
}

/* ========================================
   Theme Toggle Button
   ======================================== */
.theme-toggle {
    width: 44px;
    height: 44px;
    border: 2px solid #d4af37;
    border-radius: 12px;
    background: linear-gradient(135deg, #fff9e6, #fff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .3s;
    padding: 0;
}

.theme-toggle:hover {
    transform: scale(1.05);
}

.page-wrapper.dark .theme-toggle {
    background: linear-gradient(135deg, #2d3748, #1a202c);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    fill: #d4af37;
}

.theme-toggle .sun-icon {
    display: none;
}

.page-wrapper.dark .theme-toggle .sun-icon {
    display: block;
}

.page-wrapper.dark .theme-toggle .moon-icon {
    display: none;
}


/* ========================================
   Hero Section
   ======================================== */
.hero-section {
    text-align: center;
    padding: 50px 20px 30px;
    position: relative;
    z-index: 1;
    width: 100%;
}

.hero-icon {
    font-size: 70px;
    margin-bottom: 20px;
    display: block;
}

.hero-title {
    font-size: 38px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    font-family: 'Amiri', serif;
}

.page-wrapper.dark .hero-title {
    color: var(--text-dark);
}

.hero-subtitle {
    font-size: 16px;
    color: #718096;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

.page-wrapper.dark .hero-subtitle {
    color: #a0aec0;
}

.hero-verse {
    font-family: 'Amiri', serif;
    font-size: 24px;
    color: var(--accent);
    margin-bottom: 8px;
    direction: rtl;
}

.hero-verse-translation {
    font-size: 14px;
    color: #718096;
    font-style: italic;
}

.page-wrapper.dark .hero-verse-translation {
    color: #a0aec0;
}

.title-decoration {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    margin: 24px auto;
    border-radius: 2px;
}

.title-decoration.wide {
    width: 80px;
    margin: 30px auto;
}

/* ========================================
   Content Container
   ======================================== */
.content-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px 60px;
    position: relative;
    z-index: 1;
    width: 100%;
}

@media (min-width: 1600px) {
    .content-container {
        max-width: 1600px;
        padding: 0 60px 60px;
    }
}

@media (max-width: 768px) {
    .content-container {
        padding: 0 20px 60px;
    }
}

/* ========================================
   Section Styles
   ======================================== */
.section-icon {
    font-size: 50px;
    margin-bottom: 20px;
    display: block;
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    font-family: 'Amiri', serif;
}

.page-wrapper.dark .section-title {
    color: var(--text-dark);
}

.section-text {
    font-size: 16px;
    line-height: 1.8;
    color: #4a5568;
    max-width: 700px;
    margin: 0 auto;
}

.page-wrapper.dark .section-text {
    color: #cbd5e0;
}

/* ========================================
   Cards
   ======================================== */
.info-card {
    background: rgba(255, 255, 255, .7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(212, 175, 55, .1);
    transition: all .3s;
}

.info-card:hover {
    border-color: rgba(212, 175, 55, .25);
}

.page-wrapper.dark .info-card {
    background: rgba(255, 255, 255, .05);
}

.info-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.info-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(212, 175, 55, .15), rgba(212, 175, 55, .05));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.info-card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.page-wrapper.dark .info-card-header h3 {
    color: var(--text-dark);
}

.info-card p {
    font-size: 14px;
    color: #718096;
    line-height: 1.7;
}

.page-wrapper.dark .info-card p {
    color: #a0aec0;
}

.info-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    margin-top: 8px;
    transition: all .2s;
}

.info-link:hover {
    gap: 10px;
}

/* ========================================
   Footer
   ======================================== */
.footer {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(212, 175, 55, 0.15);
    position: relative;
    z-index: 1;
    width: 100%;
}

.page-wrapper.dark .footer {
    background: rgba(30, 30, 50, 0.6);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 28px;
    padding: 22px 20px;
    flex-wrap: wrap;
}

.footer-link {
    font-size: 12px;
    color: #64748b;
    text-decoration: none;
    transition: all .2s;
    font-weight: 500;
}

.footer-link:hover {
    color: var(--accent);
}

.page-wrapper.dark .footer-link {
    color: #94a3b8;
}

.footer-bottom {
    background: rgba(0, 0, 0, 0.03);
    padding: 14px 20px;
    text-align: center;
}

.page-wrapper.dark .footer-bottom {
    background: rgba(0, 0, 0, 0.15);
}

.footer-copyright {
    font-size: 11px;
    color: #64748b;
    margin: 0;
}

.page-wrapper.dark .footer-copyright {
    color: #94a3b8;
}

.footer-copyright a {
    color: #1a6b3c;
    text-decoration: underline;
}

.page-wrapper.dark .footer-copyright a {
    color: var(--accent);
}

.footer-copyright a:hover {
    color: #145530;
    text-decoration: underline;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 12px;
    }
    
    .brand {
        flex-direction: column;
        text-align: center;
    }
    
    /* Counter page header stays horizontal */
    .counter-page .header {
        flex-direction: row !important;
        gap: 0;
    }
    
    .counter-page .brand {
        flex-direction: row !important;
        text-align: left;
    }
    
    .hero-title {
        font-size: 30px;
    }
    
    .hero-verse {
        font-size: 20px;
    }
    
    .footer-links {
        gap: 16px;
    }
}