/* ==================================== */
/* 1. CSS Custom Properties (Variables) */
/* ==================================== */

:root {
    /* Font Families */
    --fm-p: "IBM Plex Sans Arabic", sans-serif;
    --fm-h1: "Anton", sans-serif;

    /* Font Weights */
    --fw-100: 100;
    --fw-200: 200;
    --fw-300: 300;
    --fw-400: 400;
    --fw-500: 500;
    --fw-600: 600;
    --fw-700: 700;
    --fw-800: 800;
    --fw-900: 900;

    /* Colors (HSL format) */
    --clr-accent: hsl(357, 84%, 51%);
    --clr-accent-transparent: hsl(357, 84%, 51%, 0%);
    --clr-accent-hover: hsl(357, 100%, 50%);
    --clr-neutral-100: 0, 0%, 100%;
    --clr-neutral-200: 0, 0%, 90%;
    --clr-neutral-300: 0, 0%, 80%;
    --clr-neutral-400: 0, 0%, 64%;
    --clr-neutral-600: 0, 0%, 30%;
    --clr-neutral-700: 0, 0%, 35%;
    --clr-neutral-800: 0, 0%, 23%;
    --clr-neutral-900: 0, 0%, 0%;

    /* Spacing & Sizes */
    --fs: 1em;
    --gap: 1rem;
    --width: 80%;
    --input-width: calc(25% - calc(var(--gap) * 1.5));
    --header-height: 80px;

    /* Layout & Other */
    --flex-dir: row;
}

/* ==================================== */
/* 2. Base Styles & Global Resets       */
/* ==================================== */

