/* ===== EcoFinIRAN Theme - Main Styles ===== */

:root {
    --navy: #0b1a2a;
    --navy-dark: #070f1a;
    --navy-light: #132a40;
    --gold: #d4af37;
    --gold-light: #f0d080;
    --gold-dark: #b89130;
    --gold-glow: rgba(212, 168, 67, 0.2);
    --white: #ffffff;
    --cream: #f8f6f0;
    --text: #1e293b;
    --text-light: #475569;
    --text-muted: #94a3b8;
    --bg: #f5f3ef;
    --border: rgba(0,0,0,0.08);
    --shadow: 0 4px 20px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 3px; }

body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    direction: rtl;
    overflow-x: hidden;
}

a { color: var(--gold-dark); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--gold); }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Header ===== */
.site-header {
    background: var(--navy);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0,0,0,0.15);
    border-bottom: 2px solid var(--gold);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    gap: 20px;
}

.site-logo-text {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.5px;
}

.logo-eco { color: var(--white); }
.logo-fin { color: var(--gold); }
.logo-iran { color: var(--gold-light); }

.main-nav { position: relative; z-index: 1001; }

.nav-menu {
    list-style: none;
    display: flex;
    gap: 5px;
}

.nav-menu li { position: relative; }

.nav-menu li a {
    color: var(--cream);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    z-index: 10;
}

.nav-menu li a:hover,
.nav-menu li.current-menu-item a {
    background: rgba(212, 168, 67, 0.15);
    color: var(--gold-light);
}

/* Better emoji visibility in menu */
.nav-menu li a { text-shadow:0 0 2px rgba(0,0,0,0.3); }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.nav-toggle span {
    width: 26px;
    height: 3px;
    background: var(--gold);
    border-radius: 3px;
    transition: var(--transition);
}

/* ===== Hero Section ===== */
.hero {
    background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 30%, var(--navy-light) 70%, var(--navy-dark) 100%);
    position: relative;
    overflow: hidden;
    padding: 50px 20px 35px;
    text-align: center;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background:
        radial-gradient(ellipse 600px 600px at 20% 30%, rgba(212, 168, 67, 0.05) 0%, transparent 60%),
        radial-gradient(ellipse 400px 400px at 80% 70%, rgba(212, 168, 67, 0.03) 0%, transparent 60%);
    pointer-events: none;
    animation: heroFloat 30s ease-in-out infinite alternate;
}

@keyframes heroFloat {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(30px, -20px) rotate(3deg); }
}

.hero-content { position: relative; z-index: 1; }

.hero h1 {
    font-size: clamp(24px, 4vw, 42px);
    font-weight: 900;
    color: var(--white);
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.hero h1 .highlight {
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: clamp(14px, 1.8vw, 17px);
    color: rgba(255,255,255,0.7);
    max-width: 700px;
    margin: 0 auto 18px;
    line-height: 1.7;
}

.hero-buttons {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold), var(--gold-light));
    color: var(--navy-dark);
    box-shadow: 0 4px 20px rgba(212, 168, 67, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(212, 168, 67, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--gold);
    color: var(--gold-light);
}

.btn-outline:hover {
    background: rgba(212, 168, 67, 0.1);
    transform: translateY(-2px);
}

/* ===== Sections ===== */
.section {
    padding: 40px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: clamp(24px, 3.5vw, 36px);
    font-weight: 800;
    color: var(--navy);
    margin-bottom: 10px;
}

.section-header h2 .gold { color: var(--gold); }

.section-header p {
    color: var(--text-light);
    font-size: 16px;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== Tools Cards ===== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}


.tool-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 22px 20px;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-light));
    opacity: 0;
    transition: var(--transition);
}

.tool-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gold);
}

.tool-card:hover::before { opacity: 1; }

.tool-icon {
    width: 64px; height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, rgba(212,168,67,0.1), rgba(212,168,67,0.05));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.tool-card h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--navy);
}

.tool-card p {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 10px;
    line-height: 1.6;
}

.tool-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--gold-dark);
}

/* ===== Stats ===== */
.stats-section {
    background: var(--navy);
    position: relative;
    overflow: hidden;
}

.stats-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 500px 500px at 30% 50%, rgba(212,168,67,0.04) 0%, transparent 60%),
        radial-gradient(ellipse 400px 400px at 70% 50%, rgba(212,168,67,0.02) 0%, transparent 60%);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    position: relative;
    z-index: 1;
}

.stat-item {
    text-align: center;
    padding: 20px;
}

.stat-number {
    font-size: clamp(36px, 5vw, 52px);
    font-weight: 900;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
}

.stat-label {
    font-size: 15px;
    color: rgba(255,255,255,0.7);
    margin-top: 4px;
    display: block;
}

/* ===== About Section ===== */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-content p {
    font-size: 16px;
    color: var(--text-light);
    line-height: 2;
    margin-bottom: 16px;
}

/* ===== Contact Section ===== */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.contact-info h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 16px;
}

.contact-info p {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 15px;
    color: var(--text-light);
}

