:root {
    --primary: #0a2540;
    --primary-light: #0f345a;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --bg-light: #f8fafc;
    --text-main: #334155;
    --text-dark: #0f172a;
    --white: #ffffff;
    --border: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.6;
}

/* ========================================================
   PAGE TRANSITION SYSTEM (سازگار با پنل ادمین و صفحات کاربری)
   ======================================================== */

body {
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

body.page-visible {
    opacity: 1;
}

body.page-transitioning {
    opacity: 0;
    pointer-events: none;
}

body.admin-mode {
    opacity: 1 !important;
    transition: none !important;
}

.main-content-wrapper {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

body.page-visible .main-content-wrapper,
body.admin-mode .main-content-wrapper {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================================
   BASIC TYPOGRAPHY & TAGS
   ======================================================== */

a {
    text-decoration: none;
    color: inherit;
}

img, video, iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    width: 92%;
    max-width: 1200px;
    margin: 0 auto;
}

/* ========================================================
   FIXED WATERMARK BACKGROUND (لوگوی ثابت پس‌زمینه)
   ======================================================== */

.fixed-watermark-bg {
    position: fixed;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 65vmin;
    height: 65vmin;
    max-width: 620px;
    max-height: 620px;
    background-image: url('../images/logo.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.18;
    filter: blur(0.5px);
    pointer-events: none;
    z-index: 0;
}

.content-section {
    position: relative;
    z-index: 1;
}

.content-section .card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
}

/* ========================================================
   HEADER & NAVBAR
   ======================================================== */

header.header {
    background: var(--primary);
    color: var(--white);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.logo span {
    color: var(--accent);
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 1.3rem;
}

.nav-links a {
    color: #cbd5e1;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--accent);
}

.btn-auth {
    padding: 0.45rem 0.9rem !important;
    font-size: 0.85rem !important;
}

.btn-admin {
    background: #0f172a !important;
    color: var(--white) !important;
}

.btn-logout {
    color: #ef4444 !important;
    font-size: 0.85rem;
}

.btn-login-link {
    color: var(--accent) !important;
    font-weight: bold;
}

/* Mobile Toggle (Hamburger) */
.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    padding: 6px;
}

.mobile-toggle span {
    display: block;
    width: 26px;
    height: 3px;
    background-color: var(--white);
    border-radius: 2px;
    transition: all 0.3s ease-in-out;
}

/* ========================================================
   BUTTONS
   ======================================================== */

.btn {
    display: inline-block;
    padding: 0.75rem 1.6rem;
    background: var(--accent);
    color: var(--primary);
    font-weight: 600;
    border-radius: 6px;
    border: 2px solid var(--accent);
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.2);
}

.btn:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(245, 158, 11, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--white);
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--accent);
    color: var(--primary);
}

/* ========================================================
   HERO VIDEO SECTION
   ======================================================== */

.hero-video-section {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 2;
    background-color: #0f172a;
}

.hero-video-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    object-fit: cover;
    z-index: 1;
    pointer-events: none;
}

.hero-video-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.55) 0%, rgba(15, 23, 42, 0.75) 100%);
    z-index: 2;
}

.hero-video-content {
    position: relative;
    z-index: 3;
    text-align: center;
    color: #ffffff;
    padding: 4rem 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.hero-video-content h1 {
    font-size: clamp(2rem, 4.5vw, 3.2rem);
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 1.2rem;
    color: #ffffff;
    text-shadow: 0 3px 12px rgba(0, 0, 0, 0.6);
}

.hero-video-content p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    line-height: 1.6;
    color: #f1f5f9;
    margin-bottom: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Fallback Hero */
.hero {
    background: linear-gradient(rgba(10, 37, 64, 0.85), rgba(10, 37, 64, 0.85)), url('https://images.unsplash.com/photo-1509391365360-2e959784a276?auto=format&fit=crop&w=1500&q=80') center/cover no-repeat;
    color: var(--white);
    padding: 5rem 0;
    text-align: center;
}

/* ========================================================
   CARDS & GRIDS (۴ ستونه اختصاصی)
   ======================================================== */

.grid-4, .projects-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.75rem;
    margin: 2.5rem 0;
}

.card {
    background: var(--white);
    border-radius: 10px;
    padding: 1.85rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}

.card h3 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

/* ========================================================
   VIDEO CONTAINER & FORMS
   ======================================================== */

.video-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    background: #000;
}

.video-container video {
    width: 100%;
    display: block;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

/* ========================================================
   FOOTER
   ======================================================== */

footer {
    background: var(--primary);
    color: #94a3b8;
    padding: 3.5rem 0 1.5rem 0;
    margin-top: 4.5rem;
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid #1e293b;
    padding-top: 1.5rem;
    margin-top: 2.5rem;
    font-size: 0.9rem;
}

/* ========================================================
   RESPONSIVE DESIGN (موبایل و تبلت)
   ======================================================== */

@media (max-width: 1024px) {
    .grid-4, .projects-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.25rem;
    }
}

@media (max-width: 900px) {
    .mobile-toggle {
        display: flex;
    }

    .mobile-toggle.active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .mobile-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    .mobile-toggle.active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .nav-links {
        display: none;
        flex-direction: column;
        align-items: stretch;
        position: absolute;
        top: calc(100% + 0.8rem);
        left: 0;
        right: 0;
        background-color: #0c2b4c;
        padding: 1.5rem;
        border-radius: 8px;
        box-shadow: 0 12px 28px rgba(0,0,0,0.35);
        gap: 1rem;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 0.6rem 0;
        font-size: 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .nav-links a:last-child {
        border-bottom: none;
    }
}

@media (max-width: 600px) {
    .hero-video-section {
        min-height: 70vh;
    }

    .grid-4, .projects-grid-4, .grid-3 {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1.4rem;
    }
}
