/**
 * KKTC Product Card Styles
 * Modern ve responsive ürün kartı stilleri
 */

/* Reset ve Base Styles */
.kktc-product-card *,
.kktc-product-card *::before,
.kktc-product-card *::after {
    box-sizing: border-box;
}

/* Product Card Container - Force priority over other styles */
.kktc-product-card {
    position: relative !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

/* Animation class override for mobile */
.kktc-product-card.kktc-animated {
    width: 100%;
    max-width: none;
    height: auto;
}


/* Card Link */
.kktc-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    flex: 1;
}

/* Product Image */
.kktc-card-image {
    text-align: center;
    margin: 0px!important;
    position: relative;
    padding: 0px!important;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px;
}

.kktc-card-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    display: block !important;
    image-rendering: auto !important;
    -ms-interpolation-mode: bicubic !important;
}


/* Card Content */
.kktc-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
}

/* Product Title */
.kktc-card-title {
    font-size: 16px;
    font-weight: 400;
    color: #111827;
    line-height: 1.4;
    margin: 0 0 2px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 44px;
}

/* Rating Section */
.kktc-card-rating {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    margin-top: 0;
    gap: 8px;
}

.kktc-stars {
    display: flex;
    gap: 2px;
}

.kktc-star {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.kktc-star-full {
    fill: #fbbf24;
}

.kktc-star-half {
    fill: url(#half);
}

.kktc-star-empty {
    fill: #e5e7eb;
}

.kktc-rating-text {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

/* Card Footer */
.kktc-card-footer {
    padding: 10px;
    margin-top: auto;
    border-top: 1px solid #f3f4f6;
}

/* Price Container */
.kktc-card-price {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #f8f9fa !important;
    border-radius: 8px !important;
    gap: 12px !important;
    padding: 5px 10px !important;
    min-height: 52px !important;
    height: 52px !important;
}

/* Price Section */
.kktc-price-section {
    flex: 1;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.kktc-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.kktc-price-row:last-child {
    margin-bottom: 0;
}

/* Regular Price (crossed out) - Increased specificity */
.kktc-product-card .kktc-card-price .kktc-regular-price,
.kktc-product-card .kktc-regular-price {
    font-size: 14px !important;
    color: #9ca3af !important;
    text-decoration: line-through !important;
    font-weight: 400 !important;
}

/* Discount Percentage - Increased specificity */
.kktc-product-card .kktc-card-price .kktc-discount-percent,
.kktc-product-card .kktc-discount-percent {
    font-size: 12px !important;
    color: #008A0A !important;
    font-weight: 600 !important;
    background: rgba(0, 138, 10, 0.1) !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
}

/* Sale Price - Increased specificity */
.kktc-product-card .kktc-card-price .kktc-sale-price,
.kktc-product-card .kktc-sale-price {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #008A0A !important;
}

/* Normal Price (when not on sale) - Increased specificity */
.kktc-product-card .kktc-card-price .kktc-normal-price,
.kktc-product-card .kktc-normal-price {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #000000 !important;
}

/* WooCommerce Price Override for Shortcodes */
.kktc-product-card .woocommerce-Price-amount,
.kktc-product-card .price .amount,
.kktc-product-card .price .woocommerce-Price-amount {
    color: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
}

/* WooCommerce Sale Price in Regular Price Span */
.kktc-product-card .kktc-regular-price .woocommerce-Price-amount,
.kktc-product-card .kktc-regular-price .amount,
.kktc-product-card .kktc-regular-price .price {
    color: #9ca3af !important;
    text-decoration: line-through !important;
}

/* WooCommerce Sale Price in Sale Price Span */
.kktc-product-card .kktc-sale-price .woocommerce-Price-amount,
.kktc-product-card .kktc-sale-price .amount,
.kktc-product-card .kktc-sale-price .price {
    color: #008A0A !important;
    text-decoration: none !important;
}

/* WooCommerce Normal Price in Normal Price Span */
.kktc-product-card .kktc-normal-price .woocommerce-Price-amount,
.kktc-product-card .kktc-normal-price .amount,
.kktc-product-card .kktc-normal-price .price {
    color: #000000 !important;
    text-decoration: none !important;
}

/* Add to Cart Button - Now just icon */
.kktc-add-to-cart {
    background: none !important;
    border: none !important;
    padding: 4px !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 4px !important;
    position: relative !important;
    visibility: visible !important;
    opacity: 1 !important;
}



.kktc-add-to-cart.loading {
    pointer-events: none;
    opacity: 0.7;
}

.kktc-add-to-cart.loading .kktc-cart-icon {
    display: none;
}

.kktc-add-to-cart.loading .kktc-cart-loading {
    display: block !important;
}

.kktc-cart-icon {
    fill: #666 !important;
    width: 20px !important;
    height: 20px !important;
    transition: fill 0.2s ease;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.kktc-add-to-cart:hover {
    background: rgb(167 121 2 / 10%);
}

.kktc-add-to-cart:hover .kktc-cart-icon {
    fill: #ff6000;
}

/* Disabled state */
.kktc-add-to-cart.kktc-disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.kktc-add-to-cart.kktc-disabled:hover {
    background: none;
}

.kktc-add-to-cart.kktc-disabled .kktc-cart-icon {
    fill: #ccc;
}


.kktc-cart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.kktc-spinner {
    animation: kktcSpin 1.4s linear infinite;
}

/* Success Animation */
.kktc-add-to-cart.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    animation: kktcSuccess 0.6s ease;
}

/* Product Grid */
.kktc-product-grid {
    display: grid;
    gap: var(--gap, 20px);
    margin: 20px 0;
    width: 100%;
    box-sizing: border-box;
}

.kktc-product-grid[data-columns="4"] {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    justify-content: center;
}

.kktc-product-grid[data-columns="3"] {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    justify-content: center;
}

.kktc-product-grid[data-columns="2"] {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    justify-content: center;
}

.kktc-grid-item {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 220px !important;
    max-width: 220px !important;
    min-width: 220px !important;
    border: 3px solid #F8F9FA;
    border-radius: 7px;
    box-sizing: border-box;
}

/* Tablet Responsive */
@media (max-width: 1024px) {
    .kktc-product-grid[data-columns="4"] {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .kktc-product-grid[data-columns="3"] {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .kktc-product-grid[data-columns="2"] {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .kktc-grid-item {
        width: 100% !important;
        max-width: 250px !important;
        min-width: 200px !important;
    }
    
    .kktc-card-title {
        font-size: 15px;
    }
    
    .kktc-card-price {
        font-size: 18px;
    }
}

@media (max-width: 768px) {
    .kktc-product-grid {
        gap: 12px !important;
        padding: 8px !important;
    }
    
    .kktc-product-grid[data-columns="4"],
    .kktc-product-grid[data-columns="3"],
    .kktc-product-grid[data-columns="2"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .kktc-grid-item {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 160px !important;
        height: auto !important;
        display: flex !important;
        justify-content: center !important;
    }
    
    .kktc-product-card {
        padding: 8px !important;
        border-radius: 6px !important;
        margin: 0 !important;
    }
    
    .kktc-card-image {
        height: 130px !important;
        margin: 4px 0 8px 0 !important;
        padding: 0px!important;
    }
    
    .kktc-card-title {
        font-size: 14px !important;
        min-height: 34px !important;
        line-height: 1.25 !important;
        margin-bottom: 6px !important;
    }
    
    .kktc-card-price {
        font-size: 15px !important;
        padding: 4px 6px !important;
    }
    
    .kktc-add-to-cart {
        width: 34px !important;
        height: 34px !important;
    }
    
    .kktc-add-to-cart svg {
        width: 15px !important;
        height: 15px !important;
    }
    
    .kktc-card-content {
        padding: 6px !important;
    }
    
    .kktc-card-footer {
        padding: 6px !important;
    }
    
    .kktc-card-rating {
        margin-bottom: 8px !important;
        gap: 6px !important;
    }
    
    .kktc-product-grid .kktc-product-card {
        width: 180px !important;
        max-width: 180px !important;
        flex-shrink: 0 !important;
    }
    
    /* Animated class mobile override */
    .kktc-product-card.kktc-animated {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Fix discount percent height on mobile */
    .kktc-discount-percent {
        line-height: 1.2 !important;
        padding: 3px 5px !important;
        display: inline-flex !important;
        align-items: center !important;
        height: auto !important;
        min-height: unset !important;
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .kktc-product-grid {
        gap: 10px !important;
        padding: 6px !important;
        margin: 10px 0 !important;
    }
    
    .kktc-product-grid[data-columns="4"],
    .kktc-product-grid[data-columns="3"],
    .kktc-product-grid[data-columns="2"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .kktc-grid-item {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 150px !important;
        height: auto !important;
        display: flex !important;
        justify-content: center !important;
    }
    
    .kktc-product-card {
        padding: 6px !important;
        border-radius: 5px !important;
        margin: 0 !important;
    }
    
    .kktc-card-image {
        height: 220px !important;
        padding:0px!important;
        margin:0px!important;
    }
    
    .kktc-card-title {
        font-size: 13px !important;
        margin-bottom: 5px !important;
        min-height: 30px !important;
        line-height: 1.2 !important;
    }
    
    .kktc-card-content {
        padding: 4px !important;
    }
    
    .kktc-card-footer {
        padding: 4px !important;
        margin-top: auto !important;
    }
    
    .kktc-card-price {
        padding: 6px 4px !important;
        font-size: 14px !important;
    }
    
    .kktc-add-to-cart {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
    }
    
    .kktc-add-to-cart svg {
        width: 13px !important;
        height: 13px !important;
    }
    
    .kktc-card-rating {
        margin-bottom: 6px !important;
        gap: 4px !important;
    }
    
    .kktc-star {
        width: 13px !important;
        height: 13px !important;
    }
    
    .kktc-rating-text {
        font-size: 11px !important;
    }
    
    .kktc-product-grid .kktc-product-card {
        width: 180px !important;
        max-width: 180px !important;
        flex-shrink: 0 !important;
    }
    
    /* Animated class mobile override */
    .kktc-product-card.kktc-animated {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Fix discount percent height on smaller mobile */
    .kktc-discount-percent {
        font-size: 11px !important;
        line-height: 1.15 !important;
        padding: 2px 4px !important;
        vertical-align: middle !important;
    }
}

/* Extra Small Mobile */
@media (max-width: 360px) {
    .kktc-product-grid {
        gap: 8px !important;
        padding: 4px !important;
        margin: 8px 0 !important;
    }
    
    .kktc-product-grid[data-columns="4"],
    .kktc-product-grid[data-columns="3"],
    .kktc-product-grid[data-columns="2"] {
        grid-template-columns: 1fr 1fr !important;
    }
    
    .kktc-grid-item {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 140px !important;
        height: auto !important;
        display: flex !important;
        justify-content: center !important;
    }
    
    .kktc-product-grid .kktc-product-card {
        width: 180px !important;
        max-width: 180px !important;
        flex-shrink: 0 !important;
    }
    
    .kktc-product-card {
        padding: 5px !important;
        border-radius: 4px !important;
        margin: 0 !important;
    }
    
    .kktc-card-image {
        height: 95px !important;
        padding: 0px!important;
        margin: 0px!important;
    }
    
    .kktc-card-title {
        font-size: 12px !important;
        min-height: 26px !important;
        margin-bottom: 4px !important;
        line-height: 1.1 !important;
    }
    
    .kktc-card-content {
        padding: 3px !important;
    }
    
    .kktc-card-footer {
        padding: 3px !important;
        margin-top: auto !important;
    }
    
    .kktc-card-price {
        font-size: 12px !important;
        padding: 4px 3px !important;
    }
    
    .kktc-add-to-cart {
        width: 26px !important;
        height: 26px !important;
        min-width: 26px !important;
    }
    
    .kktc-add-to-cart svg {
        width: 11px !important;
        height: 11px !important;
    }
    
    .kktc-card-rating {
        margin-bottom: 4px !important;
        gap: 3px !important;
    }
    
    .kktc-star {
        width: 11px !important;
        height: 11px !important;
    }
    
    .kktc-rating-text {
        font-size: 9px !important;
    }
    
    /* Animated class mobile override */
    .kktc-product-card.kktc-animated {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }
}

/* Animations */
@keyframes kktcFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes kktcSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes kktcSuccess {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Notification Styles */
.kktc-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    animation: kktcSlideIn 0.3s ease;
    max-width: 320px;
}

.kktc-notification.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

.kktc-notification-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.kktc-notification-content {
    flex: 1;
}

.kktc-notification-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.kktc-notification-action {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.2s;
}

.kktc-notification-action:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

@keyframes kktcSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes kktcSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .kktc-product-card {
        background: #1f2937;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .kktc-card-title {
        color: #f3f4f6;
    }
    
    .kktc-card-price {
        background: #374151;
        color: #f3f4f6;
    }
    
    .kktc-card-footer {
        border-top-color: #374151;
    }
    
    .kktc-rating-text {
        color: #9ca3af;
    }
}

/* Trending Badge Styles */
/* Trending product specific styles */
.kktc-product-card.trending-product {
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

.kktc-trending-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    z-index: 2;
    animation: trendPulse 2s infinite;
    box-shadow: 0 2px 4px rgba(255, 107, 53, 0.3);
}

@keyframes trendPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.kktc-trend-debug-info {
    background: #f0f8ff;
    padding: 4px 8px;
    margin-top: 5px;
    border-radius: 4px;
    border: 1px solid #e1f5fe;
}

.kktc-trending-grid .kktc-grid-container {
    gap: 20px;
}

.kktc-trending-item {
    position: relative;
}

/* Print Styles */
@media print {
    .kktc-add-to-cart,
    .kktc-card-badge,
    .kktc-trending-badge,
    .kktc-notification {
        display: none !important;
    }
    
    .kktc-product-card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
        break-inside: avoid;
    }
}