/* ==========================================================================
   POZKANCO MAIN STYLESHEET - FINAL FIXED DESKTOP & MOBILE
   ========================================================================== */

@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
    --primary-red: #B71C1C;
    --dark-red: #7f0000;
    --white: #ffffff;
    --light-gray: #f5f5f5;
    --dark-text: #333333;
    --nav-height: 80px;
}

/* --- RESET & BASE STYLES --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; width: 100%; max-width: 100%; }

body, button, input, textarea, select {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--white);
    color: var(--dark-text);
    line-height: 1.6;
}

html[dir="rtl"] body, html[dir="rtl"] input, html[dir="rtl"] button, html[dir="rtl"] textarea {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

/* --- LAYOUT UTILS --- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-wide { max-width: 100%; width: 96%; margin: 0 auto; padding: 0 10px; }
.section-padding { padding: 80px 0; }
.text-center { text-align: center; }

.btn {
    display: inline-block; padding: 12px 30px;
    background-color: var(--primary-red); color: var(--white);
    border-radius: 5px; font-weight: bold; border: 2px solid var(--primary-red);
    cursor: pointer; font-family: 'Vazirmatn', sans-serif; font-size: 1rem;
    transition: all 0.3s ease;
}
.btn:hover { background-color: transparent; color: var(--primary-red); }

/* --- HEADER (DESKTOP DEFAULT) --- */
header {
    position: fixed; top: 0; left: 0; width: 100%;
    height: var(--nav-height); background: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 10000; display: flex; align-items: center;
}
.navbar { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 0 20px; }
.logo { display: flex; align-items: center; gap: 10px; z-index: 10001; }
.logo img { height: 45px; }
.logo-text { font-size: 1rem; font-weight: 900; color: var(--primary-red); line-height: 1.2; }
.logo-sub { display: block; font-size: 0.75rem; color: #555 !important; font-weight: bold; margin-top: 2px; letter-spacing: 0.5px; }

/* منوی دسکتاپ (افقی و بدون همبرگر) */
.nav-links { display: flex; gap: 25px; align-items: center; z-index: 10002; }
.nav-links li a { font-weight: 500; position: relative; }
.nav-links li a:hover, .nav-links li a.active { color: var(--primary-red); }

.hamburger { display: none; cursor: pointer; font-size: 1.8rem; color: var(--primary-red); z-index: 1001; } /* مخفی در دسکتاپ */

.lang-switch { 
    display: flex; gap: 5px; align-items: center; 
    border: 1px solid #ddd; padding: 5px 10px; border-radius: 20px; 
    position: relative; z-index: 10003; cursor: pointer; background: #fff;
}
.lang-switch a { font-size: 0.85rem; font-weight: bold; opacity: 0.6; cursor: pointer; pointer-events: auto; }
.lang-switch a.active-lang { opacity: 1; color: var(--primary-red); text-decoration: none; }

/* --- HERO --- */
.hero {
    height: 70vh; min-height: 500px; background-size: cover; background-position: center;
    background-attachment: fixed; display: flex; align-items: center;
    justify-content: center; position: relative; margin-top: var(--nav-height);
}
.hero::before { content: ''; position: absolute; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.6); }
.hero-content { position: relative; z-index: 1; text-align: center; color: var(--white); padding: 0 20px; width: 100%; }
.hero-content h1 { font-size: 2.5rem; margin-bottom: 15px; text-shadow: 2px 2px 4px rgba(0,0,0,0.5); }
.hero-content p { font-size: 1.3rem; margin-bottom: 30px; }

/* --- GRIDS (DESKTOP DEFAULT) --- */
.services-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; width: 100%; }
.about-grid, .footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; width: 100%; }

/* --- PROJECTS GRID (DESKTOP DEFAULT) --- */
.projects-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    width: 100%;
    align-items: stretch;
}

/* عرض کارت‌ها در دسکتاپ (۳ تایی) */
.project-card {
    background: #fff; 
    border-radius: 8px; 
    overflow: hidden; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); 
    transition: 0.3s; 
    width: calc(33.333% - 20px); /* پیش‌فرض دسکتاپ */
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-grow: 0; flex-shrink: 0;
}

/* اگر کلاس خاص ۴تایی اضافه شد (توسط JS) */
.projects-grid.grid-mode-4 .project-card { width: calc(25% - 23px); }