.contact-info p i {
    width: 20px;
    color: var(--gold);
    font-size: 18px;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    margin-bottom: 14px;
    transition: var(--transition);
    background: var(--white);
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

.contact-form textarea {
    height: 120px;
    resize: vertical;
}

.contact-form .btn {
    width: 100%;
    justify-content: center;
}

/* ===== Footer ===== */
.site-footer {
    background: var(--navy-dark);
    color: rgba(255,255,255,0.8);
    border-top: 3px solid var(--gold);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
    padding: 50px 20px;
}

.footer-col h4 {
    color: var(--gold-light);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 14px;
    position: relative;
    padding-bottom: 8px;
}

.footer-col h4::after {
    content: '';
    position: absolute;
    bottom: 0; right: 0;
    width: 40px; height: 2px;
    background: var(--gold);
}

.footer-col p {
    font-size: 14px;
    line-height: 1.8;
    color: rgba(255,255,255,0.6);
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 8px;
}

.footer-col ul li a {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    text-align: justify;
    transition: var(--transition);
}

.footer-col ul li a:hover {
    color: var(--gold-light);
}

.footer-bottom {
    border-top: 1px solid rgba(212,168,67,0.15);
    padding: 16px 0;
    text-align: center;
    font-size: 13px;
    color: rgba(255,255,255,0.4);
}

/* ===== Page Content ===== */
.page-content {
    padding: 50px 0;
    min-height: 60vh;
}

.page-content h1 {
    font-size: 32px;
    font-weight: 800;
    color: var(--navy);
    margin-bottom: 24px;
}

.page-content h1::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--gold);
    margin-top: 8px;
}

/* ===== Books & Articles ===== */
.section-body-content {
    max-width: 900px;
    margin: 0 auto;
}

.pub-list {
    list-style: none;
    counter-reset: pub-counter;
}

.pub-list li {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    position: relative;
    padding-right: 36px;
    counter-increment: pub-counter;
    line-height: 1.8;
    text-align: justify;
}

.pub-list li::before {
    content: counter(pub-counter);
    color: #fff;
    background: var(--gold);
    position: absolute;
    right: 0; top: 14px;
    width: 26px; height: 26px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    line-height: 26px;
}

.pub-list li:last-child { border-bottom: none; }

.pub-list li a {
    color: var(--navy);
    font-weight: 500;
}

.pub-list li a:hover { color: var(--gold-dark); }

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.book-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 28px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.book-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gold);
}

.book-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 6px;
}

.book-card .book-authors {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.book-card .book-publisher {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.book-card .book-desc {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.7;
}

.book-card .book-links {
    margin-top: 12px;
}

.book-card .book-links a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gold-dark);
    padding: 6px 14px;
    border: 1px solid var(--gold);
    border-radius: 8px;
    transition: var(--transition);
}

.book-card .book-links a:hover {
    background: var(--gold);
    color: var(--navy-dark);
}

/* ===== 404 ===== */
.error-404 {
    text-align: center;
    padding: 100px 20px;
}

.error-404 h1 { font-size: 80px; color: var(--gold); }
.error-404 p { font-size: 18px; color: var(--text-light); margin: 16px 0; }

/* ===== Tool Pages ===== */
.tool-page-wrapper {
    padding: 0;
    background: var(--bg);
}

.tool-page-header {
    background: var(--navy);
    padding: 30px 20px;
    text-align: center;
}

.tool-page-header h1 {
    color: var(--white);
    font-size: 26px;
    margin: 0;
}

.tool-page-header h1::after { display: none; }

.tool-page-body {
    padding: 30px 0;
    min-height: 70vh;
}

/* ===== Blog ===== */
.blog-wrapper {
    background: var(--bg);
    padding: 40px 0;
    min-height: 60vh;
}
.blog-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}
.blog-archive-header {
    text-align: center;
    margin-bottom: 36px;
}
.blog-archive-header h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--navy);
}
.blog-archive-header p {
    font-size: 15px;
    color: var(--text-light);
    margin-top: 6px;
}
.blog-archive-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 10px;
}

