body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6; /* Light grayish-blue background */
    color: #333;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align items to the top */
    min-height: 100vh;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease; /* For dark mode transition */
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #1a1a1a; /* Dark background */
    color: #e0e0e0; /* Light text */
}

#app {
    background-color: #ffffff; /* White app container */
    padding: 30px;
    border-radius: 12px; /* Softer rounded corners */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); /* More pronounced shadow */
    width: 100%;
    max-width: 700px; /* Max width for better readability on large screens */
    text-align: center;
    position: relative; /* For positioning the dark mode button */
    transition: background-color 0.3s ease, box-shadow 0.3s ease; /* For dark mode transition */
}

body.dark-mode #app {
    background-color: #2c2c2c; /* Darker app container */
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.05); /* Lighter shadow for dark mode */
}

.dark-mode-button {
    position: absolute;
    top: 15px;
    left: 15px;
    background: none;
    border: 1px solid #ccc;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
    color: #333; /* Icon color for light mode */
}

body.dark-mode .dark-mode-button {
    background-color: #404040;
    border-color: #555;
    color: #e0e0e0; /* Icon color for dark mode */
}

.dark-mode-button:hover {
    background-color: #e0e0e0;
}

body.dark-mode .dark-mode-button:hover {
    background-color: #505050;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    cursor: pointer; /* Indicates it's interactive */
    transition: transform 0.3s ease-in-out; /* Smooth transition for animation */
}

.logo-favicon {
    width: 40px; /* Adjust size as needed */
    height: 40px; /* Adjust size as needed */
    margin-right: 10px;
}

h1 {
    color: #2c3e50; /* Dark blue-gray for headings */
    margin-top: 0; /* Adjusted margin due to new container */
    margin-bottom: 0; /* Adjusted margin due to new container */
    font-size: 2.2em; /* Slightly larger heading */
    /* Remove transition from h1 if it exists, animation will handle it */
}

/* Logo Animation Keyframes */
@keyframes wave {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    25% { transform: translateY(-3px) rotate(1deg); }
    50% { transform: translateY(0) rotate(-2deg); }
    75% { transform: translateY(-3px) rotate(1deg); }
}

@keyframes colorShift {
    0%, 100% { color: #ff6b35; } /* Red-Orange */
    33% { color: #f7931e; }    /* Orange */
    66% { color: #ffd23f; }    /* Yellow */
}

/* Updated Logo Animation */
.logo-container.logo-animate {
    /* transform: scale(1.05) rotate(-2deg); Example animation: slight scale and rotation */
    animation: wave 0.8s ease-in-out infinite;
}

/* Apply colorShift animation when h1 has .text-animate class */
h1.text-animate {
    animation: colorShift 1.5s linear infinite;
}

.input-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.input-section h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.url-input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#url-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

#url-input:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

.button {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
    background: linear-gradient(45deg, #e85a2b, #e8841a);
}

.customization-panel {
    margin-bottom: 10px;
    margin-top: 10px;
    margin-left: 5px;
    margin-right: 5px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.customization-panel h3 {
    color: #495057;

    font-size: 1.2rem;
}

.customization-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.form-group input,
.form-group select {
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.upload-area {
    border: 2px dashed #f7931e;
    padding: 30px;
    text-align: center;
    border-radius: 10px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.05), rgba(247, 147, 30, 0.05));
}

.upload-area:hover {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(247, 147, 30, 0.1));
    border-color: #ff6b35;
    transform: translateY(-2px);
}

.upload-area.dragover {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.15), rgba(247, 147, 30, 0.15));
    border-color: #ff6b35;
    transform: scale(1.02);
}

.upload-text {
    color: #6c757d;
    font-size: 16px;
    margin-bottom: 10px;
}

.upload-subtext {
    color: #adb5bd;
    font-size: 14px;
}

#file-input {
    display: none;
}

.qr-result {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qr-code-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    background: none;
    border-radius: 10px;
    box-shadow: none;
    margin-bottom: 20px;
    min-height: 0;
}

#qr-canvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

