/* Kaufradar Widget Manager - Frontend Styles */

/* ==================== PRODUKT-WIDGET ==================== */

.kwm-product-box {
    max-width: 650px;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 0 !important;
    padding: 20px;
    margin: 30px auto;
    position: relative;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.kwm-discount-badge {
    position: absolute;
    top: 0;
    left: 0;
    background: #c41e3a;
    color: white;
    padding: 5px 12px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 0;
    z-index: 10;
}

.kwm-product-inner {
    display: grid;
    grid-template-columns: 160px 1fr auto;
    gap: 18px;
    align-items: center;
}

.kwm-product-image {
    width: 160px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    flex-shrink: 0;
}

.kwm-product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

.kwm-product-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.kwm-product-title {
    font-size: 20px;
    font-weight: 700;
    color: #000000;
    line-height: 1.3;
    margin: 0;
}

.kwm-product-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.kwm-price-section {
    text-align: center;
}

.kwm-old-price {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
    margin-bottom: 2px;
    line-height: 1;
}

.kwm-current-price {
    font-size: 22px;
    font-weight: 700;
    color: #c41e3a;
    line-height: 1;
}

.kwm-angebot-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.kwm-angebot-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
}

/* Coupon Inline */
.kwm-coupon-inline {
    background: #e8f5e9;
    padding: 8px 12px;
    margin: 6px 0;
    font-size: 11px;
    font-weight: 500;
    color: #2e7d32;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 220px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.kwm-coupon-inline:hover {
    background: #dcedc8;
}

.kwm-coupon-code {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    margin-left: 6px;
    color: #2e7d32;
}

.kwm-copy-icon {
    color: #2e7d32;
    font-size: 16px;
    transition: transform 0.2s ease;
    user-select: none;
}

.kwm-coupon-inline:hover .kwm-copy-icon {
    transform: scale(1.2);
}

.kwm-coupon-copied {
    color: #2ea44f;
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
    text-align: center;
    display: none;
}

.kwm-coupon-copied.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kwm-cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #5A8098;
    color: #ffffff;
    text-decoration: none;
    padding: 10px 24px;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    min-width: 160px;
}

.kwm-cta-button:hover {
    background: #4a6a7e;
    color: #ffffff;
    text-decoration: none;
}

.kwm-cta-button::after {
    content: '›';
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
}

/* ==================== BESTENLISTEN-WIDGET ==================== */

.kwm-bestlist-ticker {
    max-width: 650px;
    margin: 30px auto;
    background: white;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
}

/* Fade-Out Effekte */
.kwm-bestlist-ticker::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 80px;
    background: linear-gradient(to right, transparent, white);
    pointer-events: none;
    z-index: 50;
    transition: opacity 0.2s ease;
}

.kwm-bestlist-ticker.at-end::after {
    opacity: 0;
}

.kwm-bestlist-ticker::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 80px;
    background: linear-gradient(to left, transparent, white);
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.kwm-bestlist-ticker.scrolled::before {
    opacity: 1;
}

.kwm-bestlist-wrapper {
    position: relative;
    padding-right: 0;
}

.kwm-bestlist-container {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    gap: 0;
    cursor: grab;
    user-select: none;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.kwm-bestlist-container::-webkit-scrollbar {
    display: none;
}

.kwm-bestlist-container:active {
    cursor: grabbing;
}

.kwm-bestlist-container.dragging {
    scroll-behavior: auto;
}

/* Einzelnes Bestenlisten-Item */
.kwm-bestlist-item {
    min-width: 200px;
    max-width: 200px;
    border-right: 1px solid #e5e5e5;
    border-bottom: 1px solid #e5e5e5;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    position: relative;
    background: white;
    flex-shrink: 0;
    overflow: hidden;
}

.kwm-bestlist-item:last-child {
    border-right: none;
}

/* Ranking-Badge */
.kwm-bestlist-rank {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    background: #4A90E2;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Rabatt-Badge */
.kwm-bestlist-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #dc3545;
    color: white;
    padding: 4px 10px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 13px;
    z-index: 2;
}

/* Marke/Brand */
.kwm-bestlist-brand {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    text-align: center;
}

/* Produktbild */
.kwm-bestlist-image {
    width: 100%;
    height: 140px;
    object-fit: contain;
    margin: 10px 0;
    padding: 5px;
}

/* Produkttitel */
.kwm-bestlist-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    min-height: 40px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    text-align: center;
}

/* Preis-Container */
.kwm-bestlist-price-container {
    margin-top: auto;
    margin-bottom: 12px;
    text-align: center;
}

.kwm-bestlist-old-price {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    margin-bottom: 3px;
}

