:root {
    --bg: #0f172a;
    --card: #1e293b;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --glass: rgba(30, 41, 59, 0.7);
    --border: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tahoma', 'Segoe UI', Arial, sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* نوار بالا */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 5px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: var(--text);
    border-radius: 5px;
    transition: 0.3s;
}

.logo-text {
    font-size: 1rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    position: relative;
    width: 300px;
}

.search-box input {
    width: 100%;
    padding: 10px 15px;
    border-radius: 25px;
    border: 1px solid var(--border);
    background: #0f172a;
    color: white;
    outline: none;
    transition: 0.3s;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.suggestions-list {
    position: absolute;
    top: 110%;
    right: 0;
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 100;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.suggestion-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: 0.2s;
}

.suggestion-item:hover {
    background: var(--primary);
    color: white;
}

/* کانتینر اصلی */
.container {
    padding: 90px 20px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.hero {
    text-align: center;
    margin-bottom: 30px;
    animation: fadeInDown 1s ease;
}

.hero h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    background: linear-gradient(to right, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* بخش پروژه‌ها */
.projects-section {
    width: 100%;
}

/* گرید هوشمند: هر ۱۰ کارت یک ردیف */
.grid-auto {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: flex-start;
}

.card {
    background: var(--card);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border);
    position: relative;
    display: flex;
    flex-direction: column;
    
    /* محاسبه عرض برای ۱۰ کارت در هر ردیف */
    width: calc(10% - 15px); 
    min-width: 120px; /* حداقل عرض برای موبایل */
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.2);
}

.card-img-wrapper {
    width: 100%;
    aspect-ratio: 1/1;
    overflow: hidden;
    position: relative;
}

.card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.card:hover img {
    transform: scale(1.1);
}

.card-body {
    padding: 10px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-title {
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: var(--text);
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* لودر */
.loader {
    text-align: center;
    padding: 40px;
    width: 100%;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* مودال */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: var(--card);
    padding: 25px;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    position: relative;
    text-align: center;
    border: 1px solid var(--primary);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.3);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 2px solid var(--border);
}

.close {
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-muted);
    transition: 0.2s;
    z-index: 10;
}

.close:hover {
    color: #ef4444;
}

.btn {
    background: linear-gradient(45deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    margin-top: 20px;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

/* منوی کشویی (Side Menu) */
.side-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100%;
    background: var(--card);
    z-index: 1500;
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -5px 0 20px rgba(0,0,0,0.5);
    padding: 20px;
    border-left: 1px solid var(--border);
    display: none;
}

.side-menu.active {
    right: 0;
    display: block;
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.menu-header h3 {
    color: var(--primary);
}

.close-menu {
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.menu-items {
    list-style: none;
}

.menu-items li {
    padding: 15px;
    margin-bottom: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-items li:hover {
    background: var(--primary);
    color: white;
    transform: translateX(-5px);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1400;
    display: none;
    backdrop-filter: blur(2px);
}

.overlay.active {
    display: block;
}

/* پنل درباره ما */
.about-panel {
    position: fixed;
    top: 0;
    left: -100%;
    width: 350px;
    height: 100%;
    background: var(--card);
    z-index: 1600;
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 5px 0 20px rgba(0,0,0,0.5);
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid var(--border);
}

.about-panel.active {
    left: 0;
}

.about-header {
    text-align: center;
    margin-bottom: 20px;
}

.avatar {
    font-size: 4rem;
    margin: 10px 0;
    background: var(--bg);
    width: 100px;
    height: 100px;
    line-height: 100px;
    border-radius: 50%;
    margin: 10px auto;
    border: 2px solid var(--primary);
}

.social-link {
    background: rgba(99, 102, 241, 0.1);
    padding: 10px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    border: 1px solid var(--primary);
}

.close-about {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

@media (max-width: 1024px) {
    .card {
        width: calc(12.5% - 15px); /* 8 cards per row */
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 10px;
    }
    .search-box {
        width: 150px;
    }
    .side-menu, .about-panel {
        width: 85%;
    }
    .hero h1 {
        font-size: 1.6rem;
    }
    .card {
        width: calc(20% - 15px); /* 5 cards per row on tablet */
    }
}

@media (max-width: 480px) {
    .card {
        width: calc(33.33% - 15px); /* 3 cards per row on mobile */
    }
}