/**
 * Frontend Calculator Styles
 * @package HealthUpdateAI\Assets
 */

:root {
    /* Base Colors - Can be overridden by Admin Settings */
    --hu-ai-primary: #0073aa;
    --hu-ai-primary-hover: #005177;
    --hu-ai-secondary: #64748b;
    --hu-ai-success: #10b981;
    --hu-ai-danger: #ef4444;
    
    /* Layout Colors */
    --hu-ai-bg: #ffffff;
    --hu-ai-surface: #f8fafc;
    --hu-ai-border: #e2e8f0;
    --hu-ai-text-main: #1e293b;
    --hu-ai-text-muted: #64748b;
    
    /* Metrics Colors */
    --hu-ai-protein: #f43f5e;
    --hu-ai-fat: #eab308;
    --hu-ai-carbs: #3b82f6;

    /* Styling */
    --hu-ai-radius: 12px;
    --hu-ai-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --hu-ai-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --hu-ai-transition: all 0.3s ease;
}

/* Dark Mode Variables (Activated via class if enabled in settings) */
.hu-ai-dark-mode {
    --hu-ai-bg: #0f172a;
    --hu-ai-surface: #1e293b;
    --hu-ai-border: #334155;
    --hu-ai-text-main: #f8fafc;
    --hu-ai-text-muted: #94a3b8;
}

/* Wrapper & Cards */
.hu-ai-wrapper {
    max-width: 800px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--hu-ai-text-main);
    line-height: 1.6;
    box-sizing: border-box;
}

.hu-ai-wrapper * {
    box-sizing: inherit;
}

.hu-ai-card {
    background: var(--hu-ai-bg);
    border: 1px solid var(--hu-ai-border);
    border-radius: var(--hu-ai-radius);
    padding: 30px;
    box-shadow: var(--hu-ai-shadow);
    margin-bottom: 30px;
    animation: huAiFadeIn 0.5s ease-out;
}

.hu-ai-header {
    text-align: center;
    margin-bottom: 30px;
}

.hu-ai-header h2 {
    margin: 0 0 10px 0;
    color: var(--hu-ai-text-main);
    font-size: 1.75rem;
    font-weight: 700;
}

.hu-ai-header p {
    margin: 0;
    color: var(--hu-ai-text-muted);
}

/* Grid System */
.hu-ai-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Forms */
.hu-ai-form-group {
    margin-bottom: 20px;
}

.hu-ai-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--hu-ai-text-main);
}

.hu-required {
    color: var(--hu-ai-danger);
}

.hu-ai-input,
.hu-ai-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--hu-ai-border);
    border-radius: 8px;
    background-color: var(--hu-ai-surface);
    color: var(--hu-ai-text-main);
    font-size: 1rem;
    transition: var(--hu-ai-transition);
}

.hu-ai-input:focus,
.hu-ai-select:focus {
    outline: none;
    border-color: var(--hu-ai-primary);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15); /* Primary color with opacity */
}

/* Radio Group (Unit Toggle) */
.hu-ai-radio-group {
    display: flex;
    gap: 20px;
    background: var(--hu-ai-surface);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--hu-ai-border);
}

.hu-ai-radio-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
}

.hu-ai-radio-group input[type="radio"] {
    margin-right: 8px;
    accent-color: var(--hu-ai-primary);
}

/* Buttons */
.hu-ai-form-actions {
    margin-top: 30px;
    text-align: center;
}

.hu-ai-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: var(--hu-ai-transition);
    text-decoration: none;
}

.hu-ai-btn-primary {
    background-color: var(--hu-ai-primary);
    color: #ffffff;
    box-shadow: var(--hu-ai-shadow);
    width: 100%;
    max-width: 300px;
}

.hu-ai-btn-primary:hover:not(:disabled) {
    background-color: var(--hu-ai-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--hu-ai-shadow-hover);
}

.hu-ai-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.hu-ai-btn-secondary {
    background-color: var(--hu-ai-surface);
    color: var(--hu-ai-text-main);
    border: 1px solid var(--hu-ai-border);
}

