/**
 * Price History and Alert System - Styles
 */

/* Watch Button */
.aipcb-watch-build {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.aipcb-watch-build:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.aipcb-watch-build.watching {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.aipcb-watch-build.watching:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653b8e 100%);
}

.aipcb-watch-build.loading {
    opacity: 0.6;
    cursor: wait;
}

.aipcb-watch-build .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* View Price History Button */
.aipcb-view-price-history {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.aipcb-view-price-history:hover {
    background: #667eea;
    color: white;
}

/* Price Trend Badge */
.aipcb-price-trend {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.aipcb-price-trend.down {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.aipcb-price-trend.up {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.aipcb-price-trend.same {
    background: #e2e3e5;
    color: #383d41;
    border: 1px solid #d6d8db;
}

/* Price History Modal */
.aipcb-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 20px;
}

.aipcb-price-modal {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.aipcb-price-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 30px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 5px 10px;
    transition: color 0.2s;
}

.aipcb-price-modal-close:hover {
    color: #333;
}

.aipcb-price-modal h2 {
    margin: 0 0 20px 0;
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.aipcb-price-modal h2 .dashicons {
    color: #667eea;
}

/* Modal Tabs */
.aipcb-modal-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e0e0e0;
}

.aipcb-tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
    margin-bottom: -2px;
}

.aipcb-tab-btn:hover {
    color: #667eea;
}

.aipcb-tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* History Controls */
.aipcb-history-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.aipcb-history-controls label {
    font-weight: 600;
}

.aipcb-history-controls select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

/* Price Stats */
.aipcb-price-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.price-stat-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #333;
}

.stat-change {
    font-size: 13px;
    margin-top: 5px;
}

.price-down {
    color: #28a745;
}

.price-up {
    color: #dc3545;
}

.price-same {
    color: #6c757d;
}

/* Chart Container */
.aipcb-chart-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

#aipcb-price-chart {
    max-height: 350px;
}

/* Component Changes */
.aipcb-component-changes {
    max-height: 500px;
    overflow-y: auto;
}

.component-total-change {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

.component-total-change h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
}

.total-change {
    font-size: 32px;
    font-weight: 700;
    margin: 10px 0;
}

.price-breakdown {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 14px;
    opacity: 0.9;
}

.component-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.component-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.component-info {
    flex: 1;
}

.component-name {
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}

.component-type {
    font-size: 13px;
    color: #666;
}

.component-price {
    text-align: right;
}

.current-price {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.price-change {
    font-size: 13px;
    font-weight: 600;
}

.no-history-label {
    font-size: 12px;
    color: #999;
    font-style: italic;
}

/* Loading States */
.stat-loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 15px;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.error-message {
    text-align: center;
    padding: 20px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

/* Notifications */
.aipcb-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 350px;
}

.aipcb-notification.show {
    transform: translateX(0);
}

.aipcb-notification.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.aipcb-notification.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Build Card Integration */
.build-card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* Price Alert Dashboard */
.aipcb-alerts-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.alerts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.alert-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
}

.alert-card.inactive {
    opacity: 0.6;
    border-left-color: #ccc;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.alert-build-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.alert-details {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #666;
}

.alert-actions {
    display: flex;
    gap: 10px;
}

.alert-btn {
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.alert-btn:hover {
    background: #f0f0f0;
}

.alert-btn.delete {
    color: #dc3545;
    border-color: #dc3545;
}

.alert-btn.delete:hover {
    background: #dc3545;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .aipcb-price-modal {
        padding: 20px;
        max-height: 95vh;
    }
    
    .aipcb-price-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .component-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .component-price {
        text-align: left;
        margin-top: 10px;
    }
    
    .aipcb-notification {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}
