/* Profit Analysis Tool Styles */

/* Hero Section */
.profit-analysis-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 80%, #f5576c 100%);
    color: white;
    padding: 120px 0 80px;
    position: relative;
    overflow: hidden;
}

.profit-analysis-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="profit-pattern" width="25" height="25" patternUnits="userSpaceOnUse"><circle cx="12.5" cy="12.5" r="2" fill="rgba(255,255,255,0.1)"/><path d="M 25 0 L 0 0 0 25" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/><path d="M 12.5 0 L 12.5 25 M 0 12.5 L 25 12.5" stroke="rgba(255,255,255,0.03)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23profit-pattern)"/></svg>');
    opacity: 0.7;
}

.profit-analysis-hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

.breadcrumb {
    margin-bottom: 20px;
    font-size: 14px;
    opacity: 0.9;
}

.breadcrumb a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.breadcrumb a:hover {
    opacity: 0.7;
}

.breadcrumb i {
    margin: 0 10px;
    font-size: 12px;
}

.profit-analysis-hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
}

.profit-analysis-highlight {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.profit-analysis-hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 40px;
    opacity: 0.9;
    max-width: 800px;
    line-height: 1.6;
}

.profit-analysis-hero-stats {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.profit-analysis-stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.profit-analysis-stat-item i {
    font-size: 1.2rem;
    color: #ffd700;
}

/* Profit Analysis Tool Section */
.profit-analysis-tool {
    padding: 80px 0;
    background: #f8fafc;
}

/* Analysis Selector */
.analysis-selector {
    margin-bottom: 60px;
}

.selector-header {
    text-align: center;
    margin-bottom: 40px;
}

.selector-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 10px;
}

.selector-header p {
    font-size: 1.1rem;
    color: #718096;
    max-width: 600px;
    margin: 0 auto;
}

.analysis-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tab-btn {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 130px;
    justify-content: center;
    text-align: center;
}

.tab-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.15);
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.tab-btn i {
    font-size: 1rem;
}

/* Analysis Content */
.analysis-content {
    display: none;
}

.analysis-content.active {
    display: block;
}

.analysis-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.card-header {
    text-align: center;
    margin-bottom: 40px;
}

