/* === متغیرها و تنظیمات پایه === */
:root {
    --primary-color: #f12354;
    --primary-dark: #c91a42;
    --primary-light: #ff4d7a;
    --primary-bg: #fff0f3;
    --secondary-color: #2d1b69;
    --accent-color: #ffd700;
    --bg-color: #fafafa;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-light: #666666;
    --text-muted: #999999;
    --border-color: #e8e8e8;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s ease;
    --font-main: 'Vazirmatn', 'IranSans', Tahoma, sans-serif;
}

/* === ریست و پایه === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, #fce4ec 0%, #f8f9fa 50%, #fff3e0 100%);
    color: var(--text-color);
    line-height: 1.8;
    min-height: 100vh;
}

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

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* === هدر === */
.main-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white !important;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.logo i {
    font-size: 2rem;
    color: var(--primary-color);
}

.main-nav {
    display: flex;
    gap: 5px;
}

.main-nav a {
    color: rgba(255,255,255,0.8);
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.main-nav a:hover,
.main-nav a.active {
    color: white;
    background: rgba(241, 35, 84, 0.3);
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box form {
    display: flex;
    gap: 0;
}

.search-box input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid transparent;
    border-radius: 25px 0 0 25px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 1rem;
    font-family: var(--font-main);
    transition: var(--transition);
}

.search-box input::placeholder {
    color: rgba(255,255,255,0.5);
}

.search-box input:focus {
    outline: none;
    background: rgba(255,255,255,0.2);
    border-color: var(--primary-color);
}

.search-box button {
    padding: 12px 25px;
    background: var(--primary-color);
    border: none;
    color: white;
    border-radius: 0 25px 25px 0;
    cursor: pointer;
    transition: var(--transition);
}

.search-box button:hover {
    background: var(--primary-dark);
}

/* === محتوای اصلی === */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 40px 0;
}

/* === هدر صفحه === */
.page-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-lg);
    color: white;
    box-shadow: var(--shadow-lg);
}

.page-title {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.page-description {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* === گرید آیتم‌ها === */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.item-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 2px solid transparent;
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.item-link {
    display: block;
    padding: 25px;
    color: var(--text-color);
}

.item-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.item-icon i {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.item-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.item-desc {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.item-version {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* === نشان‌ها === */
.badge {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.badge-plugin {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-theme {
    background: #f3e5f5;
    color: #7b1fa2;
}

.badge-wordpress {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-info {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-danger {
    background: #fce4ec;
    color: #c62828;
}

/* === ستاره‌ها === */
.stars {
    --percent: calc(var(--rating) / 5 * 100%);
    display: inline-block;
    font-size: 1rem;
    line-height: 1;
}

.stars::before {
    content: "★★★★★";
    background: linear-gradient(90deg, #ffd700 var(--percent), #ddd var(--percent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === صفحه‌بندی === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.page-link {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--text-color);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.page-link:hover,
.page-link.active {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* === صفحه دانلود === */
.download-page {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-md);
}

.download-header {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    align-items: flex-start;
}

.download-icon {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.download-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.download-icon i {
    font-size: 4rem;
    color: var(--primary-color);
}

.download-title {
    font-size: 2rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.download-desc {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.download-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-light);
    font-size: 0.95rem;
}

.meta-item i {
    color: var(--primary-color);
    font-size: 1.2rem;
    width: 25px;
    text-align: center;
}

.download-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.download-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
}

.download-section h2 {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.section-content {
    color: var(--text-light);
    line-height: 2;
}

/* === جدول نسخه‌ها === */
.versions-table {
    width: 100%;
    border-collapse: collapse;
}

.versions-table th {
    background: var(--primary-bg);
    color: var(--secondary-color);
    padding: 15px;
    text-align: right;
    font-weight: 600;
}

.versions-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

/* === دکمه‌ها === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-main);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(241, 35, 84, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(241, 35, 84, 0.6);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 15px 35px;
    font-size: 1.2rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* === صفحه ۴۰۴ === */
.error-404 {
    text-align: center;
    padding: 80px 20px;
}

.error-content h1 {
    font-size: 8rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
}

.error-content h2 {
    font-size: 2rem;
    color: var(--secondary-color);
    margin: 20px 0;
}

/* === حالت خالی === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.empty-state i {
    font-size: 5rem;
    color: var(--border-color);
    margin-bottom: 20px;
}

/* === فوتر === */
.main-footer {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: rgba(255,255,255,0.8);
    padding: 50px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-col h4 {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.footer-col h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 50px;
    height: 3px;
    background: var(--primary-color);
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col a {
    color: rgba(255,255,255,0.6);
    transition: var(--transition);
}

.footer-col a:hover {
    color: var(--primary-color);
    padding-right: 5px;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    text-align: center;
}

/* === پنل مدیریت === */
.admin-page {
    background: #f5f6fa;
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header a {
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    color: rgba(255,255,255,0.7);
    transition: var(--transition);
    border-right: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: white;
    border-right-color: var(--primary-color);
}

.logout-link {
    margin-top: auto;
    color: #ff6b6b !important;
}

.admin-main {
    flex: 1;
    margin-right: 250px;
    padding: 30px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.admin-header h1 {
    font-size: 2rem;
    color: var(--secondary-color);
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.stat-info h3 {
    font-size: 1.8rem;
    color: var(--secondary-color);
}

.stat-info p {
    color: var(--text-muted);
}

.admin-card {
    background: white;
    padding: 30px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 30px;
}

.admin-card h2 {
    color: var(--secondary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.admin-card h3 {
    color: var(--secondary-color);
    margin: 30px 0 20px;
    font-size: 1.3rem;
}

.admin-form .form-group {
    margin-bottom: 20px;
}

.admin-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
}

.admin-form small {
    display: block;
    color: var(--text-muted);
    margin-top: 5px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font-main);
    transition: var(--transition);
    background: #fafafa;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(241, 35, 84, 0.1);
}

textarea.form-control {
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.table-responsive {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    background: var(--primary-bg);
    color: var(--secondary-color);
    padding: 12px 15px;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.action-buttons {
    display: flex;
    gap: 5px;
}

/* === صفحه لاگین === */
.admin-login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.login-header h1 {
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

/* === اعلان‌ها === */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* === جستجوی زنده === */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    margin-top: 10px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.search-result-item {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: var(--transition);
}

.search-result-item:hover {
    background: var(--primary-bg);
}

.search-result-item img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.search-result-item .result-name {
    font-weight: 600;
    color: var(--secondary-color);
}

.search-result-item .result-type {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* === رسپانسیو === */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
    }
    
    .search-box {
        max-width: 100%;
        width: 100%;
    }
    
    .page-title {
        font-size: 1.8rem;
    }
    
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .download-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .download-meta {
        grid-template-columns: 1fr;
    }
    
    .download-actions {
        justify-content: center;
    }
    
    .admin-wrapper {
        flex-direction: column;
    }
    
    .admin-sidebar {
        position: static;
        width: 100%;
        height: auto;
    }
    
    .admin-main {
        margin-right: 0;
    }
    
    .admin-stats {
        grid-template-columns: 1fr 1fr;
    }
}