/* ============================================
   Mailfa User Guide - Mobile-First CSS
   ============================================ */

/* Local Vazirmatn (Vazir) Font - hosted on this server for speed */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* Alias: many users call it \"Vazir\" */
@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* CSS Variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-color: #1e293b;
    --text-light: #64748b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --font-family: 'Vazir', 'Vazirmatn', 'IRANSans', 'Tahoma', sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.8;
    direction: rtl;
    text-align: right;
    min-height: 100vh;
}

/* Make sure all controls use Vazir too */
button, input, textarea, select {
    font-family: var(--font-family);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 1rem;
    color: var(--text-color);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-light);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-dark);
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
    min-width: 0;
}

.logo span {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mailfa logo image sizing (prevents large PNG from appearing huge) */
.logo-img {
    height: 24px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    display: block;
}

/* Link back to the main Mailfa website (in header) */
.header-site-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 9999px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.header-site-link:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: var(--primary-color);
}

.header-site-link::before {
    content: "↩";
    font-weight: 700;
}

/* Label swapping for mobile */
.header-site-link .label-short { display: none; }
.header-site-link .label-full { display: inline; }

@media (max-width: 480px) {
    .header-inner {
        gap: 0.5rem;
    }

    .logo {
        font-size: 1.05rem;
    }

    .logo span {
        max-width: 140px;
    }

    .header-site-link {
        padding: 0.45rem 0.6rem;
        font-size: 0.82rem;
        gap: 0.35rem;
    }

    .header-site-link .label-full { display: none; }
    .header-site-link .label-short { display: inline; }
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
}

/* Mobile Navigation */
.nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    width: 24px;
    height: 3px;
    background: var(--text-color);
    border-radius: 2px;
    transition: 0.3s;
}

.nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.nav.active {
    display: block;
}

.nav-list {
    list-style: none;
    padding: 0.5rem 0;
}

.nav-item {
    border-bottom: 1px solid var(--border-color);
}

.nav-item:last-child {
    border-bottom: none;
}

.nav-link {
    display: block;
    padding: 1rem;
    color: var(--text-color);
    font-weight: 500;
    transition: background 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: var(--bg-color);
    color: var(--primary-color);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2.5rem 1rem;
    text-align: center;
}

.hero h1 {
    color: white;
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.hero p {
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
}

/* Search Box */
.search-box {
    max-width: 500px;
    margin: 1.5rem auto 0;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font-family);
    direction: rtl;
}

.search-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

/* Main Content */
main {
    padding: 1.5rem 0;
    min-height: calc(100vh - 200px);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.card-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.card-title {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

.card-desc {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0;
}

/* Guide Cards Grid */
.guides-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.guide-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.guide-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.guide-card .card-link {
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.875rem;
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Step Guide */
.steps {
    counter-reset: step;
}

.step {
    position: relative;
    padding: 1.5rem;
    padding-right: 4rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.step::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    right: 1rem;
    top: 1.5rem;
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.step-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.step-content {
    color: var(--text-light);
    font-size: 0.9375rem;
}

.step-screenshot {
    background: var(--bg-color);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 2rem;
    text-align: center;
    margin-top: 1rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

.step-screenshot a {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
}

.step-screenshot a:hover {
    text-decoration: underline;
}

.step-screenshot .step-img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

/* Tips & Warnings */
.tip, .warning, .info {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin: 1rem 0;
    display: flex;
    gap: 0.75rem;
}

.tip {
    background: #ecfdf5;
    border-right: 4px solid var(--success-color);
}

.warning {
    background: #fffbeb;
    border-right: 4px solid var(--warning-color);
}

.info {
    background: #eff6ff;
    border-right: 4px solid var(--primary-color);
}

.tip-icon, .warning-icon, .info-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* FAQ Accordion */
.faq-category {
    margin-bottom: 2rem;
}

.faq-category-title {
    font-size: 1.25rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.faq-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 1rem;
    background: none;
    border: none;
    text-align: right;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-family);
}

.faq-question:hover {
    background: var(--bg-color);
}

.faq-icon {
    transition: transform 0.3s;
    flex-shrink: 0;
}

.faq-item.active .faq-icon {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

.faq-answer-content {
    padding: 0 1rem 1rem;
    color: var(--text-light);
    line-height: 1.8;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-item::after {
    content: '/';
    color: var(--text-light);
}

.breadcrumb-item:last-child::after {
    display: none;
}

.breadcrumb-item a {
    color: var(--text-light);
}

.breadcrumb-item:last-child {
    color: var(--primary-color);
    font-weight: 500;
}

/* Table of Contents */
.toc {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.toc-title {
    font-size: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toc-list {
    list-style: none;
}

.toc-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.toc-item:last-child {
    border-bottom: none;
}

.toc-link {
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toc-link:hover {
    color: var(--primary-color);
}

/* Section Divider */
.section-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
    color: var(--text-light);
    font-size: 0.875rem;
}

.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* User Type Tabs */
.user-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--bg-color);
    padding: 0.5rem;
    border-radius: var(--radius);
}

.user-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
    color: var(--text-light);
}

.user-tab.active {
    background: var(--primary-color);
    color: white;
}

.user-tab:hover:not(.active) {
    background: var(--border-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Footer */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 2rem 1rem;
    margin-top: 3rem;
}

.footer-content {
    text-align: center;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.footer-links a {
    color: var(--text-light);
    font-size: 0.875rem;
}

.footer-copyright {
    color: var(--text-light);
    font-size: 0.8125rem;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    z-index: 99;
    transition: transform 0.2s;
}

.back-to-top:hover {
    transform: scale(1.1);
}

.back-to-top.visible {
    display: flex;
}

/* Quick Links */
.quick-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-color);
    transition: background 0.2s;
}

.quick-link:hover {
    background: var(--border-color);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-personal {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-organizational {
    background: #fce7f3;
    color: #be185d;
}

.badge-new {
    background: #dcfce7;
    color: #15803d;
}

/* ============================================
   Tablet Styles (min-width: 640px)
   ============================================ */
@media (min-width: 640px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    
    .hero {
        padding: 3rem 1.5rem;
    }
    
    .hero h1 {
        font-size: 2.25rem;
    }
    
    .guides-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-links {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .step {
        padding: 1.5rem 1.5rem 1.5rem 5rem;
    }
}

/* ============================================
   Desktop Styles (min-width: 1024px)
   ============================================ */
@media (min-width: 1024px) {
    h1 { font-size: 2.5rem; }
    
    .header-inner {
        padding: 1rem 2rem;
    }
    
    .nav-toggle {
        display: none;
    }
    
    .nav {
        display: block;
        position: static;
        background: none;
        border: none;
        box-shadow: none;
    }
    
    .nav-list {
        display: flex;
        gap: 0.5rem;
        padding: 0;
    }
    
    .nav-item {
        border: none;
    }
    
    .nav-link {
        padding: 0.5rem 1rem;
        border-radius: var(--radius-sm);
    }
    
    .hero {
        padding: 4rem 2rem;
    }
    
    .hero h1 {
        font-size: 2.75rem;
    }
    
    .guides-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    main {
        padding: 2rem 0;
    }
    
    .container {
        padding: 0 2rem;
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.hidden { display: none; }

/* Print Styles */
@media print {
    .header, .nav, .footer, .back-to-top, .search-box {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .card, .step {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}


