/* Liquid Glass Navigation Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Header Styles */
header {
    position: fixed;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 1000;
}

nav {
    max-width: 1280px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}

nav:hover {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.02);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2rem;
}

/* Mobile Layout */
@media (max-width: 767px) {
    .nav-container {
        display: grid;
        grid-template-columns: 1fr 2fr 1fr;
        align-items: center;
        gap: 1rem;
        padding: 1.25rem 1.5rem;
    }
    
    .mobile-menu-btn {
        display: flex;
        justify-content: flex-start;
    }
    
    .logo {
        display: flex;
        justify-content: center;
    }
    
    .mobile-login {
        display: flex;
        justify-content: flex-end;
    }
}

/* Mobile Login Button */
.mobile-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #5c51e8;
    color: white;
    border: none;
    border-radius: 0.75rem;
    text-decoration: none;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(92, 81, 232, 0.3);
}

.mobile-login-btn:hover {
    background: #4a3fd1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(92, 81, 232, 0.4);
    color: white;
}

/* Desktop Layout */
@media (min-width: 768px) {
    .mobile-login {
        display: none;
    }
}

/* Logo */
.logo {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(to right, #1a1a1a, rgba(26, 26, 26, 0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Desktop Menu */
.menu {
    display: none;
    gap: 0.75rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-direction: row;
}

@media (min-width: 768px) {
    .nav-container {
        display: grid;
        grid-template-columns: auto 1fr auto; /* لوگو | منو | دکمه */
        align-items: center;
        gap: 1rem;
    }
    .menu {
        display: flex;
        align-items: center;
        flex-direction: row;
        justify-self: center; /* منو وسط */
        gap: 0.75rem;
    }
    .logo {
        justify-self: start; /* لوگو سمت راست (در RTL ابتدای ردیف) */
        display: flex;
        align-items: center;
    }
    .cta-button {
        justify-self: end;
    }
}

.menu li {
    display: inline-block;
    margin: 0;
    padding: 0;
}

.menu a {
    position: relative;
    padding: 0.5rem 0.75rem 0.4rem 0.75rem;
    text-decoration: none;
    color: #1a1a1a;
    font-size: 1rem;
    font-weight: 600;
    transition: color 0.3s ease; /* فقط transition برای color */
    display: flex;
    align-items: center;
    white-space: nowrap;
    letter-spacing: 0.025em;
    background: transparent;
    border: none !important;
    border-radius: 0;
    outline: none !important;
    box-shadow: none !important;
}

.menu a:focus {
    outline: none !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.menu a:active {
    outline: none !important;
    background: transparent !important;
    border: none !important;
    transform: none !important;
    box-shadow: none !important;
}

.menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: transparent;
    transition: all 0.3s ease;
}


/* فقط برای دسکتاپ - hover فقط رنگ بنفش، بدون border */
/* فقط روی منوهایی که active نیستند */
@media (min-width: 768px) {
    .menu a:not(.active):hover {
        color: #5c51e8 !important;
        background: transparent !important;
        border: none !important;
        outline: none !important;
        transform: none !important;
        box-shadow: none !important;
    }

    .menu a:not(.active):hover::after {
        width: 0 !important;
        background: transparent !important;
    }
    
    /* حذف هرگونه border یا outline که ممکن است از جاهای دیگر اضافه شود */
    .menu a:not(.active):hover::before {
        display: none !important;
        content: none !important;
    }
}

.menu a.active {
    color: #5c51e8 !important;
    background: transparent !important;
    transform: none !important;
    box-shadow: none !important;
}

.menu a.active::after {
    width: calc(100% - 2.5rem) !important;
    background: #5c51e8 !important;
}


/* CTA Button */
.cta-button {
    display: none;
    padding: 0.5rem 1.5rem;
    background: #5c51e8;
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(92, 81, 232, 0.2);
    transition: all 0.2s ease;
    text-decoration: none;
}

@media (min-width: 768px) {
    .cta-button {
        display: block;
    }
}

.cta-button:hover {
    background: #4a3fd1;
    box-shadow: 0 6px 20px rgba(92, 81, 232, 0.3);
    transform: scale(1.05);
    color: white;
    text-decoration: none;
}

.cta-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.cta-button i {
    font-size: 0.9rem;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #5c51e8;
    color: white;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(92, 81, 232, 0.3);
}

@media (min-width: 768px) {
    .mobile-menu-btn {
        display: none;
    }
}

@media (max-width: 767px) {
    .menu {
        display: none;
    }
    
    .cta-button {
        display: none;
    }
}

.mobile-menu-btn:hover {
    background: #4a3fd1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(92, 81, 232, 0.4);
    color: white;
}

.mobile-menu-btn svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 1.5rem;
    animation: slideDown 0.3s ease;
}

.mobile-menu.active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-menu ul {
    list-style: none;
    margin-bottom: 0.5rem;
}

.mobile-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: rgba(26, 26, 26, 0.8);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
}


.mobile-menu a:hover {
    color: #1a1a1a;
    background: rgba(26, 26, 26, 0.05);
}

.mobile-menu a.active {
    color: #5c51e8;
    background: #f8f6ff;
    border: 2px solid #5c51e8;
    box-shadow: 0 2px 8px rgba(92, 81, 232, 0.2);
}


.mobile-menu .cta-button {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
}

/* Mobile Offcanvas */
.mobile-offcanvas {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1000;
    overflow: hidden;
}

.mobile-offcanvas.active {
    display: block;
}

