/*
Theme Name: ProjectSarthi
Theme URI: https://projectsarthi.com
Author: ProjectSarthi Team
Author URI: https://projectsarthi.com
Description: Government scheme discovery platform — browse 4600+ schemes by category, state, ministry. Clean, fast, SEO-optimized.
Version: 2.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GPL v2 or later
Text Domain: projectsarthi
Tags: government, schemes, portal, accessible, mobile-first
*/

/* ============ CSS VARIABLES ============ */
:root {
    --ps-primary: #0b5394;
    --ps-primary-dark: #073763;
    --ps-primary-light: #3d85c6;
    --ps-accent: #e8792f;
    --ps-accent-light: #f5a623;
    --ps-green: #0f9d58;
    --ps-red: #d93025;
    --ps-bg: #f4f6f9;
    --ps-white: #ffffff;
    --ps-text: #1a1a2e;
    --ps-text-light: #5f6368;
    --ps-border: #dadce0;
    --ps-card-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --ps-card-hover: 0 4px 12px rgba(0,0,0,0.12);
    --ps-radius: 8px;
    --ps-radius-lg: 12px;
    --ps-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ps-max-w: 1200px;
    --ps-header-h: 64px;
}

/* ============ RESET & BASE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--ps-font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--ps-text);
    background: var(--ps-bg);
    overflow-x: hidden;
}
a { color: var(--ps-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--ps-primary-dark); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
h1, h2, h3, h4, h5 { line-height: 1.3; color: var(--ps-text); }
h1 { font-size: 28px; } h2 { font-size: 22px; } h3 { font-size: 18px; }
.ps-container { max-width: var(--ps-max-w); margin: 0 auto; padding: 0 20px; }
.screen-reader-text { clip: rect(1px,1px,1px,1px); position: absolute !important; height: 1px; width: 1px; overflow: hidden; }

/* ============ HEADER ============ */
.ps-header {
    background: linear-gradient(135deg, var(--ps-primary-dark), var(--ps-primary));
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.ps-header-inner {
    max-width: var(--ps-max-w);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--ps-header-h);
}
.ps-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}
.ps-logo img { height: 36px; width: auto; }
.ps-logo span { color: var(--ps-accent-light); }

