/* CSS variables for theme colors - improved color palette */
:root {
    /* Light mode (default) variables - enhanced color scheme */
    --background: linear-gradient(135deg, #e6f7ff 0%, #ffffff 50%, #f5f7fa 100%);
    --container-bg: rgba(255, 255, 255, 0.95);
    --card-bg: #ffffff;
    --text-color: #2d3436;
    --text-secondary: #636e72;
    --border-color: #dfe6e9;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --accent-color: #0984e3;
    --accent-gradient: linear-gradient(to right, #0984e3, #2d3436);
    --header-gradient: linear-gradient(135deg, #0984e3, #2d3436);
    --header-accent: linear-gradient(to left, #e74c3c, transparent);
    --eco-friendly-color: #00b894;
    --negative-color: #e74c3c;
    --summary-bg: #f8f9fa;
    --impact-bg: #e3f2fd;
    --recommendations-bg: #e8f5e9;
    --progress-bg: #dfe6e9;
}

/* Dark mode variables - more cohesive dark theme */
[data-theme="dark"] {
    --background: linear-gradient(135deg, #1e272e 0%, #2d3436 50%, #0a0a0a 100%);
    --container-bg: rgba(30, 39, 46, 0.95);
    --card-bg: #2d3436;
    --text-color: #f5f6fa;
    --text-secondary: #dfe6e9;
    --border-color: #4b6584;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --accent-color: #74b9ff;
    --accent-gradient: linear-gradient(to right, #74b9ff, #0984e3);
    --header-gradient: linear-gradient(135deg, #74b9ff, #0984e3);
    --header-accent: linear-gradient(to left, #ff7675, transparent);
    --eco-friendly-color: #55efc4;
    --negative-color: #ff7675;
    --summary-bg: #2d3436;
    --impact-bg: #2c3e50;
    --recommendations-bg: #2c3e50;
    --progress-bg: #4b6584;
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', 'Segoe UI', 'Arial', sans-serif;
}





/* Add Poppins font for better typography */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
@import url('');
body {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--background);
    color: var(--text-color);
    transition: background 0.5s ease, color 0.5s ease;
}

/* Improved blurred background with overlay */
body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/image.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(12px) saturate(120%);
    -webkit-filter: blur(12px) saturate(120%);
    z-index: -2;
}

/* Add overlay for better contrast */
body::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(13, 71, 161, 0.3), rgba(230, 74, 25, 0.2));
    z-index: -1;
}

/* Enhanced container with more depth */
.quiz-container {
    background-color: var(--container-bg);
    border-radius: 16px;
    box-shadow: 0 15px 35px var(--shadow-color), 0 5px 15px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 700px;
    overflow: hidden;
    border: 2px solid var(--accent-color);
    max-height: 85vh;
    overflow-y: auto;
    transition: all 0.3s ease;
    transform: translateY(0);
    animation: container-appear 0.6s ease-out;
}




@keyframes container-appear {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced header styles */
.quiz-header {
    background: var(--header-gradient);
    color: white;
    padding: 25px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.quiz-header::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: var(--header-accent);
    opacity: 0.4;
    z-index: 0;
    animation: header-glow 5s infinite alternate;
}

@keyframes header-glow {
    0% {
        opacity: 0.3;
        transform: translateX(5px);
    }
    100% {
        opacity: 0.6;
        transform: translateX(0px);
    }
}

.quiz-header h1 {
    font-size: 32px;
    margin-bottom: 10px;
    font-weight: 700;
    position: relative;
    text-shadow: 1px 2px 5px rgba(0,0,0,0.25);
    letter-spacing: 0.5px;
}

.quiz-subtitle {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 15px;
    font-style: italic;
    font-weight: 300;
}

/* Improved status indicators */
.quiz-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.eco-score, .questions-completed {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 8px 18px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Enhanced logo styling */
.logo-container {
    position: relative;
    margin: 0 auto 20px;
    width: 100px;
    height: 100px;
}

.team-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.8);
    padding: 3px;
    background-color: rgba(255, 255, 255, 0.3);
    display: block;
    margin: 0 auto;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 2;
}

.logo-container::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 70%);
    z-index: 1;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        width: 96px;
        height: 96px;
        opacity: 0.8;
    }
    70% {
        width: 110px;
        height: 110px;
        opacity: 0;
    }
    100% {
        width: 96px;
        height: 96px;
        opacity: 0;
    }
}

.team-logo:hover {
    transform: scale(1.08) rotate(8deg);
    border-color: white;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Enhanced progress bar */
.progress-container {
    height: 8px;
    background-color: var(--progress-bg);
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 10;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(to right, var(--accent-color), var(--negative-color));
    width: 0%;
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

/* Question card styles */
.question-card {
    padding: 30px;
    background-color: var(--card-bg);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    animation: fade-in 0.4s ease-out;
}

@keyframes fade-in {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.question-number {
    color: var(--accent-color);
    margin-bottom: 12px;
    display: block;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.section-heading {
    color: var(--text-color);
    margin-bottom: 18px;
    font-size: 1.3rem;
    padding-left: 14px;
    border-left: 4px solid var(--accent-color);
    line-height: 1.3;
    font-weight: 600;
}

.question-text {
    color: var(--text-color);
    margin-bottom: 24px;
    font-size: 1.15rem;
    line-height: 1.5;
    font-weight: 400;
    padding-left: 6px;
}

/* Enhanced input styling */
.input-container {
    margin-bottom: 25px;
    position: relative;
}

#answer-input {
    width: 100%;
    padding: 15px 18px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    background-color: var(--card-bg);
    color: var(--text-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

#answer-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(var(--accent-color-rgb, 9, 132, 227), 0.15);
}

.input-hint {
    margin-top: 10px;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 4px;
}

.input-hint i {
    color: var(--accent-color);
}

/* Enhanced button styles */
.actions {
    padding: 22px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.eco-tip {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 60%;
    font-style: italic;
    line-height: 1.4;
}

.button-group {
    display: flex;
    gap: 12px;
}

.next-btn, .restart-btn, .back-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(var(--accent-color-rgb, 9, 132, 227), 0.25);
}

.back-btn {
    background: linear-gradient(to right, #95a5a6, #7f8c8d);
    box-shadow: 0 4px 12px rgba(127, 140, 141, 0.25);
}

.next-btn:hover, .restart-btn:hover {
    background: linear-gradient(to right, #0984e3, #0a3d62);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(var(--accent-color-rgb, 9, 132, 227), 0.35);
}

.back-btn:hover {
    background: linear-gradient(to right, #7f8c8d, #636e72);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(127, 140, 141, 0.35);
}

.next-btn:active, .restart-btn:active, .back-btn:active {
    transform: translateY(-1px);
}

/* Enhanced result page styles */
.result {
    padding: 30px;
    text-align: center;
    background-color: var(--card-bg);
    color: var(--text-color);
    animation: fade-in 0.6s ease-out;
}

.result-header {
    margin-bottom: 35px;
}

.result-icon {
    font-size: 70px;
    margin-bottom: 25px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: pulse-shadow 2s infinite;
}

@keyframes pulse-shadow {
    0% {
        text-shadow: 0 0 5px rgba(var(--accent-color-rgb, 9, 132, 227), 0.2);
    }
    50% {
        text-shadow: 0 0 20px rgba(var(--accent-color-rgb, 9, 132, 227), 0.4);
    }
    100% {
        text-shadow: 0 0 5px rgba(var(--accent-color-rgb, 9, 132, 227), 0.2);
    }
}

.result h2 {
    color: var(--text-color);
    margin-bottom: 15px;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.result-score {
    font-size: 20px;
    margin-bottom: 25px;
    color: var(--accent-color);
    font-weight: 600;
    padding: 10px 20px;
    background-color: rgba(var(--accent-color-rgb, 9, 132, 227), 0.1);
    border-radius: 30px;
    display: inline-block;
}

/* Enhanced eco meter */
.eco-meter {
    margin: 30px auto;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.meter-scale {
    height: 24px;
    background: linear-gradient(to right, var(--negative-color), #f39c12, var(--eco-friendly-color));
    border-radius: 12px;
    margin-bottom: 8px;
    position: relative;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.meter-scale::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), transparent);
    border-radius: 12px 12px 0 0;
}

.meter-pointer {
    position: absolute;
    top: -15px;
    width: 12px;
    height: 40px;
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 4px;
    transition: left 1s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.meter-pointer::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #333;
}

.meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0 5px;
    margin-top: 5px;
}

/* Enhanced impact section */
.eco-impact {
    background-color: var(--impact-bg);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    text-align: left;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.eco-impact h3 {
    color: var(--accent-color);
    margin-bottom: 20px;
    font-size: 22px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    font-weight: 600;
}

.impact-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 22px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    transition: all 0.3s ease;
}

[data-theme="dark"] .impact-item {
    background-color: rgba(255, 255, 255, 0.05);
}

.impact-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.impact-icon {
    margin-right: 18px;
    font-size: 28px;
    color: var(--accent-color);
    background-color: rgba(var(--accent-color-rgb, 9, 132, 227), 0.1);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.impact-content h4 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 600;
}

.impact-content p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Enhanced summary section */
.result-summary {
    margin: 25px 0;
    text-align: left;
    padding: 20px;
    background-color: var(--summary-bg);
    border-radius: 12px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--card-bg);
}

/* Customize scrollbar for WebKit browsers */
.result-summary::-webkit-scrollbar {
    width: 6px;
}

.result-summary::-webkit-scrollbar-track {
    background: var(--card-bg);
}

.result-summary::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 3px;
}

.result-summary h3 {
    margin-bottom: 18px;
    color: var(--accent-color);
    font-size: 20px;
    font-weight: 600;
}

.result-summary h4 {
    color: var(--accent-color);
    margin: 20px 0 15px;
    font-size: 18px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 8px;
}

.result-summary p {
    margin-bottom: 15px;
    font-size: 15px;
    line-height: 1.6;
    padding: 10px;
    background-color: rgba(var(--accent-color-rgb, 9, 132, 227), 0.05);
    border-radius: 8px;
}

/* Enhanced recommendations section */
.eco-recommendations {
    background-color: var(--recommendations-bg);
    border-radius: 12px;
    padding: 25px;
    margin-top: 25px;
    margin-bottom: 25px;
    text-align: left;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.eco-recommendations h3 {
    color: var(--eco-friendly-color);
    margin-bottom: 20px;
    font-size: 22px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    font-weight: 600;
}

.recommendation-item {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    position: relative;
    padding: 15px;
    padding-left: 45px;
    background-color: rgba(var(--eco-friendly-color-rgb, 0, 184, 148), 0.05);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.recommendation-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background-color: rgba(var(--eco-friendly-color-rgb, 0, 184, 148), 0.1);
}

.recommendation-item i.fa-check-circle {
    position: absolute;
    left: 15px;
    top: 18px;
    color: var(--eco-friendly-color);
    font-size: 20px;
}

.recommendation-item span {
    flex: 1;
    width: 100%;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--text-color);
    line-height: 1.5;
}

.hidden {
    display: none;
}

/* Eco Score Indicator */
.eco-meter {
    margin: 20px auto;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.meter-scale {
    height: 20px;
    background: linear-gradient(to right, #d53a3a, #f39c12, #3a7bd5);
    border-radius: 10px;
    margin-bottom: 5px;
    position: relative;
}

.meter-pointer {
    position: absolute;
    top: -10px;
    width: 10px;
    height: 40px;
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 3px;
    transition: left 0.5s ease;
}

.meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #555;
}

/* Enhanced video link */
.video-link {
    background-color: var(--negative-color);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 10px;
    margin-left: 0;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(var(--negative-color-rgb, 231, 76, 60), 0.25);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
}

.video-link:hover {
    background-color: rgba(var(--negative-color-rgb, 231, 76, 60), 0.9);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(var(--negative-color-rgb, 231, 76, 60), 0.35);
}

.video-link i {
    margin-right: 8px;
    font-size: 16px;
}

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 5px 15px var(--shadow-color);
    z-index: 1000;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: rotate(30deg) scale(1.1);
    box-shadow: 0 8px 20px var(--shadow-color);
}


/* Unit toggle button */
.unit-toggle {
    position: fixed;
    top : 20px;
    right: 90px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 5px 15px var(--shadow-color);
    z-index: 1000;
    transition: all 0.3s ease;
}

.unit-toggle:hover {
    transform: rotate(30deg) scale(1.1);
    box-shadow: 0 8px 20px var(--shadow-color);
}

/* Load animations */
@keyframes slide-up {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Apply animation to sections */
.eco-impact, .result-summary, .eco-recommendations, .result-score {
    animation: slide-up 0.6s ease-out forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

.result-summary {
    animation-delay: 0.4s;
}

.eco-recommendations {
    animation-delay: 0.6s;
}

/* Responsive styles enhancement */
@media (max-width: 768px) {
    .quiz-container {
        width: 100%;
        max-height: 100%;
    }
    
    .quiz-header h1 {
        font-size: 24px;
    }
    
    .question-text {
        font-size: 16px;
    }

    .actions {
        flex-direction: column-reverse;
        gap: 15px;
    }

    .eco-tip {
        max-width: 100%;
        margin-top: 15px;
    }
    
    .theme-toggle {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .unit-toggle {
        top: 15px;
        right: 30px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .quiz-header h1 {
        font-size: 20px;
    }
    
    .question-text {
        font-size: 15px;
    }

    .result-icon {
        font-size: 50px;
    }

    .result h2 {
        font-size: 22px;
    }
    
    .button-group {
        width: 100%;
    }
    
    .next-btn, .back-btn {
        flex: 1;
        padding: 12px 15px;
    }
    @media (max-width: 576px) {
        body {
            padding: 0;
            margin: 0;
        }
        
        .quiz-container {
            width: 100vw;
            height: 100vh;
            max-width: 100vw;
            max-height: 100vh;
            border-radius: 0;
            box-shadow: none;
            margin: 0;
            overflow: auto;
            display: block;
            flex-direction: column;
        }
        
        /* Place the progress bar at the very top of the container */
        .progress-container {
            position: static;
            width: 100%;
            height: 8px;
            margin-bottom: 10px;
        }
        
        .quiz-header {
            border-radius: 0;
            padding: 10px 15px;
        }
        
        /* Let the question card fill the available space and scroll if needed */
        .question-card {
            flex: 1;
            overflow-y: auto;
            padding: 15px 20px 80px 20px; /* extra bottom padding to avoid content under actions */
        }
        
        /* Make actions appear as part of the container at the bottom */
        .actions {
            position: static;
            width: 100%;
            background-color: var(--card-bg);
            padding: 15px 20px;
            border-top: 1px solid var(--border-color);
            box-shadow: none;
        }
        
        /* Theme toggle repositioned to remain accessible */
        .theme-toggle {
            position: absolute;
            top: 10px;
            right: 10px;
            width: 40px;
            height: 40px;
            font-size: 18px;
        }

        .unit-toggle {
            position: absolute;
            top: 10px;
            right: 30px;
            width: 40px;
            height: 40px;
            font-size: 18px;
        }
    }
}