/* Advanced Price History Pro - Frontend Styles */

/* داشبورد قیمت در صفحه محصول */
.aph-price-history-section {
    background: linear-gradient(135deg, rgba(26, 41, 128, 0.05) 0%, rgba(38, 208, 206, 0.05) 100%);
    border-radius: 15px;
    padding: 25px;
    margin-top: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.aph-price-history-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, #1a2980 0%, #26d0ce 100%);
}

.aph-price-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.aph-price-history-header h3 {
    margin: 0;
    font-size: 22px;
    color: #fff;
    background: linear-gradient(135deg, #1a2980 0%, #26d0ce 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

.aph-current-info {
    display: flex;
    gap: 25px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
}

.current-price,
.current-price-per-gram,
.last-update {
    text-align: center;
    min-width: 120px;
}

.current-price .label,
.current-price-per-gram .label,
.last-update .label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 600;
}

.current-price .value {
    font-size: 22px;
    font-weight: bold;
    color: #27ae60;
}

.current-price-per-gram .value {
    font-size: 18px;
    font-weight: bold;
    color: #3498db;
}

.last-update .value {
    font-size: 14px;
    color: #95a5a6;
}

.aph-history-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    font-size: 24px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a2980 0%, #26d0ce 100%);
    color: white;
    border-radius: 10px;
}

.stat-info {
    flex: 1;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 3px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
}

.aph-history-table-container {
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.aph-history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.aph-history-table th {
    background: linear-gradient(135deg, #1a2980 0%, #26d0ce 100%);
    color: white;
    padding: 15px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    position: sticky;
    top: 0;
}

.aph-history-table td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    text-align: center;
    vertical-align: middle;
    font-size: 13px;
}

.aph-history-table tbody tr {
    transition: all 0.3s ease;
}

.aph-history-table tbody tr:hover {
    background-color: rgba(26, 41, 128, 0.05);
    transform: scale(1.01);
}

.history-date {
    font-family: 'Courier New', monospace;
    color: #34495e;
    font-weight: 600;
}

.history-time {
    color: #7f8c8d;
    font-size: 12px;
}

.old-price {
    color: #95a5a6;
    text-decoration: line-through;
}

.new-price {
    font-weight: bold;
    color: #2c3e50;
    font-size: 14px;
}

.price-change.increase {
    color: #27ae60;
    font-weight: bold;
    background: rgba(39, 174, 96, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
    display: inline-block;
}

.price-change.decrease {
    color: #e74c3c;
    font-weight: bold;
    background: rgba(231, 76, 60, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
    display: inline-block;
}

.price-change.same {
    color: #95a5a6;
    padding: 5px 10px;
    border-radius: 20px;
    display: inline-block;
}

.change-icon {
    margin-left: 5px;
    font-size: 12px;
}

.price-percent.increase {
    color: #27ae60;
    font-weight: bold;
}

.price-percent.decrease {
    color: #e74c3c;
    font-weight: bold;
}

.price-per-gram {
    color: #3498db;
    font-weight: 600;
    background: rgba(52, 152, 219, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
    display: inline-block;
}

.type-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 25px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.type-badge.increase {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    box-shadow: 0 3px 10px rgba(39, 174, 96, 0.3);
}

.type-badge.decrease {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.3);
}

.type-badge.same {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
    box-shadow: 0 3px 10px rgba(149, 165, 166, 0.3);
}

.type-badge.initial {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 3px 10px rgba(52, 152, 219, 0.3);
}

.no-history {
    text-align: center;
    padding: 50px !important;
    color: #95a5a6;
}

.no-history-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* شورت کد داشبورد */
.aph-complete-dashboard {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.08);
    margin: 20px 0;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.dashboard-stats .stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.dashboard-stats .stat-icon {
    font-size: 32px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
}

.dashboard-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.dashboard-filters .filter-group {
    flex: 1;
    min-width: 200px;
}

.dashboard-search,
.dashboard-sort,
.dashboard-filter {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.dashboard-search:focus,
.dashboard-sort:focus,
.dashboard-filter:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.products-container.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.products-container.list-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.products-grid .product-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.products-grid .product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.products-grid .product-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.products-grid .product-card h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
    line-height: 1.4;
}

.products-grid .product-card .product-price {
    color: #27ae60;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.products-grid .product-card .product-weight {
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
}

.products-grid .product-card .product-price-gram {
    color: #3498db;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
}

.products-grid .product-card .view-product {
    display: block;
    text-align: center;
    background: #667eea;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.3s;
}

.products-grid .product-card .view-product:hover {
    background: #5a67d8;
}

.products-list {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.products-list th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    text-align: right;
    font-weight: 600;
}

.products-list td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.products-list tbody tr:hover {
    background: #f8f9fa;
}

.dashboard-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* داشبورد قیمت هر گرم */
.aph-gram-dashboard {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 20px 0;
}

.gram-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.gram-table th {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 12px;
    text-align: center;
    font-weight: 600;
}

.gram-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: center;
}

.gram-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.gram-table tbody tr:hover {
    background: #f0f8ff;
}

/* ریسپانسیو */
@media (max-width: 768px) {
    .aph-price-history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    
    .aph-current-info {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .current-price,
    .current-price-per-gram,
    .last-update {
        min-width: calc(33.333% - 10px);
        flex: 1;
    }
    
    .aph-history-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .aph-history-table th,
    .aph-history-table td {
        padding: 8px 5px;
        font-size: 12px;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-filters {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .products-container.grid-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .aph-current-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .current-price,
    .current-price-per-gram,
    .last-update {
        width: 100%;
        min-width: 100%;
    }
    
    .aph-history-stats {
        grid-template-columns: 1fr;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .products-grid .product-card {
        padding: 10px;
    }
    
    .gram-table {
        font-size: 12px;
    }
    
    .gram-table th,
    .gram-table td {
        padding: 6px 4px;
    }
}

/* انیمیشن‌ها */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aph-price-history-section {
    animation: fadeIn 0.5s ease-out;
}

.stat-item {
    animation: fadeIn 0.5s ease-out;
    animation-fill-mode: both;
}

.stat-item:nth-child(1) { animation-delay: 0.1s; }
.stat-item:nth-child(2) { animation-delay: 0.2s; }
.stat-item:nth-child(3) { animation-delay: 0.3s; }
.stat-item:nth-child(4) { animation-delay: 0.4s; }

/* Loader */
.aph-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px;
}

.aph-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .aph-price-history-section {
        background: rgba(30, 30, 40, 0.8);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .aph-current-info,
    .stat-item,
    .aph-history-table-container {
        background: rgba(40, 40, 50, 0.9);
        color: #f0f0f0;
    }
    
    .stat-value,
    .new-price {
        color: #f0f0f0;
    }
    
    .stat-label,
    .label {
        color: #b0b0b0;
    }
}

/* Print Styles */
@media print {
    .aph-price-history-section {
        box-shadow: none;
        border: 1px solid #ddd;
        background: white !important;
    }
    
    .aph-current-info,
    .stat-item,
    .aph-history-table-container {
        background: white !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
    
    .dashboard-filters,
    .view-product,
    .no-print {
        display: none !important;
    }
}