.card-header h3 {
    font-size: 2rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.card-header h3 i {
    color: #667eea;
}

.card-header p {
    font-size: 1.1rem;
    color: #718096;
    max-width: 500px;
    margin: 0 auto;
}

/* Input Grid */
.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.input-section {
    background: #f7fafc;
    padding: 25px;
    border-radius: 15px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.input-section:hover {
    border-color: #cbd5e0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.input-section h4 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group input::placeholder {
    color: #a0aec0;
}

.input-group input[readonly] {
    background: #edf2f7;
    cursor: not-allowed;
}

/* Scenario Grid */
.scenario-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.scenario-section {
    background: #f7fafc;
    padding: 25px;
    border-radius: 15px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.scenario-section.full-width {
    grid-column: 1 / -1;
}

.scenario-section:hover {
    border-color: #cbd5e0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.scenario-section h4 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.probability-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Product Mix Grid */
.product-mix-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.product-section {
    background: #f7fafc;
    padding: 25px;
    border-radius: 15px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.product-section.full-width {
    grid-column: 1 / -1;
}

.product-section:hover {
    border-color: #cbd5e0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.product-section h4 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.constraint-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Button Groups */
.button-group {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.calculate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    min-width: 200px;
    justify-content: center;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.clear-btn {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    min-width: 120px;
    justify-content: center;
}

.clear-btn:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

/* Results Section */
.results-section {
    display: none;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 15px;
    padding: 30px;
    border: 1px solid #e2e8f0;
}

.results-section.show {
    display: block;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-header {
    text-align: center;
    margin-bottom: 30px;
}

.results-header h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.profit-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.profit-metric-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.profit-metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.profit-metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.profit-metric-card:hover::before {
    transform: scaleX(1);
}

.metric-label {
    font-size: 0.9rem;
    color: #718096;
    margin-bottom: 8px;
    font-weight: 500;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 5px;
}

.metric-value.positive {
    color: #38a169;
}

.metric-value.negative {
    color: #e53e3e;
}

.metric-value.neutral {
    color: #667eea;
}

.metric-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 20px;
    display: inline-block;
}

.metric-status.excellent {
    background: #c6f6d5;
    color: #38a169;
}

.metric-status.good {
    background: #bee3f8;
    color: #3182ce;
}

.metric-status.warning {
    background: #fbd38d;
    color: #ed8936;
}

.metric-status.critical {
    background: #feb2b2;
    color: #e53e3e;
}

.profit-summary {
    background: white;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-top: 20px;
}

.profit-summary h5 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.profit-summary p {
    line-height: 1.6;
    color: #4a5568;
    margin-bottom: 15px;
}

.profit-summary ul {
    margin: 15px 0;
    padding-left: 20px;
}

.profit-summary li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Scenario Comparison Table */
.scenario-comparison {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    margin-top: 20px;
}

.scenario-comparison table {
    width: 100%;
    border-collapse: collapse;
}

.scenario-comparison th {
    background: #f7fafc;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #2d3748;
    border-bottom: 1px solid #e2e8f0;
}

.scenario-comparison td {
    padding: 15px;
    border-bottom: 1px solid #f7fafc;
    color: #4a5568;
}

.scenario-comparison tr:hover {
    background: #f7fafc;
}

/* Product Mix Results */
.product-mix-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.product-result-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.product-result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.product-result-card h6 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f7fafc;
}

.product-metric:last-child {
    border-bottom: none;
}

.product-metric-name {
    font-weight: 500;
    color: #4a5568;
}

.product-metric-value {
    font-weight: 600;
    color: #2d3748;
}

/* Optimization Recommendations */
.optimization-recommendations {
    background: linear-gradient(135deg, #ebf8ff 0%, #e6fffa 100%);
    border: 1px solid #90cdf4;
    border-radius: 12px;
    padding: 25px;
    margin-top: 20px;
}

.optimization-recommendations h5 {
    color: #3182ce;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.optimization-recommendations ul {
    list-style: none;
    padding: 0;
}

.optimization-recommendations li {
    padding: 10px 0;
    padding-left: 30px;
    position: relative;
    border-bottom: 1px solid rgba(49, 130, 206, 0.1);
}

.optimization-recommendations li:last-child {
    border-bottom: none;
}

.optimization-recommendations li::before {
    content: '💡';
    position: absolute;
    left: 0;
    top: 10px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 60px;
    flex-wrap: wrap;
}

.action-btn {
    background: white;
    color: #4a5568;
    border: 2px solid #e2e8f0;
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    min-width: 160px;
    justify-content: center;
}

.action-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.15);
}

/* Related Tools */
.related-tools {
    padding: 80px 0;
    background: white;
}

.related-tools .section-header {
    text-align: center;
    margin-bottom: 60px;
}

.related-tools .section-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 15px;
}

.related-tools .section-header p {
    font-size: 1.1rem;
    color: #718096;
    max-width: 600px;
    margin: 0 auto;
}

.related-tools .tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.related-tools .tool-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.related-tools .tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.related-tools .tool-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: white;
}

.related-tools .tool-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 10px;
}

.related-tools .tool-card p {
    color: #718096;
    margin-bottom: 20px;
    line-height: 1.6;
}

.related-tools .tool-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.related-tools .tool-link:hover {
    gap: 12px;
}

/* Charts and Visualizations */
.profit-chart {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    margin: 20px 0;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #718096;
    font-style: italic;
}

.break-even-chart {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    margin: 20px 0;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #718096;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .profit-analysis-hero {
        padding: 100px 0 60px;
    }
    
    .profit-analysis-hero-title {
        font-size: 2.5rem;
    }
    
    .profit-analysis-hero-stats {
        justify-content: center;
        gap: 20px;
    }
    
    .analysis-tabs {
        flex-direction: column;
        align-items: center;
    }
    
    .tab-btn {
        min-width: 200px;
    }
    
    .input-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .scenario-grid {
        grid-template-columns: 1fr;
    }
    
    .product-mix-grid {
        grid-template-columns: 1fr;
    }
    
    .analysis-card {
        padding: 30px 20px;
    }
    
    .button-group {
        flex-direction: column;
        align-items: center;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .profit-metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .product-mix-results {
        grid-template-columns: 1fr;
    }
    
    .probability-inputs {
        grid-template-columns: 1fr;
    }
    
    .constraint-inputs {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .profit-analysis-hero-title {
        font-size: 2rem;
    }
    
    .profit-analysis-hero-stats {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .tab-btn {
        min-width: 100%;
        font-size: 0.85rem;
        padding: 14px 18px;
    }
    
    .calculate-btn,
    .clear-btn,
    .action-btn {
        min-width: 100%;
    }
    
    .input-section {
        padding: 20px 15px;
    }
    
    .scenario-section {
        padding: 20px 15px;
    }
    
    .product-section {
        padding: 20px 15px;
    }
    
    .profit-metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
    
    .scenario-comparison {
        overflow-x: auto;
    }
    
    .scenario-comparison table {
        min-width: 600px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error Messages */
.message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.message.success {
    background: #f0fff4;
    color: #38a169;
    border: 1px solid #9ae6b4;
}

.message.error {
    background: #fed7d7;
    color: #e53e3e;
    border: 1px solid #feb2b2;
}

/* Profit Trend Indicators */
.profit-trend {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 10px;
}

.profit-trend.up {
    color: #38a169;
}

.profit-trend.down {
    color: #e53e3e;
}

.profit-trend.stable {
    color: #718096;
}

/* Progress Bars for Margins */
.margin-progress {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.margin-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 1s ease;
    position: relative;
}

.margin-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #2d3748;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}
