/* ===== Variables & Reset ===== */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    direction: rtl;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    color: var(--gray-800);
    line-height: 1.6;
}

/* ===== Container ===== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ===== Dashboard Wrapper ===== */
.dashboard-wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ===== Breadcrumb ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 0;
}

.breadcrumb a {
    color: var(--primary);
    transition: var(--transition);
}

.breadcrumb a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.breadcrumb span {
    color: #000;
}

/* ===== Product Header ===== */
.product-header {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin: 20px 0;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ===== Product Main Layout ===== */
.product-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 32px;
}

@media (max-width: 968px) {
    .product-main {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* ===== Gallery ===== */
.product-gallery {
    position: sticky;
    top: 20px;
}

.gallery-main {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 16px;
    background: var(--gray-100);
    aspect-ratio: 1;
}

.gallery-main img {
    width: 92%;
    height: 92%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-main:hover img {
    transform: scale(1.05);
}

.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
}

.gallery-thumbs img {
    width: 16%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    opacity: 0.6;
}

.gallery-thumbs img:hover,
.gallery-thumbs img.active {
    border-color: var(--primary);
    opacity: 1;
    transform: translateY(-2px);
}

/* ===== Product Info ===== */
.product-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.product-info h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.product-info p {
    font-size: 15px;
    color: var(--gray-600);
    margin: 4px 0;
}

.product-info strong {
    color: var(--gray-800);
    font-weight: 600;
}

.product-info hr {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 16px 0;
}

/* ===== Product Views ===== */
.product-views {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--gray-600);
    width: fit-content;
}

.product-views svg {
    color: var(--primary);
}

/* ===== Tags ===== */
.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.product-tags a {
    display: inline-block;
    background: var(--gray-100);
    color: var(--gray-700);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    transition: var(--transition);
    border: 1px solid var(--gray-200);
}

.product-tags a:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* ===== Favorite Button ===== */
.favorite-wrapper {
    margin: 16px 0;
}

.btn-favorite {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--gray-700);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-favorite:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: #fef2f2;
    transform: translateY(-2px);
}

.btn-favorite.favorited {
    border-color: var(--danger);
    background: #fef2f2;
    color: var(--danger);
}

.btn-favorite:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Price ===== */
.price-original {
    text-decoration: line-through;
    color: var(--gray-400);
    font-size: 16px;
}

.price-final {
    font-size: 28px;
    font-weight: 700;
    color: var(--success);
}

/* ===== Free Badge ===== */
.free-badge-large {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border-radius: var(--radius-md);
    font-size: 18px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.free-badge-large svg {
    width: 28px;
    height: 28px;
}

/* ===== Download Section ===== */
.download-section {
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 20px;
}

.download-section h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-info-box {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.file-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

.file-info-item svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

/* ===== Buttons ===== */
.btn-download,
.btn-addcart,
.btn-login-download,
.submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-download {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: #fff;
}

.btn-download:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-download:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-download svg {
    width: 20px;
    height: 20px;
}

.btn-addcart {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #fff;
    margin-top: 16px;
}

.btn-addcart:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-login-download {
    background: var(--gray-800);
    color: #fff;
}

.btn-login-download:hover {
    background: var(--gray-900);
    transform: translateY(-2px);
}

/* ===== Download Notice ===== */
.download-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-top: 16px;
    line-height: 1.5;
}

.download-notice svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.download-notice.info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.download-notice.guest-ok {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* ===== Cart Alert ===== */
.cart-alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 14px;
    display: none;
}

.cart-alert.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.cart-alert.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ===== Tabs ===== */
.tabs {
    margin-top: 40px;
}

.tab-buttons {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
}

.tab-buttons div {
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    position: relative;
    bottom: -2px;
}

.tab-buttons div:hover {
    color: var(--primary);
}

.tab-buttons div.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 16px;
}

.product-description {
    font-size: 15px;
    line-height: 1.8;
    color: var(--gray-700);
}

.product-description h1, .product-description h2, .product-description h3 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--gray-900);
}

.product-description p {
    margin-bottom: 16px;
}

.product-description ul, .product-description ol {
    margin: 16px 0 16px 24px;
}

.product-description img {
    margin: 20px 0;
    border-radius: var(--radius-md);
}

/* ===== Comments Section ===== */
.comments-section {
    margin-top: 40px;
}

.comments-section h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 24px;
}

.comment-form {
    background: var(--gray-50);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 32px;
    border: 1px solid var(--gray-200);
}

.comment-form h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition);
    background: #fff;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.submit-btn {
    background: var(--primary);
    color: #fff;
    width: auto;
    padding: 12px 32px;
}

.submit-btn:hover {
    background: var(--primary-hover);
}

/* ===== Comments List ===== */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-item {
    background: #fff;
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.comment-item:hover {
    box-shadow: var(--shadow-md);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-100);
}

.comment-author {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 15px;
}

.comment-date {
    font-size: 13px;
    color: var(--gray-500);
}

.comment-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--gray-700);
}

.admin-reply {
    margin-top: 16px;
    padding: 16px;
    background: #eff6ff;
    border-right: 3px solid var(--primary);
    border-radius: var(--radius-sm);
}

.admin-reply-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
}

.admin-reply-text {
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.6;
}

.no-comments {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
    font-size: 15px;
}

/* ===== Alert Messages ===== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ===== Related Products ===== */
.related-products {
    margin-top: 40px;
}

.related-products h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 24px;
}

.related-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.related-item {
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    position: relative;
}

.related-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.related-free-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--success);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
    box-shadow: var(--shadow-sm);
}

.related-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.related-info {
    padding: 16px;
}

.related-info h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 12px;
    line-height: 1.4;
}

.related-info .price {
    font-size: 18px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 8px;
}

.related-info .views {
    font-size: 13px;
    color: var(--gray-500);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .container {
        padding: 16px 12px;
    }

    .dashboard-wrapper {
        padding: 16px;
        margin-bottom: 16px;
    }

    .product-header {
        font-size: 22px;
    }

    .product-info h2 {
        font-size: 20px;
    }

    .tab-buttons div {
        padding: 12px 16px;
        font-size: 14px;
    }

    .related-list {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
}
