/* Estilo principal do Classificador de Cuidados com a Pele */
:root {
    --primary-color: #3498db; /* Azul Principal */
    --secondary-color: #2ecc71; /* Verde Secundário (Bom) */
    --accent-color: #1abc9c; /* Verde-água (Accent) */
    --warning-color: #f39c12; /* Amarelo (OK) */
    --danger-color: #e74c3c; /* Vermelho (Ruim) */
    --light-bg: #f9f9f9;
    --white-bg: #ffffff;
    --dark-text: #2c3e50;
    --medium-text: #555;
    --light-text: #7f8c8d;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --border-radius: 12px;
    --bottom-nav-height: 60px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--medium-text);
    background-color: var(--light-bg);
    padding-bottom: var(--bottom-nav-height); /* Space for bottom navbar */
}

/* Header Styling */
header {
    text-align: center;
    padding: 30px 20px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: var(--white-bg);
}

header h1 {
    color: var(--white-bg);
    font-size: 1.8rem; /* Adjusted for mobile */
    margin-bottom: 5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.header-icon {
    font-size: 1.6rem;
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    margin-bottom: 0;
}

/* Main Content Area */
main {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.container {
    background-color: var(--white-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 6px 18px var(--shadow-color);
    padding: 25px;
    margin-bottom: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.container:hover {
    /* Subtle hover effect */
    /* transform: translateY(-3px); */
    /* box-shadow: 0 8px 22px rgba(0, 0, 0, 0.1); */
}

/* Tabs Styling */
.tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    gap: 10px; /* Spacing between tabs */
}

.tab {
    padding: 12px 15px;
    cursor: pointer;
    color: var(--light-text);
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.tab:hover {
    color: var(--primary-color);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Input Elements Styling */
.input-section {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-text);
    font-size: 0.95rem;
}

textarea {
    width: 100%;
    min-height: 120px; /* Adjusted for mobile */
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* Options (Radio Buttons) */
.options {
    display: grid;
    grid-template-columns: 1fr; /* Stack on mobile */
    gap: 20px;
    margin-bottom: 25px;
}

.option-group label {
    margin-bottom: 10px;
}

.radio-group {
    display: flex;
    gap: 15px;
    align-items: center;
}

.radio-group input[type="radio"] {
    display: none; /* Hide default radio */
}

.radio-label {
    display: inline-block;
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px; /* Pill shape */
    cursor: pointer;
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--medium-text);
    transition: all 0.3s ease;
}

.radio-group input[type="radio"]:checked + .radio-label {
    background-color: var(--primary-color);
    color: var(--white-bg);
    border-color: var(--primary-color);
    font-weight: 500;
}

/* Photo Upload Styling */
.photo-upload {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.photo-upload label {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--dark-text);
}

.upload-btn {
    margin: 10px 0;
    padding: 10px 20px;
    background-color: #f1f1f1;
    color: var(--dark-text);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: background-color 0.2s, color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.upload-btn:hover {
    background-color: #e0e0e0;
}

.file-name-display {
    font-size: 0.85rem;
    color: var(--light-text);
    margin-top: 5px;
    font-style: italic;
}

/* Buttons */
button {
    cursor: pointer;
    transition: all 0.3s ease;
}

.analyze-button {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%; /* Full width on mobile */
    margin-top: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.analyze-button:hover {
    opacity: 0.9;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

button:disabled,
.analyze-button:disabled {
    background: #bdc3c7; /* Muted color */
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    opacity: 0.7;
}

/* Loading Indicator */
#loading {
    display: none;
    text-align: center;
    margin: 25px 0 10px;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border-left-color: var(--primary-color);
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

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

.loading-text {
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.95rem;
}

.progress-container {
    width: 80%;
    max-width: 300px;
    height: 8px;
    background-color: #f0f0f0;
    border-radius: 4px;
    margin: 15px auto 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 4px;
    transition: width 0.4s ease-out;
}

/* Results Section */
#results {
    display: none; /* Hidden initially */
    margin-top: 30px;
}

.results-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.results-header h2 {
    color: var(--dark-text);
    font-size: 1.5rem;
    margin-bottom: 5px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.results-header p {
    font-size: 1rem;
    color: var(--medium-text);
}

/* Score and Charts Area */
.score-and-charts {
    display: grid;
    grid-template-columns: 1fr; /* Stack on mobile */
    gap: 30px;
    margin-bottom: 30px;
    align-items: center;
}

.overall-score-container {
    text-align: center;
}

.score-label {
    font-size: 0.9rem;
    color: var(--light-text);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score {
    font-size: 3.5rem; /* Larger score */
    font-weight: 700;
    line-height: 1;
    /* Color set dynamically by JS */
}

.charts-container {
    display: grid;
    grid-template-columns: 1fr; /* Stack charts on smallest screens */
    gap: 25px;
}

.chart-wrapper {
    background-color: var(--light-bg);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 5px rgba(0,0,0, 0.05);
    min-height: 250px; /* Ensure space for chart */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 15px;
    text-align: center;
}

#qualityChart, #benefitsChart {
    max-width: 100%;
    max-height: 250px; /* Control chart height */
}

/* Summary Stats */
.summary-stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
    margin: 25px 0;
    padding: 15px 0;
    background-color: var(--light-bg);
    border-radius: var(--border-radius);
}

.summary-stat .stat-value {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--primary-color);
    line-height: 1.2;
}

.summary-stat .stat-label {
    font-size: 0.8rem;
    color: var(--light-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Top Ingredients */
.top-ingredients-section {
    margin: 25px 0;
    padding: 15px;
    background-color: #eaf5fd; /* Light blue background */
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.top-ingredients-section h3 {
    font-size: 1.1rem;
    color: var(--dark-text);
    margin-bottom: 15px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.top-ingredients-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.top-ingredient {
    background-color: var(--white-bg);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    color: var(--medium-text);
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

.top-ingredient.placeholder {
    color: var(--light-text);
    font-style: italic;
}

/* Result Details (Pros/Cons) */
.result-details {
    display: grid;
    grid-template-columns: 1fr; /* Stack on mobile */
    gap: 25px;
    margin: 30px 0;
}

.result-container {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: var(--white-bg);
}

.result-header {
    background-color: #f8f9fa;
    padding: 12px 15px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    color: var(--dark-text);
    font-size: 1rem;
}

.result-header i {
    margin-right: 8px;
}
.pros-container .result-header i { color: var(--secondary-color); }
.cons-container .result-header i { color: var(--danger-color); }

.count-badge {
    font-size: 0.8rem;
    background-color: #e9ecef;
    color: var(--medium-text);
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.result-body {
    padding: 0; /* Remove padding, add to list items */
}

.ingredient-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.ingredient-item {
    padding: 15px;
    border-bottom: 1px solid #f1f1f1;
    transition: background-color 0.2s ease;
}
.ingredient-item:last-child {
    border-bottom: none;
}
.ingredient-item:hover {
    background-color: #fcfcfc;
}

.ingredient-item.placeholder {
    color: var(--light-text);
    font-style: italic;
    text-align: center;
    padding: 20px;
}


.ingredient-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ingredient-name {
    font-weight: 600;
    color: var(--dark-text);
    font-size: 1rem;
}

.cosing-link {
    font-size: 0.75rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}

.cosing-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.ingredient-rating {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.rating-badge {
    padding: 4px 10px;
    border-radius: 12px; /* More rounded */
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--white-bg); /* Default color */
}

.rating-badge.excellent { background-color: var(--secondary-color); }
.rating-badge.good { background-color: var(--accent-color); }
.rating-badge.ok { background-color: var(--warning-color); }
.rating-badge.poor { background-color: var(--danger-color); }
.rating-badge.neutral { background-color: #adb5bd; }

.ingredient-rating span:not(.rating-badge) {
    font-size: 0.9rem;
    color: var(--medium-text);
}

.description {
    font-size: 0.85rem;
    color: var(--medium-text);
    margin-bottom: 5px;
    line-height: 1.5;
}
.description strong {
    font-weight: 600;
    color: var(--dark-text);
}

/* Info Box */
.info-box {
    background-color: #eaf5fd; /* Light blue */
    border-left: 4px solid var(--primary-color);
    padding: 12px 15px;
    margin: 20px 0;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--medium-text);
}
.info-box-alt {
    background-color: #fef9e7; /* Light yellow */
    border-left-color: var(--warning-color);
}
.info-box p { margin: 0; }
.info-box i { margin-right: 8px; color: var(--primary-color); }
.info-box-alt i { color: var(--warning-color); }
.info-box strong { color: var(--dark-text); }


/* Usage Tips */
.usage-tips {
    margin-top: 30px;
    padding: 20px;
    background-color: #f1f8f5; /* Light green-ish background */
    border-radius: var(--border-radius);
    border-left: 4px solid var(--accent-color);
}

.usage-tips h3 {
    margin: 0 0 15px 0;
    color: var(--dark-text);
    font-weight: 600;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.usage-tips h3 i { color: var(--accent-color); }

.usage-tips ul {
    margin-bottom: 0;
    padding-left: 20px;
    list-style: disc;
    color: var(--medium-text);
}
.usage-tips li {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: var(--light-text);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
}

/* Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--bottom-nav-height);
    background-color: var(--white-bg);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    border-top: 1px solid var(--border-color);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--light-text);
    font-size: 0.7rem;
    padding: 5px 10px;
    flex-grow: 1;
    text-align: center;
    height: 100%;
    transition: color 0.3s ease;
}

.nav-item i {
    font-size: 1.4rem; /* Icon size */
    margin-bottom: 4px;
}

.nav-item span {
    line-height: 1.2;
}

.nav-item.active,
.nav-item:active {
    color: var(--primary-color);
    font-weight: 500;
}

/* Responsive Adjustments */

/* Medium screens (Tablets) */
@media (min-width: 600px) {
    header h1 {
        font-size: 2rem;
    }
    .subtitle {
        font-size: 1.1rem;
    }
    .container {
        padding: 30px;
    }
    textarea {
        min-height: 150px;
    }
    .options {
        grid-template-columns: 1fr 1fr; /* Side-by-side options */
        gap: 30px;
    }
    .analyze-button {
        width: auto; /* Button not full width */
        padding: 14px 35px;
    }
    .score-and-charts {
        grid-template-columns: auto 1fr; /* Score left, charts right */
        gap: 40px;
        align-items: center; /* Vertically align score and charts area */
    }
    .overall-score-container {
        text-align: center; /* Keep score centered */
    }
    .charts-container {
        grid-template-columns: 1fr 1fr; /* Side-by-side charts */
        gap: 20px;
    }
    .chart-wrapper {
        padding: 20px;
    }
    .chart-title {
       font-size: 1.05rem;
    }
    .result-details {
        grid-template-columns: 1fr 1fr; /* Side-by-side pros/cons */
        gap: 30px;
    }
    .top-ingredient {
        font-size: 0.9rem;
    }
     .bottom-nav {
        /* Optional: Could hide bottom nav on larger screens if preferred */
        /* display: none; */
    }
     body {
        /* Remove padding if bottom nav is hidden */
        /* padding-bottom: 0; */
    }

}

/* Large screens (Desktops) */
@media (min-width: 900px) {
    main {
        padding: 30px;
    }
    header h1 {
        font-size: 2.2rem;
    }
    .container {
       padding: 40px;
    }
    .tab {
        padding: 15px 20px;
        font-size: 1rem;
    }
    .analyze-button {
        font-size: 1.1rem;
    }
}