/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header-content h1 {
    font-size: 2.5em;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.header-content h1 i {
    color: #3498db;
    margin-right: 10px;
}

.subtitle {
    font-size: 1.2em;
    color: #7f8c8d;
    font-weight: 300;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Buttons and Form Elements */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #1f618d);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.form-select {
    padding: 12px 16px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    min-width: 200px;
}

.form-select:focus {
    outline: none;
    border-color: #3498db;
}

/* Loading and Error States */
.loading-state, .error-state {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.error-state i {
    font-size: 3em;
    color: #e74c3c;
    margin-bottom: 20px;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    color: white;
    padding: 20px 30px;
}

.card-header h3 {
    font-size: 1.3em;
    font-weight: 600;
}

.card-header h3 i {
    margin-right: 10px;
    color: #3498db;
}

.card-body {
    padding: 30px;
}

/* Overview Cards */
.overview-section h2 {
    color: white;
    font-size: 1.8em;
    margin-bottom: 25px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.overview-section h2 i {
    margin-right: 10px;
    color: #f1c40f;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.overview-card {
    display: flex;
    align-items: center;
    padding: 25px;
}

.card-icon {
    width: 70px;
    height: 70px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    font-size: 1.8em;
    color: white;
}

.price-icon {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.quality-icon {
    background: linear-gradient(135deg, #f39c12, #d68910);
}

.popularity-icon {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.overall-icon {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

.metric-value {
    font-size: 2.2em;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.metric-label {
    font-size: 0.9em;
    color: #7f8c8d;
    text-transform: uppercase;
    font-weight: 600;
}

/* Section Headers */
.analysis-section h2,
.advanced-section h2,
.report-section h2 {
    color: white;
    font-size: 1.8em;
    margin-bottom: 25px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.analysis-section h2 i,
.advanced-section h2 i,
.report-section h2 i {
    margin-right: 10px;
    color: #f1c40f;
}

/* Price Comparison */
.price-comparison {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.main-product-price {
    flex: 1;
    min-width: 250px;
}

.competitors-prices {
    flex: 2;
    min-width: 300px;
}

.product-info h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.price-badge {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1.3em;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.main-price {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.competitor-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
}

.competitor-price {
    background: linear-gradient(135deg, #3498db, #2980b9);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    color: white;
}

/* Rating Stats */
.rating-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.rating-stat {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.rating-stat h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.rating-value {
    font-size: 1.5em;
    font-weight: 700;
    color: #f39c12;
}

/* Advanced Analysis */
.indices-grid {
    display: grid;
    gap: 25px;
}

.index-item {
    display: flex;
    align-items: center;
    gap: 20px;
}

.index-label {
    min-width: 120px;
    font-weight: 600;
    color: #2c3e50;
}

.index-bar {
    flex: 1;
    height: 20px;
    background: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.index-fill {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c, #f39c12, #2ecc71);
    border-radius: 10px;
    transition: width 0.8s ease;
    position: relative;
}

.index-value {
    min-width: 60px;
    font-weight: 700;
    color: #2c3e50;
    text-align: right;
}

/* BSR Analysis */
.bsr-category {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.bsr-category h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.bsr-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.bsr-metric {
    text-align: center;
}

.bsr-metric .label {
    font-size: 0.9em;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.bsr-metric .value {
    font-size: 1.2em;
    font-weight: 700;
    color: #2c3e50;
}

.position-best {
    color: #2ecc71 !important;
}

.position-middle {
    color: #f39c12 !important;
}

.position-worst {
    color: #e74c3c !important;
}

/* LLM Report */
.executive-summary {
    font-size: 1.1em;
    line-height: 1.8;
    color: #2c3e50;
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    border-left: 5px solid #3498db;
}

/* SWOT Analysis */
.swot-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.swot-item {
    padding: 25px;
    border-radius: 10px;
    border-left: 5px solid;
}

.swot-item h4 {
    margin-bottom: 15px;
    font-size: 1.1em;
}

.strengths {
    background: rgba(46, 204, 113, 0.1);
    border-left-color: #2ecc71;
}

.strengths h4 {
    color: #27ae60;
}

.weaknesses {
    background: rgba(231, 76, 60, 0.1);
    border-left-color: #e74c3c;
}

.weaknesses h4 {
    color: #c0392b;
}

.opportunities {
    background: rgba(241, 196, 15, 0.1);
    border-left-color: #f1c40f;
}

.opportunities h4 {
    color: #f39c12;
}

.threats {
    background: rgba(155, 89, 182, 0.1);
    border-left-color: #9b59b6;
}

.threats h4 {
    color: #8e44ad;
}

.swot-item ul {
    list-style: none;
    padding: 0;
}

.swot-item li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
    padding-left: 25px;
}

.swot-item li:before {
    content: '▪';
    position: absolute;
    left: 0;
    color: #3498db;
    font-weight: bold;
}

.swot-item li:last-child {
    border-bottom: none;
}

/* Strategic Actions */
.action-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
    border-left: 5px solid;
    transition: all 0.3s ease;
}

.action-item:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transform: translateX(5px);
}

.action-high {
    border-left-color: #e74c3c;
}

.action-medium {
    border-left-color: #f39c12;
}

.action-low {
    border-left-color: #2ecc71;
}

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

.action-title {
    font-weight: 700;
    color: #2c3e50;
    flex: 1;
}

.action-priority {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-high {
    background: #e74c3c;
    color: white;
}

.priority-medium {
    background: #f39c12;
    color: white;
}

.priority-low {
    background: #2ecc71;
    color: white;
}

.action-description {
    color: #5d6d7e;
    line-height: 1.6;
    margin-bottom: 10px;
}

.action-impact {
    font-size: 0.9em;
    color: #7f8c8d;
    font-style: italic;
}

/* Market Insights */
.insight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.insight-item {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    border-top: 4px solid #3498db;
}

.insight-item h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.insight-content {
    color: #5d6d7e;
    line-height: 1.6;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 20px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 40px;
}

.footer i {
    color: #f1c40f;
    margin-right: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .swot-grid {
        grid-template-columns: 1fr;
    }
    
    .price-comparison {
        flex-direction: column;
    }
    
    .index-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .index-bar {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 20px;
    }
    
    .header-content h1 {
        font-size: 2em;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .overview-card {
        flex-direction: column;
        text-align: center;
    }
    
    .card-icon {
        margin-right: 0;
        margin-bottom: 15px;
    }
}

/* Chart Container */
canvas {
    max-height: 400px !important;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-in {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}