/* Smooth overlay fade */
.offcanvas-overlay { opacity: 0; transition: opacity 0.25s ease; }
.mobile-offcanvas.active .offcanvas-overlay { opacity: 1; }

/* Redesigned Offcanvas - softer and animated */
.offcanvas-content.redesigned {
    border-top-right-radius: 1rem;
    border-bottom-right-radius: 1rem;
    padding: 0.75rem; /* فاصله یکنواخت اطراف پنل */
    background: linear-gradient(180deg, #ffffff 0%, #fbfbff 100%);
    box-shadow: -6px 0 24px rgba(17, 24, 39, 0.08);
    opacity: 0;
    transform: translateX(100%);
    will-change: transform, opacity;
    transition: transform 0.38s cubic-bezier(.22,.61,.36,1), opacity 0.28s ease;
    display: flex;
    flex-direction: column;
}
.mobile-offcanvas.active .offcanvas-content.redesigned { opacity: 1; transform: translateX(0); }

.offcanvas-header.redesigned {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #eef0ff;
    background: #fff;
}
.offcanvas-brand { display: flex; align-items: center; gap: 0.6rem; }
.offcanvas-logo { width: 28px; height: 28px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.05)); }
.offcanvas-title { font-weight: 800; color: #1a1a1a; font-size: 1rem; letter-spacing: .2px; }
.offcanvas-back {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    width: 36px; height: 36px;
    border-radius: 0.75rem;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s ease;
}
.offcanvas-back:hover { background: #eceff7; color: #111827; transform: translateX(-2px); }

.offcanvas-menu.redesigned { padding: 0; display: flex; flex-direction: column; flex: 1 1 auto; }
.offcanvas-menu.redesigned ul { list-style: none; margin: 0; padding: 0; }
.offcanvas-menu.redesigned li { margin: 0.25rem 0; opacity: 0; transform: translateY(6px); }
.mobile-offcanvas.active .offcanvas-menu.redesigned li { animation: fadeUp .35s ease forwards; }
.mobile-offcanvas.active .offcanvas-menu.redesigned li:nth-child(1){ animation-delay:.05s }
.mobile-offcanvas.active .offcanvas-menu.redesigned li:nth-child(2){ animation-delay:.1s }
.mobile-offcanvas.active .offcanvas-menu.redesigned li:nth-child(3){ animation-delay:.15s }
.mobile-offcanvas.active .offcanvas-menu.redesigned li:nth-child(4){ animation-delay:.2s }
.mobile-offcanvas.active .offcanvas-menu.redesigned li:nth-child(5){ animation-delay:.25s }
.mobile-offcanvas.active .offcanvas-menu.redesigned li:nth-child(6){ animation-delay:.3s }

.offcanvas-menu.redesigned a {
    display: grid;
    grid-template-columns: 28px 1fr 16px;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 0.9rem;
    border-radius: 0.9rem;
    color: #111827;
    text-decoration: none;
    border: 1px solid transparent;
    background: transparent;
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .18s ease, box-shadow .18s ease;
}
.offcanvas-menu.redesigned a .item-icon { display: flex; align-items: center; justify-content: center; color: #6b7280; }
.offcanvas-menu.redesigned a .item-text { font-weight: 600; font-size: 0.95rem; }
.offcanvas-menu.redesigned a .item-chevron { color: #9ca3af; text-align: left; }
.offcanvas-menu.redesigned a:hover {
    background: #f8f6ff;
    border-color: #e9e6ff;
    color: #5c51e8;
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(92,81,232,0.08);
}
.offcanvas-menu.redesigned a:hover .item-icon { color: #5c51e8; }
.offcanvas-menu.redesigned a.active {
    background: #f8f6ff;
    color: #5c51e8;
    border-color: #5c51e8;
    box-shadow: 0 1px 8px rgba(92,81,232,0.08);
}

.offcanvas-bottom { margin-top: auto; padding: 0.75rem; border-top: 0; background: transparent; }
.offcanvas-bottom .offcanvas-signup, .offcanvas-bottom .offcanvas-user { margin: 0 0; width: 100%; }
.offcanvas-user { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem; border: 1px solid #eef0ff; border-radius: 0.9rem; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.04); }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.user-meta { display: flex; flex-direction: column; }
.user-name { font-weight: 800; color: #111827; font-size: 0.95rem; }
.user-role { font-size: 0.8rem; color: #6b7280; }

.offcanvas-signup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.9rem 1.25rem;
    background: #5c51e8 !important;
    color: #fff !important;
    text-decoration: none;
    border: none;
    border-radius: 0.75rem; /* مثل CTA دسکتاپ */
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(92, 81, 232, 0.2);
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.offcanvas-signup:hover {
    background: #4a3fd1 !important; /* همان هاور CTA دسکتاپ */
    box-shadow: 0 6px 20px rgba(92, 81, 232, 0.3);
    transform: translateY(-1px);
    color: #fff !important;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Full-height fixed layout */
.offcanvas-content {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    width: 300px;
}

header.offcanvas-open {
    top: 0;
    left: 0;
    right: 0;
}
header.offcanvas-open nav {
    max-width: 100%;
    margin: 0;
    border-radius: 0;
}

/* Remove right/top rounding when active to stick to edges */
.mobile-offcanvas.active .offcanvas-content.redesigned {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Wider widths on larger screens */
@media (min-width: 400px) {
  .offcanvas-content,
  .offcanvas-content.redesigned {
    width: 400px;
  }
}
@media (min-width: 520px) {
  .offcanvas-content,
  .offcanvas-content.redesigned {
    width: 440px;
  }
}