.hu-ai-btn-secondary:hover {
    background-color: var(--hu-ai-border);
}

.hu-ai-btn-outline {
    background-color: transparent;
    color: var(--hu-ai-primary);
    border: 1px solid var(--hu-ai-primary);
}

/* Loader Animation */
.hu-ai-loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: huAiSpin 1s ease-in-out infinite;
    margin-left: 10px;
}

@keyframes huAiSpin {
    to { transform: rotate(360deg); }
}

@keyframes huAiFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Results Dashboard */
.hu-ai-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--hu-ai-border);
}

.hu-ai-results-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.hu-ai-actions {
    display: flex;
    gap: 10px;
}

/* KPI Grid */
.hu-ai-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.hu-ai-kpi-card {
    background: var(--hu-ai-surface);
    border: 1px solid var(--hu-ai-border);
    border-radius: 8px;
    padding: 20px 15px;
    text-align: center;
    transition: var(--hu-ai-transition);
}

.hu-ai-kpi-card:hover {
    box-shadow: var(--hu-ai-shadow);
    transform: translateY(-2px);
}

.hu-ai-kpi-card h4 {
    margin: 0 0 10px 0;
    color: var(--hu-ai-text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hu-ai-kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--hu-ai-primary);
    line-height: 1;
    margin-bottom: 5px;
}

.hu-ai-kpi-label {
    font-size: 0.85rem;
    color: var(--hu-ai-text-muted);
}

/* Detailed Metrics Grid */
.hu-ai-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.hu-ai-details-box {
    border: 1px solid var(--hu-ai-border);
    border-radius: 8px;
    padding: 20px;
}

.hu-ai-details-box h3 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--hu-ai-border);
    padding-bottom: 10px;
}

.hu-ai-details-box ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hu-ai-details-box li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed var(--hu-ai-border);
}

.hu-ai-details-box li:last-child {
    border-bottom: none;
}

/* Macros */
.hu-ai-macros-list li {
    justify-content: flex-start;
    gap: 10px;
}

.hu-ai-macros-list li span:last-child {
    margin-left: auto;
}

.hu-macro-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-top: 5px;
}
.hu-macro-protein { background-color: var(--hu-ai-protein); }
.hu-macro-fat { background-color: var(--hu-ai-fat); }
.hu-macro-carbs { background-color: var(--hu-ai-carbs); }

/* AI Summary Box */
.hu-ai-summary-box {
    background: linear-gradient(145deg, rgba(0,115,170,0.05) 0%, rgba(0,115,170,0.01) 100%);
    border: 1px solid var(--hu-ai-primary);
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
}

.hu-ai-summary-box h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--hu-ai-primary);
    margin: 0 0 20px 0;
    font-size: 1.3rem;
}

.hu-ai-summary-content p {
    margin-bottom: 15px;
}

.hu-ai-summary-content ul {
    margin-bottom: 15px;
    padding-left: 20px;
}

.hu-ai-summary-content li {
    margin-bottom: 8px;
}

/* Error/Message blocks */
#hu-ai-form-messages {
    margin-top: 15px;
}

.hu-ai-error {
    color: var(--hu-ai-danger);
    background: rgba(239, 68, 68, 0.1);
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid var(--hu-ai-danger);
    margin-top: 15px;
}

/* Section Titles */
.hu-ai-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 30px 0 15px 0;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--hu-ai-border);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .hu-ai-card {
        padding: 20px;
    }
    
    .hu-ai-results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .hu-ai-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .hu-ai-actions .hu-ai-btn {
        flex: 1;
        padding: 10px;
        font-size: 0.95rem;
    }
}

/* Print Styles */
@media print {
    .hu-ai-wrapper {
        max-width: 100%;
        margin: 0;
    }
    
    #hu-ai-form-container,
    .hu-ai-actions,
    .hu-ai-header p {
        display: none !important;
    }
    
    #hu-ai-results-container {
        display: block !important;
        box-shadow: none;
        border: none;
    }
    
    .hu-ai-card {
        border: none;
        padding: 0;
    }
}