/* Single Post */
.blog-single {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.blog-header {
    padding: 32px 32px 0;
}
.blog-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--navy);
    margin-bottom: 10px;
    line-height: 1.5;
}
.blog-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.blog-meta a { color: var(--gold-dark); font-weight: 600; }
.blog-meta a:hover { color: var(--gold); }
.blog-sep { margin: 0 6px; color: var(--border); }
.blog-thumb img {
    width: 100%;
    height: auto;
    display: block;
}
.blog-body {
    padding: 28px 32px;
    font-size: 15px;
    line-height: 2;
    color: var(--text);
    text-align: justify;
}
.blog-body p { margin-bottom: 18px; }
.blog-body h2, .blog-body h3, .blog-body h4 {
    color: var(--navy);
    font-weight: 700;
    margin: 28px 0 14px;
}
.blog-body h2 { font-size: 22px; }
.blog-body h3 { font-size: 18px; }
.blog-body ul, .blog-body ol { margin: 0 20px 18px; }
.blog-body li { margin-bottom: 6px; }
.blog-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 16px 0; }
.blog-body blockquote {
    border-right: 4px solid var(--gold);
    padding: 12px 20px;
    margin: 20px 0;
    background: rgba(212,168,67,0.05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-light);
    font-style: italic;
}
.blog-body table { width: 100%; border-collapse: collapse; margin: 16px 0; max-width: 100%; table-layout: auto; }
.blog-body th, .blog-body td { padding: 10px 14px; border: 1px solid var(--border); text-align: justify; white-space: normal; word-break: break-word; }
.blog-body th { background: var(--navy); color: var(--white); font-weight: 700; text-align: center; }
.blog-body td { background: var(--white); }
/* override any inline style that might cause overflow */
.blog-body table[style] { width: 100% !important; max-width: 100% !important; white-space: normal !important; }
/* Table 1: وضعیت - center align */
.blog-body table:first-of-type th,
.blog-body table:first-of-type td { text-align: center; }
/* Table 2: یونانی‌ها - 2nd column fit content */
.blog-body table:nth-of-type(2) th:nth-child(2),
.blog-body table:nth-of-type(2) td:nth-child(2) { width: 1%; white-space: nowrap; }
/* Table 4: گام دوم - 1st & 2nd columns fit content */
.blog-body table:nth-of-type(4) th:nth-child(-n+2),
.blog-body table:nth-of-type(4) td:nth-child(-n+2) { width: 1%; white-space: nowrap; }
/* Table 5: خطاها - 1st column fit content */
.blog-body table:nth-of-type(5) th:first-child,
.blog-body table:nth-of-type(5) td:first-child { width: 1%; white-space: nowrap; }
.blog-body pre, .blog-body code {
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    direction: ltr;
    text-align: left;
}
.blog-body code { padding: 2px 6px; font-size: 13px; }
.blog-body pre { padding: 16px; overflow-x: auto; margin: 16px 0; }
.blog-body pre code { padding: 0; background: none; }
.blog-nav {
    display: flex;
    justify-content: space-between;
    padding: 20px 32px 32px;
    border-top: 1px solid var(--border);
}
.blog-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--navy);
    color: var(--gold-light);
    font-size: 18px;
    transition: all 0.3s;
    text-decoration: none;
}
.blog-nav a:hover {
    background: var(--gold-dark);
    color: #fff;
    transform: scale(1.1);
}

/* Blog Cards (Archive) */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.blog-card {
    background: var(--white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}
.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gold);
}
.blog-card-thumb img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}
.blog-card-body {
    padding: 22px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.blog-card-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.5;
    text-align: justify;
}
.blog-card-title a { color: var(--navy); display: inline; }
.blog-card-title a:hover { color: var(--gold-dark); }
.blog-card-meta {
    font-size: 12px;
    color: var(--text-muted);
}
.blog-card-cat {
    display: inline-block;
    background: var(--gold);
    color: var(--navy);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    margin-left: 8px;
}
.blog-card-excerpt {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.8;
    flex: 1;
    text-align: justify;
}
.blog-card-excerpt p { margin: 0; }
.blog-card-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--gold-dark);
    padding: 8px 18px;
    border: 1px solid var(--gold);
    border-radius: 10px;
    transition: var(--transition);
    align-self: flex-start;
    margin-top: 4px;
}
.blog-card-more:hover {
    background: var(--gold);
    color: var(--navy-dark);
}
.blog-empty {
    text-align: center;
    font-size: 16px;
    color: var(--text-muted);
    padding: 60px 0;
}
.blog-pagination {
    text-align: center;
    margin-top: 32px;
}
.blog-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    margin: 0 3px;
    border-radius: 10px;
    background: var(--white);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--border);
    transition: var(--transition);
}
.blog-pagination a.prev.page-numbers,
.blog-pagination a.next.page-numbers {
    border-radius: 10px;
    background: var(--white);
    color: var(--text);
    border-color: var(--border);
    font-size: 14px;
}
.blog-pagination a.prev.page-numbers:hover,
.blog-pagination a.next.page-numbers:hover {
    background: var(--gold);
    color: var(--navy-dark);
    border-color: var(--gold);
    transform: scale(1.1);
}
.blog-pagination .page-numbers:hover,
.blog-pagination .page-numbers.current {
    background: var(--gold);
    color: var(--navy-dark);
    border-color: var(--gold);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header-inner {
        position: relative;
        justify-content: flex-end;
    }

    .nav-toggle {
        display: flex;
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
    }

    .main-nav { display: none; }
    .main-nav.active {
        display: block;
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: var(--navy);
        border-bottom: 2px solid var(--gold);
        z-index: 1002;
    }

    .nav-menu {
        display: flex;
        flex-direction: column;
        padding: 16px;
    }

    .blog-grid { grid-template-columns: 1fr; }
    .blog-header,
    .blog-body,
    .blog-nav { padding-left: 20px; padding-right: 20px; }
    .blog-title { font-size: 22px; }
    .blog-archive-header h1 { font-size: 22px; }

    .contact-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; gap: 10px; }
    .tools-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
    .hero { padding: 35px 16px 25px; }
    .section { padding: 30px 0; }
}