/* Nav */
.ps-nav { display: flex; align-items: center; gap: 4px; }
.ps-nav a {
    color: rgba(255,255,255,0.85);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.ps-nav a:hover, .ps-nav a.active { background: rgba(255,255,255,0.15); color: #fff; }

/* Mobile Toggle */
.ps-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}
.ps-mobile-nav {
    display: none;
    position: fixed;
    top: var(--ps-header-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--ps-primary-dark);
    z-index: 999;
    padding: 20px;
    overflow-y: auto;
}
.ps-mobile-nav.active { display: block; }
.ps-mobile-nav a {
    display: block;
    color: #fff;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 16px;
}

/* ============ HERO / SEARCH ============ */
.ps-hero {
    background: linear-gradient(135deg, var(--ps-primary-dark) 0%, var(--ps-primary) 50%, var(--ps-primary-light) 100%);
    color: #fff;
    padding: 48px 0 56px;
    text-align: center;
}
.ps-hero h1 { font-size: 32px; font-weight: 700; margin-bottom: 8px; color: #fff; }
.ps-hero p { font-size: 16px; opacity: 0.9; margin-bottom: 28px; }
.ps-search-box {
    max-width: 620px;
    margin: 0 auto;
    position: relative;
}
.ps-search-box input {
    width: 100%;
    padding: 14px 52px 14px 20px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-family: var(--ps-font);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    outline: none;
}
.ps-search-box input::placeholder { color: #999; }
.ps-search-box button {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--ps-accent);
    color: #fff;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.ps-search-box button:hover { background: var(--ps-accent-light); }

/* Hero Stats */
.ps-hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 32px;
}
.ps-hero-stat { text-align: center; }
.ps-hero-stat strong { display: block; font-size: 28px; font-weight: 800; }
.ps-hero-stat span { font-size: 13px; opacity: 0.8; }

/* ============ CATEGORIES GRID ============ */
.ps-section { padding: 40px 0; }
.ps-section-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ps-section-title a { font-size: 14px; font-weight: 500; margin-left: auto; color: var(--ps-primary); }

.ps-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}
.ps-cat-card {
    background: var(--ps-white);
    border-radius: var(--ps-radius);
    padding: 20px 16px;
    text-align: center;
    box-shadow: var(--ps-card-shadow);
    transition: all 0.25s;
    border: 1px solid var(--ps-border);
    text-decoration: none;
    color: var(--ps-text);
}
.ps-cat-card:hover {
    box-shadow: var(--ps-card-hover);
    transform: translateY(-2px);
    border-color: var(--ps-primary-light);
    color: var(--ps-primary);
}
.ps-cat-card .cat-icon { font-size: 32px; margin-bottom: 10px; display: block; }
.ps-cat-card .cat-name { font-size: 14px; font-weight: 600; display: block; }
.ps-cat-card .cat-count { font-size: 12px; color: var(--ps-text-light); margin-top: 4px; display: block; }

/* ============ SCHEME CARDS (LIST) ============ */
.ps-schemes-list { display: flex; flex-direction: column; gap: 16px; }
.ps-scheme-card {
    background: var(--ps-white);
    border-radius: var(--ps-radius);
    padding: 20px 24px;
    box-shadow: var(--ps-card-shadow);
    border: 1px solid var(--ps-border);
    transition: all 0.2s;
    display: block;
    color: var(--ps-text);
    text-decoration: none;
}
.ps-scheme-card:hover { box-shadow: var(--ps-card-hover); border-color: var(--ps-primary-light); }
.ps-scheme-card h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; color: var(--ps-primary-dark); }
.ps-scheme-card .scheme-desc { font-size: 14px; color: var(--ps-text-light); line-height: 1.5; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ps-scheme-card .scheme-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ps-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #e8f0fe;
    color: var(--ps-primary);
}
.ps-tag.central { background: #e6f4ea; color: #137333; }
.ps-tag.state { background: #fef7e0; color: #b06000; }
.ps-tag.ministry { background: #f3e8fd; color: #7627bb; }
.ps-tag.category { background: #e8f0fe; color: var(--ps-primary); }

/* Grid view */
.ps-schemes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* ============ SINGLE SCHEME ============ */
.ps-single-hero {
    background: linear-gradient(135deg, var(--ps-primary-dark), var(--ps-primary));
    color: #fff;
    padding: 32px 0;
}
.ps-single-hero h1 { font-size: 26px; color: #fff; margin-bottom: 8px; }
.ps-single-hero .scheme-short { font-size: 14px; opacity: 0.8; margin-bottom: 12px; }
.ps-single-hero .scheme-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.ps-single-hero .ps-tag { background: rgba(255,255,255,0.15); color: #fff; }

/* Breadcrumb */
.ps-breadcrumb {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 12px;
}
.ps-breadcrumb a { color: rgba(255,255,255,0.85); }
.ps-breadcrumb a:hover { color: #fff; }

/* Tabs */
.ps-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--ps-border); margin-bottom: 24px; overflow-x: auto; }
.ps-tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ps-text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    background: none;
    border-top: none; border-left: none; border-right: none;
    font-family: var(--ps-font);
    transition: all 0.2s;
}
.ps-tab:hover { color: var(--ps-primary); }
.ps-tab.active { color: var(--ps-primary); border-bottom-color: var(--ps-primary); }
.ps-tab-content { display: none; }
.ps-tab-content.active { display: block; }

/* Content area */
.ps-content-area {
    background: var(--ps-white);
    border-radius: var(--ps-radius-lg);
    padding: 28px 32px;
    box-shadow: var(--ps-card-shadow);
    border: 1px solid var(--ps-border);
    margin-bottom: 24px;
}
.ps-content-area h2 { font-size: 20px; margin-bottom: 16px; color: var(--ps-primary-dark); border-bottom: 2px solid #e8f0fe; padding-bottom: 8px; }
.ps-content-area h3 { font-size: 17px; margin: 16px 0 8px; }
.ps-content-area p { margin-bottom: 12px; }
.ps-content-area ul, .ps-content-area ol { margin: 12px 0; padding-left: 24px; }
.ps-content-area ul { list-style: disc; }
.ps-content-area ol { list-style: decimal; }
.ps-content-area li { margin-bottom: 6px; }
.ps-content-area table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.ps-content-area th, .ps-content-area td { padding: 10px 12px; border: 1px solid var(--ps-border); text-align: left; font-size: 14px; }
.ps-content-area th { background: #f8f9fa; font-weight: 600; }
.ps-content-area a { color: var(--ps-primary); text-decoration: underline; }

/* Sidebar info */
.ps-sidebar-card {
    background: var(--ps-white);
    border-radius: var(--ps-radius);
    padding: 20px;
    box-shadow: var(--ps-card-shadow);
    border: 1px solid var(--ps-border);
    margin-bottom: 16px;
}
.ps-sidebar-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; color: var(--ps-primary-dark); }
.ps-info-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f1f3f4; font-size: 14px; }
.ps-info-row:last-child { border-bottom: none; }
.ps-info-row .label { color: var(--ps-text-light); }
.ps-info-row .value { font-weight: 600; }

.ps-apply-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--ps-green);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    width: 100%;
    justify-content: center;
}
.ps-apply-btn:hover { background: #0b8043; color: #fff; }

/* Share */
.ps-share { display: flex; gap: 8px; margin-top: 12px; }
.ps-share a {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    text-decoration: none;
    transition: transform 0.2s;
}
.ps-share a:hover { transform: scale(1.1); color: #fff; }
.ps-share .wa { background: #25D366; }
.ps-share .tw { background: #1DA1F2; }
.ps-share .fb { background: #4267B2; }
.ps-share .cp { background: var(--ps-text-light); }

/* FAQ accordion */
.ps-faq-item { border: 1px solid var(--ps-border); border-radius: var(--ps-radius); margin-bottom: 8px; overflow: hidden; }
.ps-faq-q {
    padding: 14px 18px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}
.ps-faq-q:hover { background: #e8f0fe; }
.ps-faq-q::after { content: '+'; font-size: 20px; color: var(--ps-primary); transition: transform 0.2s; }
.ps-faq-item.open .ps-faq-q::after { content: '−'; }
.ps-faq-a { padding: 0 18px; max-height: 0; overflow: hidden; transition: all 0.3s; }
.ps-faq-item.open .ps-faq-a { padding: 14px 18px; max-height: 500px; }

/* Layout */
.ps-single-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    padding: 28px 0;
}

/* ============ ARCHIVE / FILTER ============ */
.ps-archive-header {
    background: linear-gradient(135deg, var(--ps-primary-dark), var(--ps-primary));
    color: #fff;
    padding: 28px 0;
}
.ps-archive-header h1 { color: #fff; font-size: 24px; margin-bottom: 4px; }
.ps-archive-header p { opacity: 0.85; font-size: 14px; }

.ps-filter-bar {
    background: var(--ps-white);
    border-radius: var(--ps-radius);
    padding: 16px 20px;
    box-shadow: var(--ps-card-shadow);
    border: 1px solid var(--ps-border);
    margin: -20px auto 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    position: relative;
    z-index: 10;
}
.ps-filter-bar select, .ps-filter-bar input {
    padding: 8px 12px;
    border: 1px solid var(--ps-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: var(--ps-font);
    background: #fff;
    min-width: 160px;
}
.ps-filter-bar .ps-filter-btn {
    background: var(--ps-primary);
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--ps-font);
}
.ps-filter-bar .ps-filter-btn:hover { background: var(--ps-primary-dark); }

.ps-results-info { font-size: 14px; color: var(--ps-text-light); margin-bottom: 16px; }

/* Pagination */
.ps-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 32px 0;
}
.ps-pagination a, .ps-pagination span {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--ps-border);
    color: var(--ps-text);
    text-decoration: none;
    transition: all 0.2s;
}
.ps-pagination a:hover { border-color: var(--ps-primary); color: var(--ps-primary); }
.ps-pagination .current { background: var(--ps-primary); color: #fff; border-color: var(--ps-primary); }

/* ============ FOOTER ============ */
.ps-footer {
    background: var(--ps-primary-dark);
    color: rgba(255,255,255,0.8);
    padding: 40px 0 0;
    margin-top: 40px;
}
.ps-footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
    margin-bottom: 32px;
}
.ps-footer h3 { color: #fff; font-size: 16px; margin-bottom: 16px; }
.ps-footer a { color: rgba(255,255,255,0.7); font-size: 14px; display: block; padding: 4px 0; }
.ps-footer a:hover { color: #fff; }
.ps-footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 16px 0;
    font-size: 13px;
    text-align: center;
}
.ps-footer .disclaimer { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 8px; }

/* ============ BACK TO TOP ============ */
.ps-back-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--ps-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.2s;
}
.ps-back-top.visible { display: flex; }
.ps-back-top:hover { background: var(--ps-primary-dark); transform: translateY(-2px); }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
    .ps-single-layout { grid-template-columns: 1fr; }
    .ps-hero h1 { font-size: 24px; }
    .ps-hero-stats { gap: 24px; }
    .ps-hero-stat strong { font-size: 22px; }
    .ps-cat-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
@media (max-width: 768px) {
    .ps-nav { display: none; }
    .ps-menu-toggle { display: block; }
    .ps-header-inner { height: 56px; }
    :root { --ps-header-h: 56px; }
    .ps-hero { padding: 32px 0 40px; }
    .ps-hero-stats { flex-wrap: wrap; gap: 16px; }
    .ps-content-area { padding: 20px 16px; }
    .ps-filter-bar { flex-direction: column; }
    .ps-filter-bar select, .ps-filter-bar input { width: 100%; }
    .ps-schemes-grid { grid-template-columns: 1fr; }
    .ps-footer-grid { grid-template-columns: 1fr 1fr; }
    h1 { font-size: 22px; }
    h2 { font-size: 19px; }
}
@media (max-width: 480px) {
    .ps-cat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .ps-cat-card { padding: 14px 10px; }
    .ps-scheme-card { padding: 16px; }
    .ps-footer-grid { grid-template-columns: 1fr; }
}

/* ============ WORDPRESS ADMIN BAR FIX ============ */
.admin-bar .ps-header { top: 32px; }
@media (max-width: 782px) { .admin-bar .ps-header { top: 46px; } }

/* Print */
@media print {
    .ps-header, .ps-footer, .ps-back-top, .ps-share, .ps-filter-bar { display: none !important; }
    .ps-content-area { box-shadow: none; border: none; padding: 0; }
    body { background: #fff; }
}
