/*
Theme Name: سازتو
Theme URI: https://sazeto.com
Author: Sazeto
Description: قالب اختصاصی بازار دست دوم سازهای موسیقی سازتو
Version: 1.0.0
Requires PHP: 8.0
Text Domain: sazeto
*/

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

:root {
    --primary: #2563eb;
    --secondary: #1e40af;
    --success: #059669;
    --warning: #f59e0b;
    --danger: #dc2626;
    --light: #f9fafb;
    --lighter: #f3f4f6;
    --border: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --radius: 8px;
}

body {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background: var(--light);
    line-height: 1.6;
    direction: rtl;
}

a { color: inherit; }

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

/* Navigation */
.site-header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.site-header .nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

.nav-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-secondary { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--lighter); }

.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-small { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-block { width: 100%; text-align: center; }

/* Hero */
.hero {
    position: relative;
    background: linear-gradient(-45deg, #667eea, #764ba2, #4f46e5, #7c3aed);
    background-size: 300% 300%;
    animation: sazeto-hero-gradient 14s ease infinite;
    color: white;
    padding: 4rem 0;
    margin-bottom: 2rem;
    border-radius: var(--radius);
    overflow: hidden;
}

.hero.has-bg-image {
    background-size: cover;
    background-position: center;
    animation: none;
}

.hero .hero-inner {
    position: relative;
    z-index: 2;
}

.hero h1 {
    font-size: 2.1rem;
    margin-bottom: 0.5rem;
    opacity: 0;
    animation: sazeto-fade-up 0.7s ease-out 0.1s forwards;
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0;
    animation: sazeto-fade-up 0.7s ease-out 0.3s forwards;
}

.hero .search-box {
    opacity: 0;
    animation: sazeto-fade-up 0.7s ease-out 0.5s forwards;
}

@keyframes sazeto-hero-gradient {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes sazeto-fade-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .hero { animation: none; }
    .hero h1, .hero p, .hero .search-box { animation: none; opacity: 1; }
}

/* Search */
.search-box {
    display: grid;
    grid-template-columns: 1fr 150px 150px auto;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .search-box { grid-template-columns: 1fr; }
}

input, select, textarea {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Filters */
.filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: white;
    border-radius: 20px;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.85rem;
}

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

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

/* Card */
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.card-image {
    height: 160px;
    background: var(--lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    position: relative;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--danger);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.card-sold {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.card-body { padding: 1rem; }
.card-title { font-weight: 600; margin-bottom: 0.25rem; font-size: 0.95rem; }
.card-subtitle { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.75rem; }

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-price { font-weight: 600; color: var(--primary); }

.card-condition {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: var(--lighter);
}

.card-condition.excellent { background: #d1fae5; color: #047857; }
.card-condition.good { background: #fef3c7; color: #b45309; }
.card-condition.fair { background: #fed7aa; color: #92400e; }
.card-condition.mint { background: #c7d2fe; color: #312e81; }

/* Dashboard */
.dashboard-header { margin-bottom: 2rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.stat-value { font-size: 1.75rem; font-weight: 600; color: var(--text-primary); }

/* Table */
.table-responsive {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 2rem;
}

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

th {
    background: var(--lighter);
    padding: 1rem;
    text-align: right;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

td { padding: 1rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }

/* Form */
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; }
.form-card { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; max-width: 700px; }

/* Installment */
.installment-section { background: var(--lighter); padding: 1rem; border-radius: var(--radius); margin-top: 1rem; }
.installment-section h3 { font-size: 0.95rem; margin-bottom: 0.75rem; }

.toggle-checkbox {
    width: 40px; height: 24px; background: var(--border); border-radius: 12px;
    position: relative; cursor: pointer; transition: background 0.2s; display: inline-block; vertical-align: middle;
}
.toggle-checkbox.active { background: var(--success); }
.toggle-checkbox::after {
    content: ''; position: absolute; width: 20px; height: 20px; background: white;
    border-radius: 50%; top: 2px; left: 2px; transition: left 0.2s;
}
.toggle-checkbox.active::after { left: 18px; }
.installment-options { display: none; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.installment-options.show { display: block; }

/* Tabs */
.tabs { display: flex; gap: 1rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab {
    padding: 1rem; border: none; background: none; color: var(--text-secondary); cursor: pointer;
    border-bottom: 3px solid transparent; font-size: 0.95rem; text-decoration: none;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Alert */
.alert { padding: 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-success { background: #d1fae5; color: #047857; border-right: 4px solid var(--success); }
.alert-error { background: #fee2e2; color: #991b1b; border-right: 4px solid var(--danger); }

/* Footer */
.site-footer {
    background: var(--lighter);
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    text-align: center;
}

.badge { display: inline-block; padding: 0.25rem 0.75rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-installment { background: #fecaca; color: #7f1d1d; }
.badge-sold { background: var(--lighter); color: var(--text-secondary); }
.badge-pending { background: #fef3c7; color: #b45309; }
.badge-approved { background: #d1fae5; color: #047857; }
.badge-rejected { background: #fee2e2; color: #991b1b; }

/* Detail Page */
.product-detail-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 2rem; margin-bottom: 2rem; }
@media (max-width: 900px) { .product-detail-grid { grid-template-columns: 1fr; } }
.gallery-main { width: 100%; height: 360px; object-fit: cover; border-radius: var(--radius); background: var(--lighter); }
.gallery-thumbs { display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }
.gallery-thumbs img { width: 70px; height: 70px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 2px solid transparent; }
.gallery-thumbs img.active { border-color: var(--primary); }

.pagination { display: flex; gap: 0.5rem; justify-content: center; margin: 2rem 0; }
.pagination a, .pagination span { padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text-primary); }
.pagination .current { background: var(--primary); color: white; border-color: var(--primary); }

/* Telegram popup */
.sazeto-tg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(2px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sazeto-tg-overlay.is-visible { opacity: 1; }

.sazeto-tg-modal {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 2.5rem 2rem 2rem;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    transform: translateY(14px) scale(0.97);
    transition: transform 0.25s ease;
}

.sazeto-tg-overlay.is-visible .sazeto-tg-modal {
    transform: translateY(0) scale(1);
}

.sazeto-tg-icon { margin-bottom: 1rem; }

.sazeto-tg-modal h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.sazeto-tg-modal p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.sazeto-tg-close {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--lighter);
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}

.sazeto-tg-close:hover { background: var(--border); }

/* Responsive */
@media (max-width: 768px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .nav-links { display: none; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
