/**
 * Single Affiliate Product Template Styles
 * Phase 3.1 - Frontend
 */

/* ============================================
   CONTENT + SIDEBAR LAYOUT
   ============================================ */

.ha-content-with-sidebar {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
    max-width: var(--max-width, 1400px);
    margin: 0 auto;
    padding: 0 20px;
}

.ha-content-main {
    min-width: 0;
}

/* Sidebar styling handled in sidebar.css */
.ha-product-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: fit-content;
    position: sticky;
    top: 100px;
}

/* ============================================
   LAYOUT & CONTAINER
   ============================================ */

.ha-single-product {
    background: var(--bg-card, #1c2333);
    padding: 20px 0;
}

.ha-container {
    max-width: var(--max-width, 1400px);
    margin: 0 auto;
    padding: 0 20px;
}

.ha-grid {
    display: grid;
    gap: 40px;
    align-items: start;
}

.ha-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.ha-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* ============================================
   HERO SECTION
   ============================================ */

.ha-hero {
    padding: 40px 0;
    margin-bottom: 40px;
    border-radius: 8px;
}

.ha-hero .ha-container {
    background: var(--bg-card, #1c2333);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ============================================
   PRODUCT IMAGES
   ============================================ */

.ha-product-images {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ha-main-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f5f5f5;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ha-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ha-placeholder-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
    color: #999;
    font-size: 18px;
    font-weight: 500;
}

.ha-discount-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: white;
    padding: 12px 20px;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

/* Gallery Thumbnails */

.ha-gallery-thumbnails {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.ha-gallery-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.ha-gallery-thumb:hover {
    border-color: #FF6B35;
    transform: scale(1.02);
}

/* ============================================
   PRODUCT INFO
   ============================================ */

.ha-product-info {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.ha-product-title {
    font-size: 32px;
    font-weight: bold;
    color: #0d1117;
    line-height: 1.2;
    margin: 0;
}

/* Meta Information */

.ha-product-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #64748b;
    font-size: 14px;
}

.ha-product-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ha-product-meta a {
    color: #FF6B35;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.ha-product-meta a:hover {
    color: #e55a2b;
}

/* Rating */

.ha-product-rating {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.ha-stars {
    font-size: 18px;
}

.ha-rating-text {
    color: #64748b;
    font-size: 14px;
}

/* Price Section */

.ha-price-section {
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #f3f4f6);
    border-radius: 12px;
    border-left: 4px solid #FF6B35;
}

.ha-price-original {
    color: #64748b;
    text-decoration: line-through;
    margin-bottom: 8px;
    font-size: 14px;
}

.ha-price-current {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.ha-currency {
    font-size: 18px;
    color: #64748b;
}

.ha-amount {
    font-size: 42px;
    font-weight: bold;
    color: #FF6B35;
}

.ha-discount-text {
    margin-top: 8px;
    color: #10B981;
    font-weight: 500;
    font-size: 14px;
}

.ha-strike {
    text-decoration: line-through;
}

/* Stock Status */

.ha-stock-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    font-weight: 500;
}

.ha-stock-icon {
    font-size: 20px;
}

.ha-stock-label {
    color: #0d1117;
}

/* CTA Buttons */

.ha-cta-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ha-button {
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
}

.ha-button-primary {
    background: linear-gradient(135deg, #FF6B35, #f7931e);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.2);
}

.ha-button-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.3);
}

.ha-button-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ha-button-secondary {
    background: var(--bg-card, #1c2333);
    color: #FF6B35;
    border: 2px solid #FF6B35;
}

.ha-button-secondary:hover:not(:disabled) {
    background: var(--bg-card, #1c2333)5F0;
    transform: translateY(-2px);
}

.ha-button-large {
    min-height: 50px;
    font-size: 16px;
}

.ha-button-small {
    padding: 10px 16px;
    font-size: 14px;
    min-height: auto;
}

/* Additional Info */

.ha-additional-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.ha-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ha-info-label {
    color: #64748b;
    font-size: 13px;
    text-transform: uppercase;
    font-weight: 600;
}

.ha-info-value {
    color: #0d1117;
    font-weight: 500;
}

/* ============================================
   TABS SECTION
   ============================================ */

.ha-tabs-section {
    padding: 40px 0;
    border-top: 1px solid #e5e7eb;
    margin-top: 40px;
}

.ha-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 32px;
}

.ha-tab-button {
    padding: 12px 24px;
    background: none;
    border: none;
    color: #64748b;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    margin-bottom: -2px;
}

.ha-tab-button:hover {
    color: #FF6B35;
}

.ha-tab-button.ha-tab-active {
    color: #FF6B35;
    border-bottom-color: #FF6B35;
}

.ha-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.ha-tab-content.ha-tab-active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.ha-description,
.ha-specifications,
.ha-reviews {
    color: #374151;
    line-height: 1.6;
    font-size: 16px;
}

.ha-description p,
.ha-specifications p,
.ha-reviews p {
    margin-bottom: 16px;
}

/* ============================================
   RELATED PRODUCTS
   ============================================ */

.ha-related-products {
    padding: 60px 0;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    margin-top: 60px;
}

.ha-related-products h2 {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 32px;
    color: #0d1117;
}

.ha-products-grid {
    grid-template-columns: repeat(3, 1fr);
}

.ha-product-card {
    background: var(--bg-card, #1c2333);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.ha-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.ha-product-card-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f5f5f5;
    overflow: hidden;
}

.ha-product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ha-product-card:hover .ha-product-card-image img {
    transform: scale(1.05);
}

.ha-product-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ha-product-card-body h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.4;
}

.ha-product-card-body h3 a {
    color: #0d1117;
    text-decoration: none;
    transition: color 0.3s ease;
}

.ha-product-card-body h3 a:hover {
    color: #FF6B35;
}

.ha-product-card-price {
    font-size: 20px;
    font-weight: bold;
    color: #FF6B35;
}

.ha-product-card-status {
    font-size: 13px;
    font-weight: 500;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .ha-content-with-sidebar {
        grid-template-columns: 1fr 300px;
        gap: 30px;
    }

    .ha-product-sidebar {
        top: 80px;
    }

    .ha-grid-2 {
        grid-template-columns: 1fr;
    }

    .ha-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .ha-product-title {
        font-size: 24px;
    }

    .ha-amount {
        font-size: 32px;
    }

    .ha-cta-buttons {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .ha-content-with-sidebar {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 0 16px;
    }

    .ha-product-sidebar {
        position: static;
        top: 0;
        order: 2;
    }

    .ha-content-main {
        order: 1;
    }

    .ha-hero .ha-container {
        padding: 20px;
    }

    .ha-product-images,
    .ha-product-info {
        gap: 16px;
    }

    .ha-product-title {
        font-size: 20px;
    }

    .ha-amount {
        font-size: 28px;
    }

    .ha-tabs {
        gap: 0;
        /* Scrollable on mobile */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .ha-tab-button {
        padding: 10px 16px;
        white-space: nowrap;
        font-size: 14px;
    }

    .ha-gallery-thumbnails {
        grid-template-columns: repeat(3, 1fr);
    }

    .ha-grid-3,
    .ha-products-grid {
        grid-template-columns: 1fr;
    }

    .ha-additional-info {
        grid-template-columns: 1fr;
    }

    .ha-related-products h2 {
        font-size: 22px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .ha-cta-buttons,
    .ha-tabs {
        display: none;
    }

    .ha-product-title {
        page-break-after: avoid;
    }
}