#download-btn {
    margin-top: 15px;
    font-size: 18px;
    padding: 15px 30px;
}

.preview-image {
    max-width: 100px;
    max-height: 100px;
    border-radius: 8px;
    margin-top: 10px;
    border: 2px solid #dee2e6;
}

.error-message {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

.success-message {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #ff6b35;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* Additional utility classes */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.generate-btn-loading {
    pointer-events: none;
    opacity: 0.7;
}

.generate-btn-loading::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid #ffd23f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

/* QR Code Preview Styles */
#qr-preview-section {
    margin-top: 25px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 210, 63, 0.1), rgba(247, 147, 30, 0.1));
    border-radius: 10px;
    border: 2px solid rgba(255, 210, 63, 0.3);
    text-align: center;
}

#qr-preview-section h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.qr-preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    background: #fff7e6;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.08);
    border: 2px solid #ffd23f;
    min-height: 0;
}

/* QR Code Live Preview Styles */
.qr-preview-section {
    margin: 0 auto 24px auto;
    padding: 16px 0 0 0;
    text-align: center;
}
.qr-preview-section h4 {
    color: #ff6b35;
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 700;
}
.qr-preview-container {
    display: inline-block;
    padding: 10px;
    background: #fff7e6;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.08);
    border: 2px solid #ffd23f;
}
#qr-preview-canvas {
    max-width: 120px;
    height: auto;
    border-radius: 8px;
    background: #fff;
}

/* Color Selector Styles */
.color-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    transition: border-color 0.3s ease;
}

.color-selector:hover {
    border-color: #ff6b35;
}

.color-selector input[type="color"] {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

.color-selector input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border: 2px solid #dee2e6;
    border-radius: 6px;
}

.color-selector input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-display {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 2px solid #dee2e6;
    background: #000000;
    transition: all 0.3s ease;
}

.color-value {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    min-width: 60px;
    text-align: center;
}

/* Size Button Styles */
.size-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.size-btn {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1), rgba(247, 147, 30, 0.1));
    border: 2px solid #f7931e;
    color: #333;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    min-width: 80px;
    line-height: 1.2;
}

.size-btn span {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #6c757d;
    margin-top: 2px;
}

.size-btn:hover {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(247, 147, 30, 0.2));
    border-color: #ff6b35;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.size-btn.active {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    border-color: #ff6b35;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.size-btn.active span {
    color: rgba(255, 255, 255, 0.9);
}

.size-btn.active:hover {
    background: linear-gradient(45deg, #e85a2b, #e8841a);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
}

/* Style Button Styles */
.style-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.style-btn {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.08), rgba(247, 147, 30, 0.08));
    border: 2px solid #ffd23f;
    color: #333;
    padding: 12px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    min-width: 80px;
    line-height: 1.2;
}

.style-btn:hover {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.18), rgba(247, 147, 30, 0.18));
    border-color: #ff6b35;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.18);
}

