/* Color Palette */
:root {
    --primary-color: #593196;       /* Dark Purple */
    --secondary-color: #FF6B6B;     /* Coral Red */
    --accent-color: #6BFFB8;        /* Mint Green */
    --background-color: #F4EEFF;    /* Light Lavender */
    --text-color: #333;             /* Dark Gray */
    --light-text-color: #eee;       /* Off-White */
    --navbar-gradient: linear-gradient(to right, var(--primary-color), #7858A6);
}

/* General Body and Layout */
body {
    font-family: 'Arial', sans-serif;
    background: var(--background-color);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    color: var(--text-color);
    background-attachment: fixed;
}

.container {
    text-align: center;
    width: 100%;
    max-width: 500px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease;
    margin-top: 80px;
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Typography */
h1 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 28px;
}

h2 {
    text-align: left;
    margin-top: 30px;
    color: var(--secondary-color);
}

h3 {
    text-align: left;
    font-weight: normal;
    line-height: 1.6;
    color: var(--text-color);
}

/* Form Elements */
form {
    padding: 30px;
    box-sizing: border-box;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

input[type="file"],
input[type="number"],
select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
    font-size: 14px;
}

input[type="file"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 5px rgba(90, 49, 150, 0.5);
}

input[type="submit"] {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s, transform 0.3s;
    width: 100%;
}

input[type="submit"]:hover {
    background-color: #E05A5A;
    transform: scale(1.05);
}

/* Footer */
footer {
    margin-top: 20px;
    font-size: 12px;
    color: #777;
}

@media (max-width: 500px) {
    .container {
        margin-top: 70px;
        padding: 15px;
    }
    form {
        padding: 20px;
    }
    h1 {
        font-size: 24px;
    }
}

/* ... (everything before navbar remains unchanged) ... */

/* Enhanced Navbar */
.navbar {
    width: 100%;
    background: var(--navbar-gradient);
    padding: 10px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    border-radius: 0 0 12px 12px;
    height: 90px;  /* FIXED NAVBAR HEIGHT */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    color: white;
}

.navbar-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    height: 80px;      /* ← OPTIMAL FOR 478x205 (205px height cropped) */
    width: 190px;      /* ← PERFECT WIDTH RATIO (478/205 ≈ 2.33 → scaled) */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.navbar-logo-img {
    height: 80px !important;       /* ← CROPPED LOGO PERFECT HEIGHT */
    width: 190px !important;       /* ← MAINTAINS 478:205 RATIO */
    max-height: 80px !important;
    max-width: 190px !important;
    object-fit: contain !important; /* ← KEEPS ASPECT RATIO */
    display: block !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    pointer-events: none;           /* NO CLICK/SELECTION */
    user-select: none;
}

.navbar-logo-img:hover {
    transform: none !important;
}

/* RESPONSIVE - SCALES PERFECTLY */
@media (max-width: 768px) {
    .navbar-logo {
        height: 70px;
        width: 165px;
    }
    .navbar-logo-img {
        height: 70px !important;
        width: 165px !important;
        max-height: 70px !important;
        max-width: 165px !important;
    }
}

@media (max-width: 480px) {
    .navbar-logo {
        height: 65px;
        width: 155px;
    }
    .navbar-logo-img {
        height: 65px !important;
        width: 155px !important;
        max-height: 65px !important;
        max-width: 155px !important;
    }
}

/* ... (rest of the file unchanged) ... */

.navbar-actions {
    display: flex;
    align-items: center;
    margin-left: auto;
}

/* ORIGINAL LOGO RESPONSIVE SIZES PRESERVED */
@media (max-width: 768px) {
    .navbar-logo-img {
        height: 140px !important;
        max-height: 160px !important;
        min-height: 100px !important;
        top: -25px;
    }
}

@media (max-width: 480px) {
    .navbar-logo-img {
        height: 140px !important;
        max-height: 160px !important;
        min-height: 90px !important;
        top: -22px;
    }
}

/* Menu System */
.menu-container {
    position: fixed;
    top: 22px;
    left: 20px;
    width: 46px;
    height: 46px;
    cursor: pointer;
    z-index: 2000;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.menu-bar {
    position: absolute;
    height: 4px;
    width: 28px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: all 0.3s ease;
    left: 9px;
}

.bar1 { top: 14px; }
.bar2 { top: 21px; }
.bar3 { top: 28px; }

.menu-content {
    position: fixed;
    top: 0;
    left: -300px;
    width: 250px;
    height: 100vh;
    background: white;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding-top: 60px;
    z-index: 1999;
}

.menu-content a {
    display: block;
    padding: 18px 25px;
    text-decoration: none;
    color: var(--text-color);
    border-bottom: 1px solid #eee;
    transition: all 0.3s ease;
    font-size: 16px;
}

.menu-content a:hover {
    background: #f5f5f5;
    color: var(--primary-color);
    padding-left: 30px;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 1998;
}

.menu-container.open .bar1 {
    transform: rotate(45deg);
    top: 21px;
    background: var(--primary-color);
}

.menu-container.open .bar2 {
    opacity: 0;
}

.menu-container.open .bar3 {
    transform: rotate(-45deg);
    top: 21px;
    background: var(--primary-color);
}

.menu-container.open + .menu-content {
    left: 0;
}

.menu-container.open + .menu-content + .menu-overlay {
    opacity: 1;
    visibility: visible;
}

/* Theme Toggle Styles */
.theme-toggle-container {
    margin-right: 18px;
}

.theme-toggle {
    appearance: none;
    width: 48px;
    height: 24px;
    background: #ccc;
    border-radius: 18px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
}

.theme-toggle:checked {
    background: #0056b3;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.theme-toggle:checked::before {
    transform: translateX(24px);
}

/* Back to Top Button Styles */
.back-to-top {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--navbar-gradient);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    cursor: pointer;
    z-index: 1000;
}

.back-to-top:hover {
    background: #0056b3;
}

/* Loader Styles */
.loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid var(--secondary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 2s linear infinite;
}

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

.stylish-loader {
 margin: 20px auto;
 border: 8px solid #f3f3f3;
 border-top: 8px solid #4f8cff;
 border-right: 8px solid #00e6e6;
 border-radius: 50%;
 width: 60px;
 height: 60px;
 animation: spin 1s linear infinite, colorchange 2s linear infinite;
 box-shadow: 0 0 30px #4f8cff44, 0 0 10px #00e6e6;
}

@keyframes colorchange {
 0% { border-top-color: #4f8cff; border-right-color: #00e6e6;}
 50% { border-top-color: #ff4f81; border-right-color: #ffe600;}
 100% { border-top-color: #4f8cff; border-right-color: #00e6e6;}
}

/* Image Comparison Styles - Enhanced */
.img-compare-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 320px; /* Fixed Height */
    margin: 20px auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.img-compare-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Maintain aspect ratio */
    pointer-events: none;
}

.img-compare-top {
    clip-path: inset(0 0 0 var(--clip-value, 50%));
    z-index: 2;
}

.img-compare-slider {
    appearance: none;
    position: absolute;
    z-index: 3;
    width: calc(100% - 40px); /* Reduced width */
    left: 20px; /* Centering slider */
    bottom: 16px; /* Positioned at the bottom */
    background: rgba(255, 255, 255, 0.3);
    height: 8px;
    border-radius: 4px;
    outline: none;
    cursor: ew-resize;
}

.img-compare-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--secondary-color);
    border: 3px solid white;
    border-radius: 50%;
    cursor: ew-resize;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.img-compare-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.img-compare-label {
    position: absolute;
    top: 10px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 5px;
    z-index: 4;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.img-compare-label.left {
    left: 10px;
    background: rgba(255, 107, 107, 0.7); /* Coral Red */
}

.img-compare-label.right {
    right: 10px;
    background: rgba(255, 107, 107, 0.7); /* Coral Red */
}

.img-compare-label.left::after {
    content: ' →'; /* Right arrow AFTER Original */
    font-size: 1.2em;
    margin-left: 4px;
}

.img-compare-label.right::before {
    content: ' ← '; /* Left arrow BEFORE Compressed */
    font-size: 1.2em;
    margin-right: 4px;
}

@media (max-width: 600px) {
    .img-compare-wrapper {
        max-width: 100%;
        height: 240px;
    }
}

/* === NEW POPUP STYLES FOR COMPARER === */
.compare-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.9);
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
}
.compare-popup-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    background: #111;
    padding: 20px;
    border-radius: 12px;
    box-sizing: border-box;
}
.compare-popup .img-compare-wrapper {
    max-width: 100%;
    width: 80vw;
    height: 70vh;
}
.close-popup-btn {
    position: absolute;
    top: 10px;
    right: 14px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    font-weight: bold;
}
.compare-popup-download {
    margin-top: 15px;
    text-align: center;
}
.compare-popup-download a {
    text-decoration: none;
    color: var(--secondary-color);
}