.project-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(183, 28, 28, 0.2); }
.project-image { 
    height: 250px; width: 100%; object-fit: cover; object-position: top; 
    transition: 0.5s; background-color: #f9f9f9; flex-shrink: 0; 
}
.project-card:hover .project-image { transform: scale(1.05); }
.project-info { 
    padding: 20px; border-bottom: 4px solid var(--primary-red); 
    flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between;
}
.click-hint { font-size: 0.8rem; color: #888; margin-top: 15px; display: flex; align-items: center; gap: 5px; }

/* --- CONTACT LAYOUT (DESKTOP DEFAULT) --- */
.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr 1.4fr;
    gap: 20px;
    margin-top: 30px; margin-bottom: 30px;
    align-items: stretch;
}
.contact-col {
    background: #fff; padding: 25px; border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    display: flex; flex-direction: column; justify-content: flex-start; height: 100%; 
}
.contact-col h3 { color: var(--primary-red); margin-bottom: 20px; border-bottom: 2px solid #f0f0f0; padding-bottom: 10px; flex-shrink: 0; }

.info-inner-layout { display: flex; flex-direction: column; justify-content: space-between; height: 100%; flex-grow: 1; padding-bottom: 5px; }
.info-top { margin-bottom: 20px; }
.info-top ul { padding: 0; margin: 0; list-style: none; line-height: 2.2; }
.info-top li { font-size: 0.95rem; display: flex; align-items: flex-start; }
.info-top i { color: var(--primary-red); margin-left: 10px; margin-right: 10px; margin-top: 5px; }

.info-bottom { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: auto; border-top: 1px solid #f9f9f9; padding-top: 15px; }
.info-phones { flex: 1; }
.info-phones ul { padding: 0; margin: 0; list-style: none; }
.info-phones li { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 0.95rem; font-weight: bold; }
.info-phones li i { color: var(--primary-red); margin: 0; }
.qr-section { flex-shrink: 0; width: 110px; text-align: center; margin-right: 10px; margin-inline-start: 15px; }
.qr-section img { width: 100%; border-radius: 5px; border: 1px solid #eee; padding: 2px; }
.qr-section p { font-size: 0.7rem; color: #666; margin-top: 5px; margin-bottom: 0; }

.map-container { width: 100%; height: 100%; min-height: 300px; border-radius: 5px; overflow: hidden; }
iframe { width: 100%; height: 100%; border: 0; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; font-size: 0.9rem; }
.form-group input, .form-group textarea { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 5px; font-size: 0.9rem; font-family: inherit; }
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary-red); outline: none; }

/* Machinery */
.machinery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 20px; margin-top: 40px; }
.machine-card { background: #fff; border: 1px solid #eee; padding: 20px; border-radius: 10px; text-align: center; transition: 0.3s; }
.machine-card:hover { transform: translateY(-5px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); border-color: var(--primary-red); }
.machine-card i { font-size: 2.5rem; color: var(--primary-red); margin-bottom: 15px; }
.machine-card h4 { font-size: 1rem; margin: 0; }

/* FAQ */
.faq-container { max-width: 800px; margin: 0 auto; }
.faq-item { background: #fff; border-radius: 5px; margin-bottom: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); overflow: hidden; }
.faq-question { padding: 20px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: bold; background: #f9f9f9; transition: 0.3s; }
.faq-question:hover { background: #eee; }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; padding: 0 20px; background: #fff; color: #555; }
.faq-answer p { padding: 20px 0; margin: 0; }
.faq-item.active .faq-answer { max-height: 300px; }
.faq-item.active .faq-question { color: var(--primary-red); }
.faq-icon { transition: 0.3s; }
.faq-item.active .faq-icon { transform: rotate(180deg); }

/* 404 */
.error-page { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: #f5f5f5; }
.error-code { font-size: 8rem; font-weight: 900; color: var(--primary-red); line-height: 1; }
.error-msg { font-size: 1.5rem; margin-bottom: 30px; color: #333; }

/* About Header */
.about-header { display: flex; flex-wrap: wrap; gap: 30px; align-items: center; margin-bottom: 30px; justify-content: center; }
.about-header-text, .about-header-img { flex: 1; min-width: 280px; }

/* Cards */
.service-card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.05); transition: 0.3s; padding: 30px; border-bottom: 4px solid transparent; }
.service-card:hover { transform: translateY(-10px); border-bottom: 4px solid var(--primary-red); }
.service-icon { font-size: 3rem; color: var(--primary-red); margin-bottom: 20px; }

/* Footer */
footer { background: #1a1a1a; color: var(--white); padding: 60px 0 20px; }
.footer-col h3 { border-bottom: 3px solid var(--primary-red); display: inline-block; margin-bottom: 20px; padding-bottom: 5px; }
.footer-bottom { border-top: 1px solid #333; padding-top: 20px; text-align: center; font-size: 0.9rem; color: #888; }

/* Misc */
.whatsapp-btn { position: fixed; bottom: 30px; left: 30px; background-color: #25D366; color: white; width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 35px; box-shadow: 2px 2px 10px rgba(0,0,0,0.3); z-index: 2000; transition: 0.3s; }
.whatsapp-btn:hover { transform: scale(1.1); background-color: #128C7E; }

.modal { display: none; position: fixed; z-index: 20000; padding-top: 30px; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.96); flex-direction: column; justify-content: center; align-items: center; }
.modal-content { margin: auto; display: block; width: auto; max-width: 90%; max-height: 80vh; background: transparent; border: none; animation: zoom 0.3s; }
#modalImg { width: auto; height: auto; max-width: 100%; max-height: 80vh; object-fit: contain; border-radius: 5px; }
@keyframes zoom { from {transform:scale(0.8); opacity: 0;} to {transform:scale(1); opacity: 1;} }
.close-modal { position: absolute; top: 20px; right: 30px; color: #fff; font-size: 40px; font-weight: bold; cursor: pointer; z-index: 20001; }
.prev, .next { cursor: pointer; position: absolute; top: 50%; transform: translateY(-50%); width: auto; padding: 16px; color: white; font-weight: bold; font-size: 30px; background-color: rgba(0,0,0,0.3); user-select: none; border-radius: 5px; z-index: 20001; }
html[dir="rtl"] .next { left: 20px; } html[dir="rtl"] .prev { right: 20px; } html[dir="ltr"] .next { right: 20px; } html[dir="ltr"] .prev { left: 20px; }
.modal-caption { margin: 10px auto; display: block; width: 90%; max-width: 700px; text-align: center; color: #ccc; font-size: 1rem; }
.modal-description { margin: 10px auto 0 auto; width: 90%; max-width: 800px; background: rgba(255,255,255,0.1); padding: 15px; border-radius: 8px; color: #eee; text-align: justify; font-size: 0.9rem; line-height: 1.8; border-right: 3px solid var(--primary-red); }
html[dir="ltr"] .modal-description { border-right: none; border-left: 3px solid var(--primary-red); }

/* ---------------------------------------------------- */
/* RESPONSIVE MEDIA QUERIES (MOBILE & TABLET OVERRIDES) */
/* ---------------------------------------------------- */

@media (max-width: 1200px) {
    /* Tablet: Stack Form below Info & Map */
    .contact-wrapper { grid-template-columns: 1fr 1fr; }
    .contact-col:nth-child(3) { grid-column: span 2; }
    .container-wide { width: 98%; }
}

@media (max-width: 992px) { 
    .services-grid { grid-template-columns: repeat(2, 1fr); }
    /* در تبلت: ۲ ستونه */
    .projects-grid .project-card { width: calc(50% - 15px); }
}

@media (max-width: 768px) {
    /* --- MOBILE NAVIGATION (HAMBURGER) --- */
    .hamburger { display: block; }
    
    .nav-links { 
        position: fixed; top: 0; width: 75%; height: 100vh; 
        background: var(--white); flex-direction: column; 
        justify-content: center; transition: 0.4s; 
        box-shadow: 0 0 15px rgba(0,0,0,0.2); z-index: 1000; 
        /* Default hidden state */
        right: 0; transform: translateX(100%); 
    }

    /* Show menu when active */
    html[dir="rtl"] .nav-links { transform: translateX(100%); } 
    html[dir="rtl"] .nav-links.active { transform: translateX(0); }
    
    html[dir="ltr"] .nav-links { left: 0; right: auto; transform: translateX(-100%); } 
    html[dir="ltr"] .nav-links.active { transform: translateX(0); }

    /* --- MOBILE LAYOUT FIXES --- */
    .contact-wrapper { grid-template-columns: 1fr; }
    .contact-col:nth-child(3) { grid-column: auto; }
    
    .info-inner-layout { flex-direction: column; text-align: center; align-items: center; }
    .info-bottom { flex-direction: column; align-items: center; }
    .qr-section { border-right: none; border-top: 1px solid #eee; padding-right: 0; padding-top: 15px; margin-top: 15px; width: 100%; }
    
    .info-phones ul { text-align: center; }
    .info-phones li { justify-content: center; }

    .hero-content h1 { font-size: 1.6rem; } 
    .hero-content p { font-size: 1rem; }
    
    .about-header { flex-direction: column; } 
    .about-header-text, .about-header-img { width: 100%; min-width: auto; }
    
    .services-grid { grid-template-columns: 1fr; }
    
    /* در موبایل: تک ستونه */
    .projects-grid .project-card { width: 100%; }
}