.style-btn.active {
    background: linear-gradient(45deg, #ff6b35, #ffd23f);
    border-color: #ff6b35;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.25);
}

.style-btn.active:hover {
    background: linear-gradient(45deg, #e85a2b, #ffd23f);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.35);
}

/* Dropdown for customization */
.customization-dropdown {
    margin-bottom: 30px;
    background: #fff7e6;
    border-radius: 12px;
    border: 2px solid #ffd23f;
    box-shadow: 0 2px 10px rgba(255, 107, 53, 0.07);
    padding: 0;
}
.customization-summary {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ff6b35;
    padding: 18px 30px;
    cursor: pointer;
    outline: none;
    background: linear-gradient(90deg, #ffd23f 0%, #ff6b35 100%);
    border-radius: 12px 12px 12px 12px;
    user-select: none;
}
.customization-dropdown[open] .customization-summary {
    border-bottom: 2px solid #ffd23f;
}
.customization-flex {
    display: flex;
}
.customization-flex .customization-panel {
    flex: 1 1 45%;
    max-width: 45%;
    box-sizing: border-box;
}
.image-panel {
    min-width: 320px;
    max-width: 100%;
    flex: 2 1 320px;
}

/* Ensure customization panels share space and don't overflow */
.customization-flex .customization-panel {
    flex: 1 1 300px;
    max-width: 100%;
    box-sizing: border-box;
}

/* Responsive for new layout */
@media (max-width: 900px) {
    .customization-flex {
        flex-direction: column;
        gap: 18px;
        padding: 18px 10px 10px 10px;
        flex-wrap: wrap;
    }
    .image-panel {
        max-width: 100%;
    }
}

/* Responsive improvements */
@media (max-width: 480px) {
    .form-group {
        min-width: 100%;
    }
    
    .button {
        width: 100%;
        margin-top: 10px;
    }
    
    .url-input-container {
        gap: 15px;
    }
    
    .size-buttons {
        justify-content: center;
    }
    
    .size-btn {
        min-width: 70px;
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .color-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px;
    }
    
    .customization-row {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
}

.clear-color-btn {
    background: #ffd23f;
    border: none;
    color: #ff6b35;
    font-size: 18px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    margin-left: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(255, 107, 53, 0.08);
}
.clear-color-btn:hover {
    background: #ff6b35;
    color: #fff;
}

/* Dark mode adjustments for various elements */
body.dark-mode h1 {
    color: #e0e0e0; /* Lighter heading for dark mode */
}

body.dark-mode .input-section,
body.dark-mode .customization-panel,
body.dark-mode .qr-result {
    background-color: #2a2a2a; /* Dark background for panels */
    border-color: #444; /* Darker border */
    color: #e0e0e0; /* Light text by default inside panels */
}

body.dark-mode .input-section h3,
body.dark-mode .customization-panel h3,
body.dark-mode .qr-result .button {
    color: #fff; /* Ensure headings and buttons text are white */
}

body.dark-mode .customization-summary {
    background: linear-gradient(90deg, #c7a00f 0%, #d65621 100%); /* Dark orange gradient */
    color: #ffffff; /* White text */
    border-color: #c7a00f !important;
}

body.dark-mode .customization-summary:hover {
    background: linear-gradient(90deg, #b38f00 0%, #cc5600 100%);
}

body.dark-mode .customization-dropdown[open] .customization-summary {
    border-bottom: 2px solid #c7a00f;
}

body.dark-mode .color-selector,
body.dark-mode .size-btn,
body.dark-mode .style-btn,
body.dark-mode .remove-image-btn {
    background-color: #3a3a3a;
    border-color: #555;
    color: #e0e0e0;
}

body.dark-mode .clear-color-btn {
    background-color: #505050;
    color: #ccc;
    border-color: #666;
}

body.dark-mode .clear-color-btn:hover {
    background-color: #606060;
    color: #fff;
}

body.dark-mode .dark-mode-button,
body.dark-mode .clear-color-btn,
body.dark-mode .remove-image-btn {
    /* ensure icons contrast */
}

/* Ensure inputs, selects, and text areas are styled in dark mode */
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background-color: #444;
    color: #e0e0e0;
    border-color: #555;
}

body.dark-mode #url-input,
body.dark-mode .color-value {
    background-color: #555;
    color: #ffffff;
    border-color: #666;
}

body.dark-mode h3,
body.dark-mode h4,
body.dark-mode label {
    color: #e0e0e0;
}

body.dark-mode .qr-preview-section {
    background-color: #333;
    border-color: #444;
}

/* Remove any empty ruleset */

/* Logo hover animation fallback */
.logo-container:hover {
    animation: wave 0.8s ease-in-out infinite;
}

.logo-container:hover h1 {
    animation: colorShift 1.5s linear infinite;
}

/* Image preview container in customization panel */
.image-panel #image-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.image-panel #image-preview img {
    max-width: 100px;
    max-height: 100px;
    border-radius: 8px;
    border: 2px solid #dee2e6;
    display: block;
}

/* Style for remove image button */
.remove-image-btn {
    background-color: #f7931e;
    color: white;
    border: none;
    font-size: 14px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s ease;
}

.remove-image-btn:hover {
    background-color: #e85a2b;
}
