/* Modern Vibrant Color Palette (Same as before) */
:root {
    --primary: #e91e63; --primary-dark: #c2185b; --secondary: #0087c7; --accent-1: #ff0000; --accent-2: #ff0000; --accent-3: #ff0000; --accent-4: #ff0000; --neutral-50: #ffffff; --neutral-100: #f8f8f8; --neutral-200: #ececec; --neutral-300: #e0e0e0; --neutral-700: #faf6f6; --neutral-800: #424242; --neutral-900: #212121; --success: #4caf50; --warning: #ff9800; --danger: #f44336; --radius-sm: 0.25rem; --radius-md: 0.375rem; --radius-lg: 0.5rem; --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.1); --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.15), 0 2px 4px -1px rgba(0, 0, 0, 0.1); --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.1); --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.bannerk {
    /* position: fixed; */
    top: 0;
    left: 0;
    z-index: 300;
    background: linear-gradient(135deg, #fffffffd, #fffffe65, #fffffffd);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

/* Basic Reset & Body Styling (Same as before) */
body { 
    font-family: "DM Sans", sans-serif; line-height: 1.6; margin: 0; padding: 0; background-color: var(--neutral-100); color: var(--neutral-800); background-image: url(/static/blue.jpg);
    background-size: cover;
    background-position: center;
    /* text-shadow: 0 0 1px rgba(0, 0, 0, 0.4), 0 0 1px rgba(0, 0, 0, 0.5); */
}


/* Header & Footer (Same as before) */
header, footer {
    background: linear-gradient(135deg, #1a161680, #fffffe65, #1113171f);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: white;
    padding: 1px 0 15px 0;
    text-align: center;
    box-shadow: var(--shadow-md);
    }   

header { background-color: #000408ba;}

footer { text-align: center;
    margin-top: 0rem;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: #ffffff;
    background-color: #2d2727ad; border-top: 1px solid #00000024;}


header h1 a { color: white; text-decoration: none; font-weight: 500; font-size: 2.1rem; letter-spacing: 0em; }
header nav {  margin-top: 0.75rem; }
header nav a { color:#fff;
    text-decoration: none;
    margin: 0 1rem;
    font-weight: 300;
    transition: color 0.2s ease, background-color 0.2s ease;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    letter-spacing: 4px; }
header nav a:hover, header nav a:focus { color: white; background-color: rgba(255,255,255,0.1); }

.logo img {
    width: 70%;
    max-width: 500px;   
    vertical-align: middle;
    padding-top: 10px;
}
.logotext {
    font-family: "Cormorant", sans-serif; ;
    font-size: 1.2rem;    
    display: inline-block;
    vertical-align: top;
    line-height: 0.9rem;
    letter-spacing: 3px;
}

.container {    
    margin: 0px;
    padding: 1rem 0;
    background-color: #0600004d !important;   
    /* box-shadow: var(--shadow-md); */
    /* border-radius: var(--radius-lg); */
    /* background: linear-gradient(135deg, #1a161680, #fffffe65, #1113171f); */
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid #00000069;
}

.resultrap { 
    margin: 0 30px;
}

.resultrap h2, .resultrap .results-image {
    color: #ffffff;
}   

/* Forms (Same as before) */
.form-group { margin-bottom: 2rem; background-color: white; padding: 1.5rem; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); transition: all 0.2s ease; }
.form-group:hover { box-shadow: var(--shadow-md); }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 600; color: var(--neutral-800); }
.form-group input[type="text"], .form-group input[type="file"] { width: 100%; padding: 0.75rem 1rem; border: 1px solid var(--neutral-300); border-radius: var(--radius-md); background-color: white; box-sizing: border-box; transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; }
.form-group input[type="text"]:focus, .form-group input[type="file"]:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.2); }
.form-group input[type="file"] { padding: 0.5rem; cursor: pointer; }
#file-name-display { display: inline-block; margin-top: 0.5rem; margin-left: 0.5rem; font-size: 0.875rem; color: var(--neutral-800); }
.form-help { margin-top: 0.5rem; font-size: 0.875rem; color: var(--neutral-800); }
.form-upload-container { text-align: center; padding: 2rem; border: 2px dashed var(--neutral-300); border-radius: var(--radius-md); margin: 1.5rem 0; cursor: pointer; transition: all 0.2s ease; background-color: var(--neutral-50); }
.form-upload-container.highlight { border-color: var(--primary); background-color: rgba(233, 30, 99, 0.05); }
.form-upload-icon { font-size: 3rem; margin-bottom: 1rem; color: var(--primary); }

/* Buttons (Same as before) */
.button, button[type="submit"] {  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; background-color: var(--primary); color: white; padding: 0.75rem 1.75rem; border-radius: var(--radius-md); font-weight: 600; letter-spacing: 0.025em; transition: all 0.2s ease; box-shadow: var(--shadow-sm); border: none; cursor: pointer; text-decoration: none; }
.button:hover, button[type="submit"]:hover { background-color: var(--primary-dark); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.button:active, button[type="submit"]:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.button-secondary { background-color: var(--secondary); }
.button-secondary:hover { background-color: #00a4b8; }
.cta-button { text-align: center; margin-top: 2rem; margin-bottom: 1rem; }
.cta-button .button + .button { margin-left: 1rem; }

/* Flash Messages (Same as before) */
.flash-messages { padding: 0; list-style: none; margin-bottom: 1.5rem; }
.flash { padding: 1rem 1.25rem; margin-bottom: 1rem; border-radius: var(--radius-md); border: 1px solid transparent; animation: fadeIn 0.3s ease-out; }
.flash-error { color: var(--danger); background-color: #fee2e2; border-color: #fecaca; }
.flash-warning { color: var(--warning); background-color: #fefce8; border-color: #fef9c3; }
.flash-success { color: var(--success); background-color: #f0fdf4; border-color: #dcfce7; }

/* Results Page Styles (Same as before) */
.results-container { display: flex; flex-wrap: wrap; gap: 2rem; }
.results-image { flex: 1 1 300px; min-width: 280px; }
.results-image img { width: 100%; height: auto; max-height: 450px; object-fit: contain; border-radius: var(--radius-md); box-shadow: var(--shadow-md); border: 1px solid var(--neutral-200); background-color: var(--neutral-100); }
.results-details { flex: 2 1 500px; }
.results-section { background-color: white; border: 1px solid var(--neutral-200); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 1.5rem; margin-bottom: 1.5rem; transition: box-shadow 0.2s ease-in-out; }
.results-section:hover { box-shadow: var(--shadow-md); }
.results-section h3 { margin-top: 0; color: var(--neutral-800); border-bottom: 1px solid var(--neutral-200); padding-bottom: 0.75rem; margin-bottom: 1rem; font-weight: 600; font-size: 1.25rem; }
.results-section.photo-analysis-summary { border-left: 5px solid var(--accent-3); background-color: #f9f5ff; }
.results-section.photo-analysis-summary h3 { color: var(--accent-3); font-size: 1.3rem; }
.results-section.measurements { border-left: 5px solid var(--accent-1); }
.results-section.measurements h3 { color: var(--accent-1); font-size: 1.3rem;}
.results-section.recommendation { border-left: 5px solid var(--accent-4); }
.results-section.recommendation h3 { color: var(--accent-4); font-size: 1.3rem;}
.results-section.errors { border-left: 5px solid var(--danger); }
.results-section.errors h3 { color: var(--danger); font-size: 1.3rem;}
.results-section ul { list-style: none; padding-left: 0; }
.results-section li { margin-bottom: 0.75rem; padding-left: 1.5rem; position: relative; }
.results-section li:before { content: "▸"; color: var(--primary); position: absolute; left: 0; font-weight: bold; }
.uncertainty { font-size: 0.875rem; color: var(--neutral-800); display: inline-block; margin-left: 0.25rem; }
.recommendation .rec-size { font-weight: 700; font-size: 1.5rem; color: var(--success); display: inline-flex; align-items: center; padding: 0.25rem 0.5rem; background-color: #f0fdf4; border-radius: var(--radius-sm); }
.errors ul li { color: var(--danger); }
.errors ul li::before { color: var(--danger); }
.analysis-paragraph { font-size: 1.05rem; line-height: 1.7; color: var(--neutral-800); margin-bottom: 1rem; }
.analysis-paragraph strong { color: var(--primary); font-weight: 600; }
.analysis-confidence-note { font-size: 0.9rem; color: var(--neutral-800); margin-top: 1rem; padding-top: 0.75rem; border-top: 1px dashed var(--neutral-300); }
.analysis-confidence-note strong { color: var(--neutral-900); }
.disclaimer {
    margin: 2rem 0;
    padding: 1rem 1rem 1rem 0.5rem;
    background-color: #ffffffcf;
    border-radius: var(--radius-md);
    border-left: 4px solid #ff0000;
    font-size: 0.9rem;
 }
.disclaimer h4 { margin-top: 0; color: var(--neutral-900); font-size: 1.1rem; }
.disclaimer ul { margin-bottom: 0; padding-left: 20px; }
.disclaimer li { margin-bottom: 0.25rem; text-align: left; }

/* --- Homepage Specific Styles --- */
.welcome-section { text-align: center; padding: 0rem 3rem; }
.welcome-section h2 { font-family: 'Cormorant', Courier, monospace; font-size: 2.25rem; color: #ffffff; margin-bottom: 0.75rem; }
.welcome-section .lead { font-size: 1.15rem; color: var(--neutral-700); max-width: 700px; margin-left: auto; margin-right: auto; margin-bottom: 1.5rem; }

/* Homepage Slideshow - Fade In/Out */
.slideshow-container-wrapper {
    max-width: 800px; /* Adjust max width as desired */
    width: 90%;
    margin: 2rem auto;
    padding: 0;
}

.js-slideshow-container {
    width: 100%;
    /* Aspect ratio box: padding-bottom is percentage of width. 75% = 4:3, 56.25% = 16:9 */
    padding-bottom: 60%; /* ADJUST THIS for desired aspect ratio, e.g., 60% for a 5:3 like ratio */
    position: relative; /* For absolute positioning of images inside */
    /* background-color: var(--neutral-200); */
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden; /* Important to clip images */
}

.slideshow-empty-message { /* Style for the message if no images */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--neutral-800);
    font-size: 1rem;
}

.js-slideshow-container .slideshow-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;      /* Cover the container, may crop */
    object-position: center; /* Center if cropped */
    opacity: 0;             /* Start hidden */
    transition: opacity 0.8s ease-in-out; /* Smooth fade transition */
    border-radius: var(--radius-lg); /* Match container rounding if image itself is rounded */
}

.js-slideshow-container .slideshow-image.active {
    opacity: 1; /* Active image is visible */
    z-index: 1; /* Ensure active image is on top if overlaps occur during transition */
}


/* Upload page styles (Same as before) */
.upload-container { position: relative; background-color: rgba(255, 255, 255, 0.95); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 2rem; margin: 2rem auto; max-width: 700px; z-index: 10; }
/* Background slideshow for upload page - different from homepage slideshow */
.slideshow-background { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; overflow: hidden; background-color: var(--neutral-800); }
.slideshow-background img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.5s ease-in-out; }
.slideshow-background img.active { opacity: 0.5; }
.hidden { display: none !important; }
#loadingMessage { margin-top: 1.5rem; padding: 1rem; background-color: var(--neutral-100); border: 1px dashed var(--secondary); border-radius: var(--radius-md); text-align: center; color: var(--secondary); }

/* Clothing Chart (Same as before) */
.clothing-chart { width: 100%; border-collapse: collapse; margin-top: 1.5rem; margin-bottom: 1.5rem; font-size: 0.8rem; box-shadow: var(--shadow-sm); }
.clothing-chart th, .clothing-chart td { border: 1px solid var(--neutral-300); padding: 0.75rem 0.5rem; text-align: center; }
.clothing-chart th { background-color: var(--neutral-200); font-weight: 600; color: var(--neutral-800); }
.clothing-chart tr:nth-child(even) { background-color: var(--neutral-100); }
.clothing-chart .highlight { background-color: var(--accent-2) !important; color: var(--neutral-900); font-weight: bold; }

/* Responsive Styles (Same as before, but check slideshow adjustments) */
@media (max-width: 768px) {
    .container { margin: 0rem; padding: 0.5rem 0.5rem; border-radius: revert; }
    .results-container { flex-direction: column; }
    .results-image, .results-details { flex-basis: auto; }
    header h1 a { font-size: 1.75rem; }
    header nav a { margin: 0 0.5rem; }
    .welcome-section {    padding: 0rem 0.5rem;}
    .welcome-section h2 { font-size: 1.8rem; }
    .welcome-section .lead { font-size: 1rem; }
    .slideshow-container-wrapper { width: 100%; margin: 0rem auto; } /* Full width on smaller screens */
    .js-slideshow-container { 
        /* Adjust aspect ratio for mobile if needed, or keep it consistent */
        padding-bottom: 70%; /* Example: Taller on mobile */
        border-radius: 0; /* Optional: full-width slideshow on mobile */
    }
    .upload-container { margin: 0.2rem; padding: 1.5rem; }
    .resultrap {  margin: 0 10px;}
    .clothing-chart { font-size: 0.65rem; }
}
@media (max-width: 480px) {
    .button, button[type="submit"] { padding: 0.6rem 1.2rem; font-size: 0.9rem; }
    .form-upload-container { padding: 1.5rem; }
    .clothing-chart { font-size: 0.8rem; }
    .clothing-chart th, .clothing-chart td { padding: 0.5rem 0.25rem; }
    .results-section h3, .results-section.photo-analysis-summary h3, .results-section.measurements h3, .results-section.recommendation h3, .results-section.errors h3 { font-size: 1.1rem; }
    .analysis-paragraph { font-size: 0.95rem; }
}

/* Animation */
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }