/* ============================================
   KIDS SHELF - COMPONENT LIBRARY
   Buttons, Cards, Navigation, Forms
   ============================================ */

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 12px 20px;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-btn);
    transition: all var(--transition-slow);
    cursor: pointer;
    border: none;
    font-family: var(--font-heading);
    text-align: center;
    min-height: 44px;
}

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

.btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    transition: background 0.3s ease, transform 0.3s ease;
}

.btn-secondary {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.btn-whatsapp {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-whatsapp:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-icon {
    width: 16px;
    height: 16px;
}

/* ============================================
   PRODUCT CARDS — Equal height, button at bottom
   ============================================ */

.product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--color-bg-primary);
    border-radius: var(--radius-card);
    overflow: hidden;
    border: 1px solid var(--color-border-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: var(--shadow-card);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

/* Content area grows; keeps button at bottom */
.product-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.product-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: var(--card-padding-internal);
    min-height: 0;
}

.product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: var(--color-bg-secondary);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

/* Product badges — brand-colored discount; others use accent */
.book-badge,
.age-badge,
.discount-badge,
.featured-product-badge,
.bestseller-rank {
    position: absolute;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-normal);
    z-index: 2;
    box-shadow: var(--shadow-xs);
    transition: opacity var(--transition-slow);
}

.book-badge {
    top: 8px;
    left: 8px;
    background: var(--badge-discount-bg);
    color: var(--badge-discount-text);
}

.age-badge {
    top: 8px;
    right: 8px;
    background: var(--color-accent);
    color: #2B2D42;
}

.discount-badge,
.featured-product-badge {
    background: var(--badge-discount-bg);
    color: var(--badge-discount-text);
    padding: 4px 8px;
    font-size: 10px;
}

.featured-product-badge {
    top: 8px;
    left: 8px;
    white-space: nowrap;
}

.discount-badge {
    top: 8px;
    right: 8px;
}

.bestseller-rank {
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-normal);
    font-size: 14px;
    border: 2px solid white;
}

.product-category {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-normal);
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-1);
}

.product-name {
    font-size: 14px;
    font-weight: var(--font-weight-normal);
    color: var(--color-text-primary);
    line-height: var(--line-height-tight);
    margin-bottom: var(--space-2);
    font-family: var(--font-body);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-author {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-3);
    font-style: italic;
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    margin-top: auto;
    flex-wrap: wrap;
}

/* Final price larger & bold; old price smaller, muted, line-through */
.current-price {
    font-size: 18px;
    font-weight: var(--font-weight-normal);
    color: var(--color-primary);
    font-family: var(--font-heading);
    line-height: 1.2;
}

.original-price {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    color: var(--color-text-secondary);
    text-decoration: line-through;
}

/* Button fixed at bottom — margin-top: auto */
.add-to-cart-btn,
.featured-add-to-cart,
.bestseller-add-to-cart {
    margin-top: auto;
    width: calc(100% - var(--card-padding-internal) * 2);
    margin-left: var(--card-padding-internal);
    margin-right: var(--card-padding-internal);
    margin-bottom: var(--card-padding-internal);
    padding: 12px 16px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-btn);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    font-family: var(--font-heading);
    flex-shrink: 0;
}

.add-to-cart-btn:hover,
.featured-add-to-cart:hover,
.bestseller-add-to-cart:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

/* Featured & Bestseller cards — same equal-height, button at bottom */
.featured-product-card,
.bestseller-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--color-bg-primary);
    border-radius: var(--radius-card);
    overflow: hidden;
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.featured-product-card:hover,
.bestseller-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

.featured-product-link,
.bestseller-link {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    text-decoration: none;
    color: inherit;
}

.featured-product-info,
.bestseller-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: var(--card-padding-internal);
    min-height: 0;
}

.featured-product-price,
.bestseller-price {
    margin-top: auto;
}

.featured-add-to-cart,
.bestseller-add-to-cart {
    margin-top: auto;
}

@media (min-width: 768px) {
    .product-name {
        font-size: 15px;
    }
    
    .product-info {
        padding: var(--card-padding-internal);
    }
}

/* ============================================
   FEATURE CARDS
   ============================================ */

.feature-card {
    text-align: center;
    padding: var(--card-padding-internal);
    background: var(--color-bg-primary);
    border-radius: var(--radius-card);
    border: 1px solid var(--color-border-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: var(--shadow-card);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

.feature-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto var(--space-3);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    color: white;
    transition: background var(--transition-slow);
}

.feature-icon svg {
    width: 20px;
    height: 20px;
}

.feature-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: var(--font-weight-normal);
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
}

.feature-description {
    font-size: 11px;
    line-height: var(--line-height-relaxed);
    color: var(--color-text-secondary);
}

@media (min-width: 768px) {
    .feature-card {
        padding: var(--space-6);
    }
    
    .feature-icon {
        width: 56px;
        height: 56px;
        margin-bottom: var(--space-4);
    }
    
    .feature-icon svg {
        width: 28px;
        height: 28px;
    }
    
    .feature-title {
        font-size: var(--font-size-lg);
        margin-bottom: var(--space-2);
    }
    
    .feature-description {
        font-size: var(--font-size-sm);
    }
}

/* ============================================
   SECTION HEADERS
   ============================================ */

.section-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.section-title {
    font-family: var(--font-display);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-normal);
    color: var(--color-text-primary);
    margin-bottom: var(--space-3);
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--color-primary);
    border-radius: var(--radius-full);
}

.section-subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-normal);
    margin-top: var(--space-4);
}

@media (min-width: 768px) {
    .section-title {
        font-size: var(--font-size-h2-desktop);
    }
    
    .section-subtitle {
        font-size: var(--font-size-base);
    }
}

/* ============================================
   NOTIFICATIONS
   ============================================ */

.notification {
    padding: var(--space-4);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--color-primary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    color: var(--color-text-primary);
}

.notification.success {
    border-left-color: var(--color-success);
}

.notification.error {
    border-left-color: var(--color-error);
}

.notification.warning {
    border-left-color: var(--color-warning);
}

.notification.info {
    border-left-color: var(--color-info);
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: var(--space-8);
}

.pagination {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.page-link {
    padding: 8px 12px;
    background: white;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    color: var(--color-text-primary);
    transition: all var(--transition-base);
    min-width: 40px;
    text-align: center;
}

.page-link:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.page-link.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* ============================================
   FORMS
   ============================================ */

.filter-group {
    margin-bottom: var(--space-4);
}

.filter-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.filter-group select,
.filter-group input[type="number"],
.filter-group input[type="text"],
.filter-group input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    transition: all var(--transition-base);
    background: white;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* ============================================
   LOADING & ANIMATIONS
   ============================================ */

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border-light);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.fade-in {
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
