/**
 * Public styles for Price History plugin
 */

.price-history-text {
    margin: 10px 0;
    padding: 8px 12px;
    background: #f8f9fa;
    border-left: 3px solid #0073aa;
    font-size: 0.9em;
    color: #333;
}

/* Badge Styles - Enhanced with customization */
.price-history-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    border: none;
    margin: 5px 0;
    gap: 6px;
    /* Default colors - will be overridden by inline styles */
    background: #e74c3c;
    color: #ffffff;
    border-radius: 4px;
}

.price-history-badge.badge-size-small {
    padding: 4px 8px;
    font-size: 10px;
}

.price-history-badge.badge-size-medium {
    padding: 6px 12px;
    font-size: 12px;
}

.price-history-badge.badge-size-large {
    padding: 8px 16px;
    font-size: 14px;
}

.price-history-badge .badge-text {
    flex: 1;
}

.price-history-badge .badge-price {
    font-weight: 700;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 4px;
}

/* Graph Modal Trigger Styles */
.price-history-graph-trigger {
    margin: 10px 0;
}

.price-history-graph-link {
    color: #2271b1;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
}

.price-history-graph-link:hover {
    color: #135e96;
    text-decoration: none;
}

.price-history-graph-button {
    background: #2271b1 !important;
    border-color: #2271b1 !important;
    color: #fff !important;
    text-decoration: none !important;
    padding: 8px 16px !important;
    font-size: 13px !important;
    border-radius: 3px !important;
    cursor: pointer !important;
    display: inline-block !important;
    border: 1px solid transparent;
}

.price-history-graph-button:hover {
    background: #135e96 !important;
    border-color: #135e96 !important;
    color: #fff !important;
}

/* Modal Styles */
.price-history-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
}

.price-history-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.price-history-modal-content {
    background: #fff;
    border-radius: 8px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    position: relative;
}

.price-history-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #ddd;
    background: #f9f9f9;
}

.price-history-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.price-history-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.price-history-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.price-history-modal-body {
    padding: 24px;
    height: 400px;
    position: relative;
}

.price-history-modal-body canvas {
    max-width: 100%;
    height: 100% !important;
}

/* Body class when modal is open */
body.price-history-modal-open {
    overflow: hidden;
}

/* Product page integration */
.single-product .price-history-text {
    margin-bottom: 15px;
}

.single-product .price-history-badge {
    margin-bottom: 10px;
}

.single-product .price-history-graph {
    margin-bottom: 20px;
}

/* Shop page integration */
.woocommerce-loop-product__title + .price-history-text,
.woocommerce-loop-product__title + .price-history-badge {
    margin-top: 5px;
    margin-bottom: 8px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .price-history-text {
        font-size: 0.85em;
        padding: 6px 10px;
    }
    
    .price-history-badge {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .price-history-badge.badge-size-large {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .price-history-modal-backdrop {
        padding: 10px;
    }
    
    .price-history-modal-content {
        max-height: 95vh;
    }
    
    .price-history-modal-header {
        padding: 15px 20px;
    }
    
    .price-history-modal-header h3 {
        font-size: 16px;
    }
    
    .price-history-modal-body {
        padding: 20px;
        height: 300px;
    }
}

@media (max-width: 480px) {
    .price-history-modal-body {
        height: 250px;
        padding: 15px;
    }
    
    .price-history-badge {
        font-size: 10px;
        padding: 3px 6px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .price-history-text {
        background: #2a2a2a;
        color: #e0e0e0;
        border-left-color: #4a90e2;
    }
    
    .price-history-graph {
        background: #1e1e1e;
        border-color: #444;
    }
}

/* Print styles */
@media print {
    .price-history-graph {
        page-break-inside: avoid;
    }
}