/**
 * AI Price Estimator Styles
 * Admin-only interface styling with responsive design
 */

/* Main Container */
.ai-estimator-admin-only {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid #5a67d8;
    border-radius: 12px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    color: white;
    position: relative;
    overflow: hidden;
}

.ai-estimator-admin-only::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="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="%23ffffff" opacity="0.05"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.05"/><circle cx="50" cy="10" r="0.5" fill="%23ffffff" opacity="0.03"/><circle cx="10" cy="50" r="0.5" fill="%23ffffff" opacity="0.03"/><circle cx="90" cy="30" r="0.5" fill="%23ffffff" opacity="0.03"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>') repeat;
    pointer-events: none;
    z-index: 1;
}

.ai-estimator-admin-only > * {
    position: relative;
    z-index: 2;
}

/* Header */
.ai-estimator-header {
    margin-bottom: 20px;
}

.ai-estimator-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 600;
    color: white;
}

.admin-badge {
    background: #ff6b6b;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Controls */
.ai-estimator-controls {
    margin-bottom: 24px;
}

.ai-estimate-btn {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(72, 187, 120, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-estimate-btn:hover {
    background: linear-gradient(135deg, #38a169, #2f855a);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.4);
}

.ai-estimate-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

.ai-estimate-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ai-estimate-btn .dashicons {
    font-size: 18px;
}

/* Loading State */
.ai-estimator-loading {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.ai-estimator-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ai-estimator-loading p {
    margin: 0;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
}

/* Error State */
.ai-estimator-error {
    background: linear-gradient(135deg, #fc8181, #e53e3e);
    border: 1px solid #e53e3e;
    border-radius: 8px;
    padding: 20px;
    margin: 16px 0;
    box-shadow: 0 4px 16px rgba(229, 62, 62, 0.2);
}

.ai-estimator-error h4 {
    margin: 0 0 12px 0;
    color: white;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-estimator-error h4::before {
    content: '⚠️';
    font-size: 20px;
}

.ai-estimator-error p {
    margin: 8px 0;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.5;
}

.ai-estimator-error a {
    color: #fed7d7;
    text-decoration: underline;
    font-weight: 600;
}

.ai-estimator-error a:hover {
    color: white;
}

.error-suggestions {
    margin-top: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    border-left: 4px solid #fed7d7;
}

.error-suggestions h5 {
    margin: 0 0 8px 0;
    color: white;
    font-size: 14px;
    font-weight: 600;
}

.error-suggestions ul {
    margin: 0;
    padding-left: 16px;
    list-style-type: disc;
}

.error-suggestions li {
    margin: 4px 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    line-height: 1.4;
}

/* Results Display */
.ai-estimator-results {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 24px;
    margin: 20px 0;
    color: #2d3748;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.ai-estimate-summary {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(66, 153, 225, 0.3);
}

.ai-estimate-summary h4 {
    margin: 0 0 16px 0;
    font-size: 20px;
    text-align: center;
    font-weight: 700;
}

.estimate-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.estimate-row:last-of-type {
    border-bottom: none;
}

.estimate-row.most-likely {
    background: rgba(255, 255, 255, 0.1);
    margin: 8px -20px;
    padding: 12px 20px;
    border-radius: 6px;
    border-bottom: none;
}

.estimate-row span {
    font-weight: 500;
}

.estimate-row strong {
    font-size: 18px;
    font-weight: 700;
}

.confidence {
    text-align: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.confidence-high {
    color: #48bb78;
    font-weight: 700;
}

.confidence-medium {
    color: #ed8936;
    font-weight: 600;
}

.confidence-low {
    color: #f56565;
    font-weight: 600;
}

/* Sections */
.cost-adjustments-section,
.location-intelligence-section,
.market-factors-section,
.recommendations-section,
.risk-factors-section,
.missing-info-section {
    margin: 24px 0;
    padding: 20px;
    border-radius: 8px;
    background: rgba(247, 250, 252, 0.8);
    border: 1px solid #e2e8f0;
}

.cost-adjustments-section h4,
.location-intelligence-section h4,
.market-factors-section h4,
.recommendations-section h4,
.risk-factors-section h4,
.missing-info-section h4 {
    margin: 0 0 16px 0;
    color: #2d3748;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.datapoints-section h4::before {
    content: '📊';
    font-size: 20px;
}

.comparison-section h4::before {
    content: '⚖️';
    font-size: 20px;
}

.recommendations-section h4::before {
    content: '💡';
    font-size: 20px;
}

.risk-factors-section h4::before {
    content: '⚠️';
    font-size: 20px;
}

.missing-info-section h4::before {
    content: 'ℹ️';
    font-size: 20px;
}

.cost-adjustments-section h4::before {
    content: '💰';
    font-size: 20px;
}

.location-intelligence-section h4::before {
    content: '🗺️';
    font-size: 20px;
}

.market-factors-section h4::before {
    content: '📈';
    font-size: 20px;
}

/* Adjustments Grid */
.adjustments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.adjustment-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.adjustment-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.adjustment-card.important {
    border-left: 4px solid #f56565;
    background: linear-gradient(135deg, #fff5f5, #ffffff);
}

.adjustment-card.warning {
    border-left: 4px solid #ed8936;
    background: linear-gradient(135deg, #fffaf0, #ffffff);
}

.adjustment-card h5 {
    margin: 0 0 12px 0;
    color: #2d3748;
    font-size: 16px;
    font-weight: 600;
}

.adjustment-card .amount {
    font-size: 22px;
    font-weight: 700;
    color: #2b6cb0;
    margin-bottom: 8px;
}

.adjustment-card .multiplier {
    font-size: 18px;
    font-weight: 700;
    color: #9f7aea;
    margin-bottom: 8px;
}

.adjustment-card .explanation,
.adjustment-card .breakdown,
.adjustment-card .details {
    font-size: 14px;
    color: #4a5568;
    margin-bottom: 8px;
    line-height: 1.4;
}

.cost-breakdown {
    background: #f7fafc;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.cost-breakdown div {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 13px;
    color: #4a5568;
}

.why-higher {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 6px;
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.customer-est {
    opacity: 0.8;
    font-style: italic;
}

/* Location Intelligence */
.location-details,
.market-details {
    background: #f8fafc;
    padding: 16px;
    border-radius: 6px;
    border-left: 3px solid #4299e1;
}

.detail-item,
.market-item {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.4;
}

.detail-item:last-child,
.market-item:last-child {
    margin-bottom: 0;
}

/* Comparison Section */
.variance-display {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.variance-display.higher {
    background: #fed7d7;
    color: #c53030;
}

.variance-display.lower {
    background: #c6f6d5;
    color: #22543d;
}

.variance-display.same {
    background: #bee3f8;
    color: #2c5282;
}

.comparison-notes {
    font-size: 15px;
    line-height: 1.6;
    color: #4a5568;
}

/* Lists */
.recommendations-list,
.risk-factors-list,
.missing-info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recommendations-list li,
.risk-factors-list li,
.missing-info-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
    line-height: 1.5;
}

.recommendations-list li:last-child,
.risk-factors-list li:last-child,
.missing-info-list li:last-child {
    border-bottom: none;
}

.recommendations-list .dashicons-yes {
    color: #48bb78;
    margin-top: 2px;
    flex-shrink: 0;
}

.risk-factors-list .dashicons-warning {
    color: #ed8936;
    margin-top: 2px;
    flex-shrink: 0;
}

.missing-info-list .dashicons-info {
    color: #4299e1;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Debug Section */
.ai-estimator-debug {
    margin-top: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.ai-estimator-debug details {
    padding: 16px;
}

.ai-estimator-debug summary {
    cursor: pointer;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 12px;
    user-select: none;
}

.ai-estimator-debug summary:hover {
    color: white;
}

.debug-section h4 {
    margin: 0 0 12px 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
}

.ai-estimator-debug pre {
    background: rgba(0, 0, 0, 0.3);
    color: #f7fafc;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    line-height: 1.4;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ai-estimator-admin-only {
        padding: 16px;
        margin: 16px 0;
    }
    
    .ai-estimator-header h3 {
        font-size: 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .ai-estimate-btn {
        width: 100%;
        justify-content: center;
        padding: 16px;
    }
    
    .datapoints-grid {
        grid-template-columns: 1fr;
    }
    
    .estimate-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .estimate-row strong {
        font-size: 20px;
    }
    
    .variance-display {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .ai-estimator-admin-only {
        padding: 12px;
    }
    
    .ai-estimator-results {
        padding: 16px;
    }
    
    .ai-estimate-summary,
    .datapoints-section,
    .comparison-section,
    .recommendations-section,
    .risk-factors-section,
    .missing-info-section {
        padding: 16px;
    }
    
    .datapoint-card {
        padding: 12px;
    }
}

/* Print Styles */
@media print {
    .ai-estimator-admin-only {
        background: white !important;
        color: black !important;
        border: 2px solid #666 !important;
        box-shadow: none !important;
    }
    
    .ai-estimator-admin-only::before {
        display: none !important;
    }
    
    .ai-estimator-controls,
    .ai-estimator-debug {
        display: none !important;
    }
    
    .ai-estimate-summary {
        background: #f7fafc !important;
        color: black !important;
        border: 1px solid #666 !important;
    }
    
    .datapoints-section,
    .comparison-section,
    .recommendations-section,
    .risk-factors-section,
    .missing-info-section {
        background: white !important;
        border: 1px solid #ccc !important;
    }
    
    .datapoint-card {
        border: 1px solid #999 !important;
        box-shadow: none !important;
    }
}