.kwm-bestlist-current-price {
    font-size: 20px;
    font-weight: 700;
    color: #dc3545;
}

/* Button */
.kwm-bestlist-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    background: #5A8098;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    min-height: 40px;
}

.kwm-bestlist-button:hover {
    background: #4a6a7e;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Button mit Icon */
.kwm-bestlist-button-icon {
    max-width: 80px;
    max-height: 24px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

/* Amazon-spezifisch */
.kwm-bestlist-button[data-partner*="Amazon"],
.kwm-bestlist-button[data-partner*="amazon"] {
    background: #FF9900;
}

.kwm-bestlist-button[data-partner*="Amazon"]:hover,
.kwm-bestlist-button[data-partner*="amazon"]:hover {
    background: #e88a00;
}

/* Navigation Buttons */
.kwm-bestlist-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    line-height: 0;
    z-index: 100;
    transition: background 0.2s ease;
    border-radius: 4px;
    font-weight: 300;
    pointer-events: all;
    padding: 0;
    margin: 0;
}

.kwm-bestlist-nav:hover {
    background: rgba(0, 0, 0, 0.8);
}

.kwm-bestlist-nav-left {
    left: 10px;
}

.kwm-bestlist-nav-right {
    right: 10px;
}

.kwm-bestlist-nav.hide {
    display: none;
}

.kwm-bestlist-nav.show {
    display: flex;
}

/* ==================== MOBILE RESPONSIVE ==================== */

/* Produkt-Widget Mobile */
@media screen and (max-width: 768px) {
    .kwm-product-box {
        padding: 15px;
    }
    
    .kwm-discount-badge {
        left: auto;
        right: 0;
        padding: 4px 10px;
        font-size: 13px;
    }
    
    .kwm-product-inner {
        grid-template-columns: 1fr;
        gap: 15px;
        text-align: center;
    }
    
    .kwm-product-image {
        max-width: 200px;
        margin: 0 auto;
        height: 120px;
    }
    
    .kwm-product-title {
        font-size: 18px;
    }
    
    .kwm-current-price {
        font-size: 20px;
    }
    
    .kwm-product-cta {
        align-items: center;
    }
    
    .kwm-price-section {
        text-align: center;
    }
    
    .kwm-angebot-section {
        align-items: center;
    }
    
    .kwm-coupon-inline {
        max-width: 100%;
    }
    
    .kwm-cta-button {
        width: 100%;
        max-width: 300px;
    }
}

/* Bestenlisten Mobile */
@media (max-width: 650px) {
    .kwm-bestlist-ticker {
        max-width: 100%;
    }
    
    .kwm-bestlist-item {
        min-width: calc((100% - 70px) / 2);
    }
}

@media (max-width: 400px) {
    .kwm-bestlist-item {
        min-width: calc(100% - 70px);
    }
    
    .kwm-product-box {
        padding: 12px;
    }
    
    .kwm-discount-badge {
        font-size: 12px;
        padding: 3px 8px;
    }
    
    .kwm-product-title {
        font-size: 16px;
    }
}

/* ==================== DARK MODE SUPPORT ==================== */

@media (prefers-color-scheme: dark) {
    .kwm-product-box {
        background: #2a2a2a;
        border: 1px solid #404040;
    }
    
    .kwm-product-image {
        background: #1f1f1f;
    }
    
    .kwm-product-title {
        color: #ffffff;
    }
    
    .kwm-old-price {
        color: #888;
    }
    
    .kwm-current-price {
        color: #ff6b6b;
    }
    
    .kwm-angebot-label {
        color: #aaa;
    }
    
    .kwm-coupon-inline {
        background: #1b3a1f;
        border-color: #2e7d32;
    }
    
    .kwm-coupon-code,
    .kwm-copy-icon {
        color: #66bb6a;
    }
    
    .kwm-cta-button {
        background: #6a95b0;
    }
    
    .kwm-cta-button:hover {
        background: #5a8098;
    }
    
    /* Bestenlisten Dark Mode */
    .kwm-bestlist-ticker {
        background: #2a2a2a;
    }
    
    .kwm-bestlist-item {
        background: #2a2a2a;
        border-color: #404040;
    }
    
    .kwm-bestlist-title {
        color: #ffffff;
    }
    
    .kwm-bestlist-brand {
        color: #888;
    }
    
    .kwm-bestlist-old-price {
        color: #888;
    }
    
    .kwm-bestlist-current-price {
        color: #ff6b6b;
    }
    
    .kwm-bestlist-ticker::after {
        background: linear-gradient(to right, transparent, #2a2a2a);
    }
    
    .kwm-bestlist-ticker::before {
        background: linear-gradient(to left, transparent, #2a2a2a);
    }
}