/* Box Sizing & Resets */
*, h1, h2, h3, h4, p, a, li, span {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Focus State for accessibility */
*:focus {
    outline: none;
    border: solid 1px var(--clr-accent);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 10px;
    background: hsl(var(--clr-neutral-100));
    border-radius: 100vh;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 30px;
    height: 30px;
    background: var(--clr-accent);
    border-radius: 7px;
    cursor: pointer;
    border: none;
    outline: none;
}

input[type="range"]::-moz-range-thumb {
    width: 30px;
    height: 30px;
    background: var(--clr-accent);
    border-radius: 7px;
    cursor: pointer;
    border: none;
    outline: none;
}

/* Body and Global Typography */
body {
    background: hsl(var(--clr-neutral-800));
    color: hsl(var(--clr-neutral-100));
    font-family: var(--fm-p);
    font-size: var(--fs);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.bg-body{
    background: url(assets/ChatGPT\ Image\ Aug\ 4\,\ 2025\,\ 10_16_13\ PM.png);
    object-fit: cover;
    background-repeat: no-repeat;
    background-size: 100%;
    background-position: bottom;
}

.overlay{
    background: hsl(var(--clr-neutral-900), 15%);
    background: linear-gradient(180deg, hsl(var(--clr-neutral-900)) 0%, hsl(var(--clr-neutral-900), 0%) 20%);
    width: 100%;
    inset: 0;
    position: absolute;
    z-index: -1;
}

main {
    width: 100%;
    display: grid;
    place-content: center;
}

/* Custom Typography Classes */
.display-3 {
    font-family: var(--fm-h1);
    text-transform: uppercase;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--clr-accent) !important;
    text-align: center;
}

.text-danger {
    color: var(--clr-accent) !important;
}

.text-warning {
    color: #ffc107 !important;
}

.text-success {
    color: #198754 !important;
}

.text-info {
    font-size: 1.25em;
    font-weight: 300;
    color: hsl(var(--clr-neutral-100));
}

.text-primary {
    color: #0d6efd !important;
}

/* ==================================== */
/* 3. Header & Navigation Styles        */
/* ==================================== */

.main-header {
    width: 80%;
    margin-inline: auto;
    border-bottom: 1px solid hsl(var(--clr-neutral-100));
    padding: 1.5rem 0;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    margin: 0 auto;
}

.site-logo {
    max-height: 40px;
    width: auto;
}

.nav-toggle {
    display: none;
}

.nav-toggle-label {
    display: none;
    cursor: pointer;
}

.nav-toggle-icon {
    display: block;
    width: 25px;
    height: 3px;
    background-color: hsl(var(--clr-neutral-100));
    position: relative;
    transition: background-color 0.3s ease;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
    content: '';
    display: block;
    width: 25px;
    height: 3px;
    background-color: hsl(var(--clr-neutral-100));
    position: absolute;
    transition: transform 0.3s ease;
}

.nav-toggle-icon::before {
    top: -8px;
}

.nav-toggle-icon::after {
    top: 8px;
}

.nav-toggle:checked ~ .nav-toggle-label .nav-toggle-icon {
    background-color: transparent;
}

.nav-toggle:checked ~ .nav-toggle-label .nav-toggle-icon::before {
    transform: translateY(8px) rotate(45deg);
}

.nav-toggle:checked ~ .nav-toggle-label .nav-toggle-icon::after {
    transform: translateY(-8px) rotate(-45deg);
}

.nav-menu {
    display: flex;
    list-style: none;
    align-items: center;
}

.nav-item {
    margin-left: 1.5rem;
}

.nav-link {
    color: hsl(var(--clr-neutral-100));
    text-decoration: none;
    transition: all 350ms ease-in-out;
    padding: 0 0.25rem;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--clr-accent);
    transition: width 0.3s ease-in-out;
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link-btn {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
}

.social-icon {
    width: 20px;
    filter: brightness(0) invert(1);
    transition: all 250ms ease-in;
}

.nav-link:hover .social-icon {
    filter: none;
    background-color: hsl(var(--clr-neutral-100));
    border-radius: 4px;
    padding: 2px;
}

/* ==================================== */
/* 4. Main Content Layout & Components  */
/* ==================================== */

.main-content {
    width: 90%;
    margin-inline: auto;
    display: grid;
    grid-template-columns: 1fr;
    place-content: center;
    text-align: center;

    @media (width < 720px){
        grid-template-rows: 1fr;
    }
}

.main-content img {
    width: 100%;
    object-fit: cover;
    grid-row: 1 / -1;
    grid-column: 1 / -1;

    @media (width < 960px){
        grid-row: 1;
        grid-column: 1;
    }
}

.hero-section {
    margin-block: 5rem;
    width: 100%;
}

.hero-section h1{
    font-family: Anton;
    text-transform: uppercase;
    font-size: 3em;
    color: var(--clr-accent);
}


.form-card {
    background-color: hsla(var(--clr-neutral-700), 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: calc(var(--gap)*3.5);
    padding: 1rem;
    animation: fadeInUp 500ms ease-out;
}

.narrow{
    width: 50% !important;
    padding: 2rem 5rem;
}

.form-card h2 {
    text-align: center;
    text-transform: uppercase;
    font-weight: 200;
    font-size: 2em;
    margin-block: 2rem;
}

.simulation-form {
   display: grid;
   grid-template-columns: 1fr 1fr;
   gap: calc(var(--gap)*2);

   @media (width < 1080px){
    grid-template-columns: 1fr;
   }
}

.controls-grid{
    display: grid;
    gap: var(--gap);
}

.controller-group{
    display: grid;
    grid-template-columns: 40% 1fr;
    background: rgba(255,255,255,0.1); /* Merged from second block */
    padding: 1rem; /* Merged from second block */
    border-radius: 2rem; /* Merged from second block */
}

.form-label{
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    align-items: center;
    color: #fff !important; /* Merged from second block */
    font-weight: 500; /* Merged from second block */
    text-shadow: 0 1px 2px rgba(0,0,0,0.5); /* Merged from second block */
    width: 100%; /* Existing style */
    padding-inline: .7rem; /* Existing style */
}

.form-range{
    place-self: center;
}

.label-value{
    grid-column: 2;
    grid-row: 1;
    font-size: 1.5em;
    align-self: start;
    justify-self: start;
    color: #ffd700 !important; /* Merged from second block */
    font-weight: bold; /* Merged from second block */
}

.range-text{
    font-size: .7em;
    grid-column: 1 / -1;
    color: #ccc !important; /* Merged from second block */
    font-size: 0.9em; /* Merged from second block, overwrites existing */
}

.form-group {
    display: grid;
    justify-content: start;
    text-align: start;
    min-width: 45%;
}

.form-select {
    width: 15rem;
    padding: 1.2rem 3.5rem;
    font-size: 1rem;
    border-radius: var(--gap);
    background-color: hsl(var(--clr-neutral-700));
    border: 1.5px solid hsl(var(--clr-neutral-800));
    color: hsl(var(--clr-neutral-100));
    outline: none !important;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
}

.form-select:focus {
    border-color: var(--clr-accent);
    outline: none;
}

.form-action-buttons {
    width: 100%;
    display: grid;
    padding-inline: 1.5rem;
    gap: calc(var(--gap)*2);
    grid-template-columns: repeat(auto-fit, minmax(40%, 1fr));
    text-align: center;
    margin-top: 20px; /* Merged from second block */
}

.secondary-btn-container {
    margin-top: 1rem;
}

.btn {
    font-size: 1rem;
    padding: 1.2rem 3rem;
    border-radius: var(--gap);
    cursor: pointer;
    text-decoration: none;
    transition: all 350ms ease-out;
    width: 100%;
    backdrop-filter: blur(10px); /* Merged from second block */
    border: 1px solid rgba(255,255,255,0.2); /* Merged from second block */
    transition: all 0.3s ease; /* Merged and simplified */
}

.btn-danger {
    background-color: var(--clr-accent);
    border: 1px solid var(--clr-accent);
    color: hsl(var(--clr-neutral-100));
    transition: all 350ms ease-in;
}

.btn-danger:hover {
    background-color: var(--clr-accent-hover);
    border: 1px solid var(--clr-accent-hover);
}

.btn-outline-danger {
    background-color: var(--clr-accent-transparent);
    border: 2px solid var(--clr-accent);
    color: var(--clr-accent);
    transition: all 350ms ease-in;
}

.btn-outline-danger:hover {
    background-color: var(--clr-accent);
    color: hsl(var(--clr-neutral-100));
}

.btn:hover { /* Merged from second block */
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* Results Section */
.results-container {
    margin-top: 2rem;
}

.results-card {
    width: 100%;
    background-color: hsl(var(--clr-neutral-700));
    margin: 1rem;
    border-radius: calc(var(--gap)*2);
    padding: 2rem;
}

.results-card-body {
    display: grid;
    gap: 1rem;
    text-align: start;
    color: hsl(var(--clr-neutral-100));
}

.results-card-body h3 {
    color: hsl(var(--clr-neutral-300));
}

.results-list {
    list-style: none;
    padding: 0;
    display: grid;
    gap: calc(var(--gap));
}

.results-item {
    background-color: hsl(var(--clr-neutral-800));
    border-radius: calc(var(--gap)*2);
    padding: 1rem 2rem;
    display: grid;
}

.results-item div {
    display: flex;
    gap: 1rem;
}

.results-item h4{
    color: hsl(var(--clr-neutral-100));
    font-weight: 600;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid var(--clr-accent);
    color: hsl(var(--clr-neutral-100));
    padding: 1rem;
    border-radius: 0.25rem;
    margin-top: 1rem;
}

/* Credits Section */
.credits {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    background-color: hsl(var(--clr-neutral-100));
    color: hsl(var(--clr-neutral-900));
    padding: 1rem;
    border-top-left-radius: calc(var(--gap)*1.5);
    border-bottom-left-radius: calc(var(--gap)*1.5);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1050;
    text-align: center;
}

.credits-text p {
    font-size: 0.68rem;
    font-weight: 400;
}

.sc-logo {
    width: 5rem;
}

.form-card-body {
    width: 100%;
    height: fit-content;
    text-align: start;
    border-radius: var(--gap);
    padding: 2rem;
    margin: 1rem 0;
    grid-column: 1;
    grid-row: 1;
    z-index: 1000;
    background: hsl(var(--clr-neutral-700), 50%);

    @media (width < 960px){
        grid-row: 1;
        grid-column: 1 / -1;
    }
}

.contols-card{
    align-self: end;
    justify-self: end;
    display: grid;
    gap: 1rem;
    width: fit-content;
    height: fit-content;
    text-align: start;
    border-radius: var(--gap);
    padding: 2rem;
    margin: 1rem;
    grid-column: 1;
    grid-row: 1;
    z-index: 1000;
    background: hsl(var(--clr-neutral-700), 75%); /* Existing style */
    backdrop-filter: blur(10px) !important; /* Overwritten with more specific value from second block */
    -webkit-backdrop-filter: blur(10px); /* Merged from first block */

    @media (width < 960px){
        grid-row: 3;
        grid-column: 1;
        margin: 1rem 0;
    }
}

.contols-card h3 { /* Merged from second block */
    color: #fff;
    text-align: center;
    margin-bottom: 20px;
}


.general-info{
    width: 100%;
    margin: 2rem 0;
    padding: 3rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(35rem, 1fr));
    text-align: start;
    gap: 1rem;
    border-radius: calc(var(--gap)*3);
    background: hsl(var(--clr-neutral-700));
}

.info-card{
    padding: 2rem;
    background: hsl(var(--clr-neutral-600));
    border-radius: calc(var(--gap)*2);
}

.info-card h5{
    font-size: 1.25em;
    text-transform: uppercase;
    font-weight: 300;
    color: hsl(var(--clr-neutral-300));
}

.classroom-container {
    border-radius: 3rem;
    overflow: hidden;
}

#lightingCanvas {
    transition: filter 0.3s ease;
    border-radius: 15px;
}

.flicker {
    animation: flickerEffect 0.2s infinite;
}

@keyframes flickerEffect {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.blurred {
    filter: blur(2px);
}

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

.validation-status {
    font-size: 0.85rem;
    width: 75%;
    margin-inline: auto;
    padding: .125rem .25rem;
    border-radius: .5rem;
    margin-top: .25rem;
    font-weight: 500;
    text-align: start;
    grid-column: 1 / -1;
    transition: all 0.3s ease;
}

.validation-status.good {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.validation-status.medium {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.validation-status.bad {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.validation-status.evaluating {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Preloader Styles */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    text-align: center;
    color: white;
}

.preloader-gif {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
}

.preloader-text {
    font-size: 1.2rem;
    font-weight: 500;
    color: #ffffff;
    margin-top: 15px;
    animation: pulse 1.5s infinite;
}

/* ==================================== */
/* 5. Responsive Adjustments            */
/* ==================================== */

/* Mobile-first approach with enhanced responsiveness */
@media (max-width: 480px) {
    /* Ultra-small phones */
    :root {
        --fs: 0.9em;
        --gap: 0.75rem;
        --width: 95%;
    }
    
    .main-header {
        width: 95%;
        padding: 1rem 0;
    }
    
    .header-container {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 1rem;
    }
    
    .site-logo {
        max-height: 35px;
    }
    
    .nav-toggle-label {
        display: block;
        position: absolute;
        right: 0;
        top: 0.5rem;
    }
    
    .nav-menu {
        display: none;
        flex-direction: column;
        align-items: center;
        width: 100%;
        margin-top: 1rem;
        padding: 1rem 0;
        border-top: 1px solid hsl(var(--clr-neutral-400));
        background: hsl(var(--clr-neutral-800));
        border-radius: 0.5rem;
    }
    
    .nav-item {
        margin: 0.5rem 0;
        width: 100%;
        text-align: center;
    }
    
    .nav-toggle:checked ~ .nav-menu {
        display: flex;
    }
    
    .main-content {
        padding: 1rem 0.5rem;
    }
    
    .form-card, .narrow {
        width: 100% !important;
        padding: 1rem !important;
        margin: 0.5rem 0;
    }
    .form-card-body {
        padding: 1rem;
        margin: 0.5rem;
    }
    .form-card-body h4 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    .classroom-container {
        margin: 0.5rem;
        border-radius: 1.5rem;
    }
    .contols-card {
        position: static !important;
        margin: 0.5rem;
        padding: 1rem;
        width: calc(100% - 1rem) !important;
        background: rgba(0,0,0,0.8) !important;
    }
    .contols-card h3 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
        text-align: center;
    }
    .controls-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .controller-group {
        padding: 1rem;
        background: rgba(255,255,255,0.05);
        border-radius: 0.75rem;
    }
    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    .label-value {
        font-weight: 600;
        color: var(--clr-accent);
    }
    input[type="range"] {
        height: 8px;
        margin: 0.75rem 0;
    }
    input[type="range"]::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    input[type="range"]::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
    .validation-status {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        margin-top: 0.5rem;
        width: 100%;
    }
    .info-card {
        padding: 1rem;
        margin: 0.5rem;
    }
    .info-card h5 {
        font-size: 1rem;
    }
    .info-card p {
        font-size: 0.85rem;
        line-height: 1.4;
    }
    .credits {
        position: static;
        width: 100%;
        border-radius: 0;
        box-shadow: none;
        padding: 0.5rem;
        top: unset;
        right: unset;
        transform: none;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    /* Tablets and larger phones */
    :root {
        --fs: 0.95em;
        --gap: 0.875rem;
        --width: 90%;
    }
    .main-header {
        width: 90%;
    }
    .header-container {
        flex-direction: column;
        align-items: flex-start;
        width: 95%;
        gap: 1rem;
    }
    .main-nav {
        width: 100%;
    }
    .nav-toggle-label {
        display: block;
        position: absolute;
        right: 1rem;
        top: 1.5rem;
    }
    .nav-menu {
        display: none;
        flex-direction: column;
        align-items: center;
        width: 100%;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid hsl(var(--clr-neutral-400));
    }
    .nav-item {
        margin: 0.5rem 0;
    }
    .nav-toggle:checked ~ .nav-menu {
        display: flex;
    }
    .display-3 {
        font-size: 2.5rem;
    }
    .form-card, .narrow {
        width: 90% !important;
        padding: 1.5rem !important;
        margin: 1rem auto;
    }
    .contols-card {
        position: static !important;
        margin: 1rem;
        width: calc(100% - 2rem) !important;
    }
    .controls-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    .form-group {
        flex: 1 1 100%;
        max-width: 100%;
    }
    .btn {
        padding: 0.75rem 2rem;
        font-size: 1rem;
    }
    .credits {
        position: static;
        width: 100%;
        border-radius: 0;
        box-shadow: none;
        padding: 0.5rem;
        top: unset;
        right: unset;
        transform: none;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    /* Desktop and larger tablets */
    .contols-card {
        width: 60% !important;
        margin: 1.5rem auto;
    }
    .controls-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

/* Extra: Ensure images and canvas are responsive */
.main-content img, .classroom-container img, .classroom-container canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Extra: Make sure overlay and background images scale */
.overlay, .bg-body {
    width: 100vw;
    min-height: 100vh;
    background-size: cover !important;
    background-position: center !important;
}

/* Extra: Responsive form select and buttons */
.form-select, .btn {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Extra: Responsive grid for info cards */
.general-info {
    grid-template-columns: 1fr !important;
}

@media (min-width: 600px) {
    .general-info {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
    }
}

/* ==================================== */
/* 6. Animation and Effects             */
/* ==================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-card {
    animation: fadeInUp 0.6s ease-out;
}

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

::-webkit-scrollbar-track {
    background: hsl(var(--clr-neutral-800));
}

::-webkit-scrollbar-thumb {
    background: var(--clr-accent);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(357, 84%, 45%);
}