/* Dark Mode - Vibrant Scheme */
body.dark-mode {
    background: #1A1A2E;
    color: #E0E0E0;
    --background-color: #1A1A2E;
}

body.dark-mode .container {
    background: linear-gradient(145deg, #16213E, #0F3460);
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode h1 {
    color: #E94560;
    text-shadow: 0 2px 4px rgba(233, 69, 96, 0.2);
}

body.dark-mode h2 {
    color: #00B8A9;
}

body.dark-mode h3 {
    color: #E0E0E0; /* Added for text visibility */
}

body.dark-mode hr {
    border-color: rgba(224, 224, 224, 0.1); /* Added for divider visibility */
}

body.dark-mode input[type="file"],
body.dark-mode input[type="number"],
body.dark-mode select {
    background-color: #2C3E50;
    color: #ECF0F1;
    border: 1px solid #34495E;
}

body.dark-mode .menu-content {
    background: #16213E;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .menu-content a {
    color: #E0E0E0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-mode .menu-content a:hover {
    background: rgba(0, 184, 169, 0.1); /* Teal overlay */
    color: #00B8A9;
}

body.dark-mode .navbar {
    background: linear-gradient(45deg, #E94560, #0F3460); /* Coral to navy */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

body.dark-mode .theme-toggle {
    background: #34495E;
}

body.dark-mode .theme-toggle:checked {
    background: #00B8A9;
}

body.dark-mode .back-to-top {
    background: rgba(233, 69, 96, 0.9); /* Coral */
}

body.dark-mode .back-to-top:hover {
    background: #E94560;
}

body.dark-mode .img-compare-slider {
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode .img-compare-slider::-webkit-slider-thumb {
    background: #00B8A9;
    border: 3px solid #16213E;
}

body.dark-mode .img-compare-label {
    background: rgba(0, 184, 169, 0.7); /* Teal */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

body.dark-mode footer {
    color: #95A5A6;
}

body.dark-mode footer a {
    color: #00B8A9;
}

body.dark-mode .loader {
    border-top-color: #00B8A9;
}

body.dark-mode .loader-wrapper {
    background: rgba(22, 33, 62, 0.95); /* Navy overlay */
}
