/* =====================================================
   appstoryo.com — Main Stylesheet
   appstoryo.com Main Stylesheet
   - Custom utility classes (no framework)
   - Minimal footprint
   - Same grid system and spacing scale
   ===================================================== */

/* --- Font Face (self-hosted, no external requests) --- */
@font-face {
    font-family: 'Source Sans Pro';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: local('Source Sans Pro Light'),
         url('/fonts/source-sans-pro-300.woff2') format('woff2');
}
@font-face {
    font-family: 'Source Sans Pro';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: local('Source Sans Pro Regular'),
         url('/fonts/source-sans-pro-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Source Sans Pro';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: local('Source Sans Pro SemiBold'),
         url('/fonts/source-sans-pro-600.woff2') format('woff2');
}
@font-face {
    font-family: 'Source Sans Pro';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: local('Source Sans Pro Bold'),
         url('/fonts/source-sans-pro-700.woff2') format('woff2');
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    line-height: 1.7rem;
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #fafaff;
    color: #1a1a1a;
}
img { max-width: 100%; height: auto; object-fit: cover; }
a { text-decoration: none; color: #1a1a1a; }
ul, ol { list-style: none; }
input, textarea { padding: 0.6rem 0.8rem; border: 1px solid #f5af19; border-radius: 50vh; font-size: 0.9rem; font-family: inherit; }
textarea { width: 100%; border-radius: 0.5rem; }
time { font-size: 0.8rem; color: #666; }

/* --- Color Utilities --- */
.primary-text { color: #f5af19; }
.secondary-text { color: #f12711; }
.white-text { color: #fff; }
.black-text { color: #1a1a1a; }
.primary-bg { background-color: #f5af19; }
.secondary-bg { background-color: #f12711; }
.white-bg { background-color: #fff; }

/* --- Spacing Utilities --- */
.px-1 { padding-left: 0.4rem; padding-right: 0.4rem; }
.px-2 { padding-left: 0.8rem; padding-right: 0.8rem; }
.px-3 { padding-left: 1.6rem; padding-right: 1.6rem; }
.px-4 { padding-left: 3.2rem; padding-right: 3.2rem; }
.py-1 { padding-top: 0.4rem; padding-bottom: 0.4rem; }
.py-2 { padding-top: 0.8rem; padding-bottom: 0.8rem; }
.py-3 { padding-top: 1.6rem; padding-bottom: 1.6rem; }
.py-4 { padding-top: 3.2rem; padding-bottom: 3.2rem; }
.mx-1 { margin-left: 0.4rem; margin-right: 0.4rem; }
.mx-2 { margin-left: 0.8rem; margin-right: 0.8rem; }
.mx-3 { margin-left: 1.6rem; margin-right: 1.6rem; }
.my-1 { margin-top: 0.4rem; margin-bottom: 0.4rem; }
.my-2 { margin-top: 0.8rem; margin-bottom: 0.8rem; }
.my-3 { margin-top: 1.6rem; margin-bottom: 1.6rem; }
.my-4 { margin-top: 3.2rem; margin-bottom: 3.2rem; }

/* --- Flexbox Utilities --- */
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.gap-1 { gap: 0.4rem; }
.gap-2 { gap: 0.8rem; }

/* --- Grid (same 12-col pattern) --- */
.row { display: flex; flex-wrap: wrap; }
.col-3 { flex-basis: calc(25% - 1rem); margin-left: 0.5rem; margin-right: 0.5rem; }
.col-4 { flex-basis: calc(33.333% - 1rem); margin-left: 0.5rem; margin-right: 0.5rem; }
.col-6 { flex-basis: calc(50% - 1rem); margin-left: 0.5rem; margin-right: 0.5rem; }
.col-8 { flex-basis: calc(66.666% - 1rem); margin-left: 0.5rem; margin-right: 0.5rem; }
.col-12 { flex-basis: calc(100% - 1rem); margin-left: 0.5rem; margin-right: 0.5rem; }

/* --- Container --- */
.container { width: 1320px; margin-left: auto; margin-right: auto; }

/* --- Shadows --- */
.shadow { box-shadow: rgba(0,0,0,0.08) 0px 4px 12px; }
.shadow-lg { box-shadow: rgba(0,0,0,0.15) 0px 2px 8px; }

/* --- Buttons --- */
.btn { padding: 0.5rem 1rem; border-radius: 50vh; font-size: 1rem; cursor: pointer; border: none; font-family: inherit; }
.btn-primary { background-color: #f5af19; color: #1a1a1a; border: 1px solid #f5af19; }
.btn-primary:hover { background-color: #e6a010; }
.btn-secondary { background-color: #fff; color: #1a1a1a; border: 1px solid #ddd; }

/* --- Header --- */
.main-header { border-bottom: 1px solid #dfdfdf; padding: 0.5rem 0; background: #fff; }
.nav { flex-direction: row; justify-content: space-between; align-items: center; }
.logo img { height: 2.5rem; }
.logo-text { font-size: 1.4rem; font-weight: 700; color: #1a1a1a; }
.logo-text span { color: #f5af19; }
.main-nav li { padding: 0 1rem; font-weight: 700; font-size: 1.05rem; }
.mobile-nav, .mobile-menu { display: none; }

/* --- Language Switcher --- */
.lang-switch { position: relative; }
.lang-switch select { padding: 0.3rem 0.5rem; border: 1px solid #ddd; border-radius: 0.25rem; font-size: 0.85rem; background: #fff; cursor: pointer; font-family: inherit; }

/* --- Hero --- */
.hero { position: relative; border-radius: 0.75rem; overflow: hidden; margin-top: 1.6rem; }
.hero img { height: 22rem; width: 100%; object-fit: cover; object-position: center 30%; transform: scale(1.25); }
.hero-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(135deg, rgba(0,0,0,0.45), rgba(0,0,0,0.3)); }
.hero-content { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; color: #fff; width: 80%; }
.hero-content h1 { font-size: 2.6rem; margin-bottom: 0.4rem; line-height: 1.2; text-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.hero-content p { font-size: 1.15rem; margin: 0.5rem 0 0.9rem; text-shadow: 0 1px 4px rgba(0,0,0,0.4); }
.hero-content span { color: #f5af19; font-weight: 700; }
.hero-content form { display: flex; max-width: 500px; margin: 0 auto; }
.hero-content input { flex: 1; border-top-right-radius: 0; border-bottom-right-radius: 0; border-color: #fff; background: rgba(255,255,255,0.95); }
.hero-content button { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* --- Section Headers --- */
.section-header { font-size: 1.5rem; margin-left: 0.5rem; margin-bottom: 0.5rem; }

/* --- Article Card (grid item) --- */
.main-article { background: #fff; border-radius: 0.5rem; overflow: hidden; transition: box-shadow 0.2s; }
.main-article:hover { box-shadow: rgba(0,0,0,0.15) 0px 6px 20px; }
.main-article img { width: 100%; height: 180px; object-fit: cover; }
.article-content { padding-bottom: 0.8rem; }
.article-content h3 { font-weight: 400; font-size: 1.05rem; margin: 0.4rem 0; line-height: 1.3; }
.main-article .primary-text { margin: 0; color: #f5af19; font-size: 0.9rem; }

/* --- Secondary Article (list item) --- */
.secondary-article { border-radius: 0.5rem; overflow: hidden; background: #fff; }
.secondary-article .d-flex { gap: 0; }
.secondary-article .img-fluid { width: 30%; min-height: 120px; object-fit: cover; }
.secondary-article-content { flex: 1; }
.secondary-article-content h3 { font-weight: 500; font-size: 1.05rem; margin: 0; line-height: 1.3; }
.secondary-article-content p { font-weight: 300; margin: 0.4rem 0; font-size: 0.9rem; }

/* --- Rating Widget (same CSS overlay approach) --- */
.rating-widget { position: relative; width: calc(5 * 20px); height: 16px; }
.rating-widget .stars-bg { color: #ddd; }
.rating-widget .stars-fg { position: absolute; top: 0; left: 0; color: #f5af19; overflow: hidden; white-space: nowrap; }

/* --- Left Line Decoration --- */
.left-line { position: relative; }
.left-line::before { content: ""; position: absolute; bottom: 0; left: -1.5rem; width: 0.5rem; border-radius: 50vh; height: 100%; background: linear-gradient(#f5af19, #f12711); }

/* --- Detail Hero --- */
.detail-hero-content { margin-left: 2.3rem; width: calc(100% - 2.3rem); background: #fff; border-radius: 0.5rem; }
.detail-hero-content h1 { margin: 0.4rem 0 0; font-size: 1.8rem; line-height: 1.3; }
.detail-hero-content p { margin: 0.4rem 0; font-size: 1rem; }

/* --- App Info Sidebar --- */
.app-info { background: #fff; border-radius: 0.5rem; }
.app-info-row { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid #f0f0f0; }
.app-info-label { font-weight: 300; color: #666; }
.app-info-value { font-weight: 600; }
.app-logo { width: 80px; height: 80px; border-radius: 1rem; object-fit: cover; }

/* --- Pros/Cons --- */
.pros-cons { display: flex; gap: 1.6rem; }
.pros-list, .cons-list { flex: 1; }
.pros-list li::before { content: "+"; color: #22c55e; font-weight: 700; margin-right: 0.5rem; }
.cons-list li::before { content: "-"; color: #ef4444; font-weight: 700; margin-right: 0.5rem; }

/* --- Sidebar --- */
.aside-section { margin-bottom: 1.6rem; }
.aside-section h2 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.aside-category { padding-left: 0; }
.aside-category li { border-bottom: 1px solid #efefef; font-weight: 400; position: relative; }
.aside-category li::before { content: ""; position: absolute; bottom: 10%; left: 0; width: 0.2rem; border-radius: 50vh; height: 80%; background: linear-gradient(#f5af19, #f12711); }
.aside-category li a { margin-left: 1rem; display: block; padding: 0.4rem 0; }

/* --- Breadcrumbs --- */
.breadcrumbs { font-size: 0.85rem; color: #666; }
.breadcrumbs a { color: #f5af19; }
.breadcrumbs span { margin: 0 0.3rem; }

/* --- Article Body --- */
.article-body h2 { margin: 1.5rem 0 0.5rem; font-size: 1.4rem; }
.article-body h3 { margin: 1.2rem 0 0.4rem; font-size: 1.15rem; font-weight: 600; }
.article-body p { margin: 0.5rem 0; line-height: 1.8; }
.article-body img { border-radius: 0.5rem; margin: 1rem 0; }
.article-body ul, .article-body ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.article-body li { margin: 0.3rem 0; line-height: 1.7; }
.article-body a { color: #f5af19; }

/* --- Category Badge --- */
.category-badge { display: inline-block; font-weight: 600; color: #f5af19; font-size: 0.9rem; }

/* --- Footer --- */
.footer { background: #fff; border-top: 1px solid #efefef; }
.footer p { font-weight: 300; font-size: 0.9rem; }
.footer h3 { margin-top: 1rem; font-weight: 600; font-size: 1.05rem; }
.footer-logo { height: 2rem; margin-bottom: 0.5rem; }
.footer-category { padding-left: 0; }
.footer-category li { border-bottom: 1px solid #efefef; }
.footer-category li a { display: block; padding: 0.4rem 0; font-size: 0.9rem; }
.footer-bottom { text-align: center; font-size: 0.8rem; color: #999; padding: 1rem 0; }

/* --- Menu Dropdown --- */
.menu-wrapper { border-bottom: 1px solid #eee; display: none; background: #fff; }
.menu-wrapper-inner { display: flex; flex-wrap: wrap; }
.category-list { width: 200px; }
.category-list h4 { margin-bottom: 0; }
.top-category { padding-left: 0; margin-top: 0.4rem; }

/* --- Forms --- */
.input-group { margin-bottom: 0.5rem; }
.input-group label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 0.2rem; }
.input-group input { width: 100%; }
.form-wrapper { max-width: 600px; }

/* --- 404 Page --- */
.error-page { text-align: center; padding: 4rem 0; }
.error-page h1 { font-size: 4rem; color: #f5af19; }
.error-page p { font-size: 1.2rem; margin: 1rem 0; }

/* --- Search Results --- */
.search-header input { width: 100%; max-width: 500px; }

/* --- Responsive --- */
@media (max-width: 1400px) { .container { width: 1140px; } }
@media (max-width: 1200px) { .container { width: 960px; } }
@media (max-width: 992px) { .container { width: 720px; } }
@media (max-width: 768px) {
    .container { width: 540px; }
    .col-3, .col-4 { flex-basis: calc(50% - 1rem); }
    .hero-content h1 { font-size: 2rem; }
    .pros-cons { flex-direction: column; }
}
@media (max-width: 576px) {
    .container { width: 100%; padding: 0 0.8rem; }
    .desktop-nav { display: none; }
    .mobile-nav { display: flex; align-items: center; }
    .mobile-nav li { margin: 0 1rem; font-weight: 600; font-size: 1.1rem; }
    .mobile-nav li svg { width: 1.5rem; height: 1.5rem; margin-top: 0.3rem; }
    .mobile-menu ul { padding-left: 0; margin: 0 2rem; }
    .mobile-menu li { border-bottom: 1px solid #999; }
    .hero-content { width: 90%; }
    .hero-content h1 { font-size: 1.6rem; }
    .logo { margin-left: 1rem; }
    .col-3, .col-4, .col-6, .col-8 { flex-basis: calc(100% - 2rem); margin: 0.5rem 1rem; }
    .detail-hero-content { margin-left: 1rem; margin-right: 1rem; width: calc(100% - 2rem); }
    .main-header { padding: 0.3rem 0; }
    .secondary-article .img-fluid { width: 35%; }
}

/* --- RTL Support (Arabic) --- */
[dir="rtl"] { text-align: right; }
[dir="rtl"] .d-flex { flex-direction: row-reverse; }
[dir="rtl"] .nav { flex-direction: row-reverse; }
[dir="rtl"] .secondary-article .d-flex { flex-direction: row-reverse; }
[dir="rtl"] .aside-category li::before { left: auto; right: 0; }
[dir="rtl"] .aside-category li a { margin-left: 0; margin-right: 1rem; }
[dir="rtl"] .left-line::before { left: auto; right: -1.5rem; }
[dir="rtl"] .detail-hero-content { margin-left: 0; margin-right: 2.3rem; }
[dir="rtl"] .breadcrumbs { direction: rtl; }
[dir="rtl"] .pros-list li::before, [dir="rtl"] .cons-list li::before { margin-right: 0; margin-left: 0.5rem; }

/* --- Auth & Dashboard --- */
.auth-error { background: #fef2f2; border: 1px solid #fca5a5; border-radius: 0.5rem; color: #b91c1c; font-size: 0.9rem; }
.auth-success { background: #f0fdf4; border: 1px solid #86efac; border-radius: 0.5rem; color: #166534; font-size: 0.9rem; }
.auth-pending { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 0.5rem; color: #92400e; font-size: 0.9rem; }
.auth-message { text-align: center; }
.about-cta { text-align: center; }
.about-cta .btn { font-size: 1.1rem; padding: 0.7rem 2rem; }
.status-badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 50vh; font-size: 0.75rem; font-weight: 600; }
.status-draft { background: #f3f4f6; color: #6b7280; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-published { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.dashboard-article { transition: box-shadow 0.2s; }
.dashboard-article:hover { box-shadow: rgba(0,0,0,0.15) 0px 6px 20px; }
