/* ==== General Reset & Font ==== */
@font-face {
    font-family: 'IranSans';
    src: url('../fonts/IRANSansXV.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'IranSans', Tahoma, sans-serif;
    background: #f9f9f9;
    color: #333;
    direction: rtl;
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100vw;
}
img { max-width: 100%; }
a { text-decoration: none; color: inherit; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }

/* ==== Header ==== */
.main-header {
    background: #fff;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 65px;               /* ارتفاع ثابت هدر */
    display: flex;
    align-items: center;
}
.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-direction: row-reverse;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}
.logo-img {
    display: block;
    max-height: 200px;          /* لوگو بزرگ‌تر از این نمی‌شود */
    width: auto;
}
.admin-link {
    background: #333;
    color: #fff;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    order: 2;
}

/* Hamburger button (hidden on desktop) */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1100;
    order: 1;
}
.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: #333;
    border-radius: 2px;
    transition: 0.3s;
}

/* ==== Layout ==== */
.home-layout {
    display: flex;
    max-width: 1200px;
    margin: 25px auto;
    padding: 0 15px;
    gap: 25px;
    align-items: flex-start;
}

/* ==== Sidebar (desktop) ==== */
.sidebar {
    width: 210px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    position: sticky;
    top: 80px;
    transition: transform 0.3s ease;
}
.sidebar-inner {
    padding: 18px 15px;
}
.sidebar-title {
    font-size: 1.1rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}
.filter-list { list-style: none; }
.filter-list li { margin-bottom: 4px; }
.filter-list a {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    color: #444;
    transition: background 0.2s;
    font-size: 0.95rem;
}
.filter-list a:hover, .filter-list a.active {
    background: #ffeded;
    color: #ff5e57;
    font-weight: bold;
}
.separator {
    height: 1px;
    background: #eee;
    margin: 10px 0;
}

/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

/* ==== Main Content ==== */
.content {
    flex: 1;
    min-width: 0;
}
.main-title {
    font-size: 1.9rem;
    text-align: center;
    margin-bottom: 15px;
}

/* Search bar */
.search-bar {
    display: flex;
    margin: 0 auto 25px;
    max-width: 500px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border-radius: 30px;
    overflow: hidden;
}
.search-bar input[type="text"] {
    flex: 1;
    border: none;
    padding: 12px 18px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
}
.search-bar button {
    background: #ff5e57;
    color: #fff;
    border: none;
    padding: 0 25px;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.3s;
}
.search-bar button:hover { background: #e04842; }

/* ==== Mobile Categories (hidden on desktop, shown on mobile) ==== */
.mobile-categories {
    display: none;
    overflow-x: auto;
    white-space: nowrap;
    padding: 8px 0 12px;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE/Edge */
}
.mobile-categories::-webkit-scrollbar { display: none; }  /* Chrome/Safari */
.mobile-categories a {
    display: inline-block;
    padding: 6px 15px;
    background: #fff;
    border-radius: 20px;
    border: 1px solid #ddd;
    font-size: 0.8rem;
    color: #555;
    margin-left: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.mobile-categories a.active,
.mobile-categories a:hover {
    background: #ff5e57;
    color: #fff;
    border-color: #ff5e57;
}

/* ==== Palette Grid ==== */
.palettes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Palette Card */
.palette-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}
.palette-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

/* Colors vertical column */
.colors-column {
    display: flex;
    flex-direction: column;
    height: 200px;
}
.color-block {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: flex 0.25s;
}
.color-block.first {
    flex: 3;
}
/* Hex code on hover */
.color-block .hex-code {
    position: absolute;
    background: rgba(0,0,0,0.65);
    color: #fff;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s, transform 0.25s;
    white-space: nowrap;
    pointer-events: none;
}
.color-block:hover .hex-code {
    opacity: 1;
    transform: translateY(0);
}
.color-block:hover {
    flex: 1.8;
}
.color-block.first:hover {
    flex: 4;
}

/* Actions row */
.palette-actions {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 8px;
    border-top: 1px solid #f0f0f0;
}
.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #666;
    font-family: inherit;
    font-size: 0.9rem;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    position: relative;
}
.action-btn:hover {
    background: #f5f5f5;
    color: #ff5e57;
}
.like-btn.liked {
    color: #ff5e57;
}
.like-btn.liked svg {
    fill: #ff5e57;
    stroke: #ff5e57;
}
.palette-category {
    margin-right: auto;
    background: #f0f0f0;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: #555;
}

