/* =========================================
   DIETAS APP - CLEAN TECH THEME
   Palette: Emerald, Slate, White
   ========================================= */

:root {
    /* Colors */
    --bg-body: #F8FAFC;
    /* Slate 50 */
    --bg-card: #FFFFFF;
    --text-primary: #1E293B;
    /* Slate 800 */
    --text-secondary: #64748B;
    /* Slate 500 */

    --primary: #059669;
    /* Emerald 600 */
    --primary-hover: #047857;
    /* Emerald 700 */
    --primary-light: #D1FAE5;
    /* Emerald 100 */

    --accent: #0D9488;
    /* Teal 600 */
    --accent-light: #CCFBF1;
    /* Teal 100 */

    --danger: #EF4444;
    --warning: #F59E0B;
    --success: #10B981;

    --border-color: #E2E8F0;
    /* Slate 200 */

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Spacing */
    --radius-xl: 1rem;
    /* 16px */
    --radius-2xl: 1.5rem;
    /* 24px */
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 2rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

/* =========================================
   LAYOUT: SPLIT VIEW
   ========================================= */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.split-layout {
    display: grid;
    grid-template-columns: 1fr;
    /* Mobile first */
    gap: 2rem;
}

@media (min-width: 992px) {
    .split-layout {
        grid-template-columns: 1.2fr 0.8fr;
        /* Desktop: Inputs wider or Results sticky */
        align-items: start;
    }
}

/* =========================================
   COMPONENTS
   ========================================= */

/* Cards */
.card-tech {
    background: var(--bg-card);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-tech:hover {
    box-shadow: var(--shadow-lg);
}

.card-title-tech {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title-tech i {
    color: var(--primary);
}

/* Inputs */
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-control,
.form-select {
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    /* rounded-xl */
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s;
    background-color: #FDFDFD;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

/* Buttons */
.btn-primary-tech {
    background-color: var(--primary);
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    transition: all 0.2s;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary-tech:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline-tech {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    transition: all 0.2s;
}

.btn-outline-tech:hover {
    background-color: var(--bg-body);
    color: var(--primary);
    border-color: var(--primary);
}

/* Animal Selector Card */
.animal-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.config-item {
    background: var(--bg-body);
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid transparent;
}

.config-item.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.config-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.config-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* Ingredient List */
.ingredient-list {
    max-height: 500px;
    /* Scrollable inputs */
    overflow-y: auto;
    padding-right: 0.5rem;
}

.ingredient-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background-color 0.2s;
}

.ingredient-item.selected {
    border-color: var(--primary);
    background-color: #F0FDF4;
    /* Verify slightly green */
}

/* Sticky Results Panel */
.sticky-panel {
    position: sticky;
    top: 2rem;
}

.result-card-header {
    background: linear-gradient(135deg, var(--primary), #065F46);
    color: white;
    padding: 1.5rem;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

.result-card-body {
    padding: 1.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
    box-shadow: var(--shadow-lg);
}

.big-metric {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.metric-label {
    opacity: 0.9;
    font-size: 0.9rem;
}

.mini-stat {
    background: var(--bg-body);
    padding: 0.75rem;
    border-radius: 0.75rem;
    text-align: center;
}

.mini-stat-val {
    font-weight: 700;
    color: var(--text-primary);
}

.mini-stat-lbl {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Nutrient Tags */
.nutrient-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.4rem;
    margin-bottom: 0.4rem;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
}

.nutrient-tag.danger {
    background: #FEF2F2;
    color: var(--danger);
    border-color: #FECACA;
}

.nutrient-tag.warning {
    background: #FFFBEB;
    color: var(--warning);
    border-color: #FDE68A;
}

.nutrient-tag.ok {
    background: #ECFDF5;
    color: var(--success);
    border-color: #A7F3D0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .animal-config-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* =========================================
   UTILITY CLASSES
   ========================================= */

/* Text Colors */
.text-emerald-600 {
    color: #059669;
}

.text-emerald-700 {
    color: #047857;
}

.text-orange-600 {
    color: #EA580C;
}

.text-slate-600 {
    color: #475569;
}

/* Background Colors */
.bg-emerald-500 {
    background-color: #10B981;
}

.bg-slate-50 {
    background-color: #F8FAFC;
}

/* Text Sizes */
.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xl {
    font-size: 1.25rem;
}

.text-2xl {
    font-size: 1.5rem;
}

/* Font Weight */
.fw-500 {
    font-weight: 500;
}

/* Border Radius */
.rounded-lg {
    border-radius: 0.75rem;
}

.rounded-xl {
    border-radius: 1rem;
}

.rounded-2xl {
    border-radius: 1.5rem;
}

/* Progress Bar Override for Emerald */
.progress-bar.bg-emerald-500 {
    background-color: #10B981 !important;
}

/* Form Check for Radio Buttons */
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-label {
    user-select: none;
}

/* =========================================
   MATH DETAIL CONTENT
   ========================================= */

.math-detail-content {
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.8;
    background: white;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
}

.math-detail-content h1 {
    font-size: 1.75rem;
    color: #1E293B;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
    margin-top: 0;
}

.math-detail-content h2 {
    font-size: 1.35rem;
    color: var(--primary);
    margin-top: 2rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #E2E8F0;
}

.math-detail-content h3 {
    font-size: 1.1rem;
    color: #475569;
    margin-top: 1.5rem;
}

.math-detail-content h4 {
    font-size: 1rem;
    color: #64748B;
    margin-top: 1rem;
}

.math-detail-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.math-detail-content th,
.math-detail-content td {
    border: 1px solid #E2E8F0;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.math-detail-content th {
    background: #F8FAFC;
    font-weight: 600;
    color: #475569;
}

.math-detail-content blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: #64748B;
    font-style: italic;
    background: #F8FAFC;
    padding: 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
}

.math-detail-content hr {
    border: none;
    border-top: 2px dashed #E2E8F0;
    margin: 2rem 0;
}

.math-detail-content .katex-display {
    overflow-x: auto;
    padding: 1rem;
    background: #F8FAFC;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.math-detail-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.math-detail-content li {
    margin: 0.25rem 0;
}