/* ===========================
   Variables
   =========================== */
:root {
    --primary-color: rgb(250, 40, 65);
    --dark-tertiary: rgb(33, 41, 54);
    --darkest: rgb(29, 32, 37);
    --text-gray: #6B7280;
    --light-bg: #F9FAFB;
}

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

body {
    font-family: 'Vazir', 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--light-bg);
    color: #333;
    line-height: 1.6;
}

/* ===========================
   Navigation (same as homepage)
   =========================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    padding: 0.75rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 3rem;
    height: 64px;
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    z-index: 1001;
}

.mobile-menu-btn span {
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    height: 40px;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.logo-text:hover {
    opacity: 0.8;
}

.logo-edna {
    font-weight: 700;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2.5rem;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    line-height: 1;
}

.nav-link {
    color: #000000;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: color 0.3s ease;
    display: inline-block;
    padding: 0.5rem 0.75rem;
}

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

.nav-link.active {
    color: var(--primary-color);
}

/* ===========================
   Gallery Section
   =========================== */
.gallery-section {
    margin-top: 75px;
    padding: 2rem 1rem;
    min-height: calc(100vh - 75px);
}

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

.gallery-header {
    text-align: center;
    margin-bottom: 2rem;
}

.gallery-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 0.5rem;
}

.gallery-subtitle {
    font-size: 1rem;
    color: var(--text-gray);
}

/* ===========================
   Filters
   =========================== */
.filters-section {
    margin-bottom: 2rem;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.filter-tag {
    padding: 0.6rem 1.25rem;
    border: 2px solid #E5E7EB;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #6B7280;
}

.filter-tag.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.filter-tag:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-tag.active:hover {
    color: white;
}

/* ===========================
   Gallery Grid
   =========================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.gallery-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    -webkit-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
    aspect-ratio: 3/4;
}

/* Fallback for aspect-ratio */
@supports not (aspect-ratio: 3/4) {
    .gallery-item {
        height: 0;
        padding-bottom: 133.33%; /* 4/3 * 100 */
    }
    .gallery-item-image {
        position: absolute;
        top: 0;
        left: 0;
    }
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.gallery-item-image {
    width: 100%;
    height: 100%;
}

.gallery-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.view-btn {
    background: white;
    color: var(--dark-tertiary);
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* ===========================
   Modal (بهینه برای موبایل)
   =========================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
}

.modal.active {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85); /* Darker for browsers without backdrop-filter */
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 2001;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2002;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--primary-color);
}

.modal-close svg {
    width: 20px;
    height: 20px;
    stroke: #333;
}

.modal-close:hover svg {
    stroke: white;
}

.modal-body {
    padding: 2rem 1.5rem;
}

/* Slider در Modal */
.modal-slider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.slider-container {
    flex: 1;
    overflow: hidden;
    max-width: 350px;
    margin: 0 auto;
    position: relative;
    width: 100%;
}

.slider-track {
    display: flex;
    transition: transform 0.3s ease;
    will-change: transform;
}

.slider-item {
    min-width: 100%;
    width: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.slider-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6B7280;
    margin-bottom: 0.75rem;
    text-align: center;
}

.slider-item img {
    width: 100%;
    width: 300px;
    height: 500px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: block;
}

.slider-btn {
    background: white;
    border: 2px solid #E5E7EB;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.slider-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.slider-btn svg {
    width: 20px;
    height: 20px;
    stroke: #6B7280;
}

.slider-btn:hover svg {
    stroke: white;
}

.slider-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.slider-btn:disabled:hover {
    background: white;
    border-color: #E5E7EB;
}

.slider-btn:disabled:hover svg {
    stroke: #6B7280;
}

/* Slider Dots */
.slider-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #E5E7EB;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background: var(--primary-color);
    width: 24px;
    border-radius: 4px;
}

.dot:hover {
    background: var(--primary-color);
}

/* بخش متن */
.modal-text-section {
    margin-bottom: 1.5rem;
}

.modal-text-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 1rem;
}

.text-box {
    background: var(--light-bg);
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    min-height: 100px;
}

.text-box p {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #374151;
    word-wrap: break-word;

    /* محدود کردن به 3 خط با سه نقطه */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.copy-btn {
    width: 100%;
    background: var(--dark-tertiary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: var(--darkest);
    transform: translateY(-2px);
}

.copy-btn svg {
    width: 20px;
    height: 20px;
}

.copy-btn.copied {
    background: #10B981;
}

.back-btn {
    width: 100%;
    background: white;
    color: var(--dark-tertiary);
    border: 2px solid #E5E7EB;
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: var(--light-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ===========================
   Responsive (Mobile First!)
   =========================== */
@media (max-width: 1024px) {
    .nav-container {
        padding: 0 2rem;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 0;
    }

    .nav-container {
        padding: 0 1.5rem;
        height: 56px;
        flex-direction: row-reverse;
        position: relative;
    }

    .logo {
        height: 34px;
    }

    .mobile-menu-btn {
        display: flex;
        margin-left: 0;
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        background: white;
        flex-direction: column;
        padding: 1rem 0;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        width: 100%;
    }

    .nav-menu.active {
        max-height: 300px;
    }

    .nav-menu li {
        width: 100%;
        text-align: center;
        padding: 0.75rem 0;
    }

    .nav-menu li a {
        display: block;
        width: 100%;
    }

    .gallery-title {
        font-size: 1.5rem;
    }

    .gallery-subtitle {
        font-size: 0.9rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .filter-tags {
        gap: 0.5rem;
    }

    .filter-tag {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    /* Modal در موبایل */
    .modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .slider-container {
        max-width: 100%;
    }

    .slider-item img {
        max-width: 250px;
    }

    .slider-btn {
        width: 35px;
        height: 35px;
    }

    .modal-body {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-container {
        padding: 0 1rem;
        flex-direction: row-reverse;
    }

    .filter-tag {
        padding: 0.45rem 0.85rem;
        font-size: 0.8rem;
    }
}

/* ===========================
   Utilities
   =========================== */
.hidden {
    display: none !important;
}