/* Like animation */
@keyframes heartBeat {
    0% { transform: scale(1); }
    30% { transform: scale(1.3); }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* Floating hearts */
.floating-heart {
    position: absolute;
    font-size: 1.2rem;
    pointer-events: none;
    animation: floatUp 0.8s ease-out forwards;
    z-index: 10;
}
@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-30px) scale(0.5); }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 12px 28px;
    border-radius: 30px;
    font-size: 0.9rem;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    white-space: nowrap;
}
.toast.show { opacity: 1; }

.no-result {
    text-align: center;
    padding: 40px 0;
    color: #888;
    grid-column: 1 / -1;
}

/* Pagination */
.pagination {
    text-align: center;
    margin-top: 20px;
}
.load-more {
    display: inline-block;
    background: #fff;
    color: #ff5e57;
    border: 2px solid #ff5e57;
    padding: 10px 30px;
    border-radius: 30px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s;
}
.load-more:hover {
    background: #ff5e57;
    color: #fff;
}

/* ==== RESPONSIVE (Tablet and Mobile) ==== */
@media (max-width: 900px) {
    .palettes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    .colors-column { height: 170px; }
}

@media (max-width: 768px) {
    /* Header: show hamburger, logo stays right, hamburger left */
    .hamburger { display: flex; }
    .admin-link { display: none; }

    /* Stack layout */
    .home-layout {
        margin-top: 15px;
    }
    /* Sidebar off-canvas from right */
    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        height: 100%;
        width: 260px;
        z-index: 1100;
        transform: translateX(100%);
        border-radius: 0;
        box-shadow: -5px 0 25px rgba(0,0,0,0.2);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-backdrop {
        display: block;
    }
    .sidebar-backdrop.visible {
        opacity: 1;
        pointer-events: all;
    }

    /* Show mobile categories bar */
    .mobile-categories {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        width: 100%;
        max-width: 100%;
    }

    .main-title {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    .search-bar {
        margin-bottom: 15px;
    }
    .palettes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .colors-column { height: 150px; }
}

@media (max-width: 480px) {
    .palettes-grid { gap: 10px; }
    .colors-column { height: 140px; }
    .search-bar input[type="text"] { padding: 10px 12px; }
    .search-bar button { padding: 0 18px; }
    .logo { font-size: 1.3rem; }
}

/* ===== Footer ===== */
.main-footer {
    background: #2d2d2d;
    color: #ccc;
    padding: 40px 0 0;
    margin-top: 50px;
}
.footer-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: space-between;
}
.footer-col {
    flex: 1 1 200px;
}
.footer-col h4 {
    color: #fff;
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 2px solid #ff5e57;
    display: inline-block;
    padding-bottom: 5px;
}
.footer-col p, .footer-col li {
    font-size: 0.9rem;
    line-height: 2;
}
.footer-col ul {
    list-style: none;
    padding: 0;
}
.footer-col a {
    color: #ccc;
    transition: color 0.3s;
}
.footer-col a:hover {
    color: #ff5e57;
}
.footer-bottom {
    background: #1a1a1a;
    text-align: center;
    padding: 15px 0;
    margin-top: 30px;
    font-size: 0.85rem;
}

/* ===== SEO Section (above footer) ===== */
.seo-section {
    background: #fff;
    padding: 30px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    margin-top: 40px;
}
.seo-section h2 {
    font-size: 1.6rem;
    color: #333;
    margin-bottom: 8px;
}
.seo-section h3 {
    font-size: 1.2rem;
    color: #ff5e57;
    margin-bottom: 12px;
    font-weight: normal;
}
.seo-section p {
    font-size: 0.95rem;
    line-height: 1.9;
    color: #555;
    margin-bottom: 15px;
}
.keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.keywords span {
    background: #f0f0f0;
    color: #666;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    transition: background 0.3s;
}
.keywords span:hover {
    background: #ff5e57;
    color: #fff;
}

/* Color filter in sidebar */
#color-filter-form input[type="color"] {
    -webkit-appearance: none;
    border: 2px solid #ddd;
    padding: 2px;
    background: #fff;
    height: 40px;
    cursor: pointer;
}
#color-filter-form input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
#color-filter-form input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}
#color-filter-form input[type="range"] {
    -webkit-appearance: none;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}
#color-filter-form input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #ff5e57;
    border-radius: 50%;
    cursor: pointer;
}