:root {
    --primary-color: #6a11cb; /* Deep Purple */
    --secondary-color: #2575fc; /* Bright Blue */
    --accent-color: #f7797d; /* Soft Pink/Coral */
    --gradient-start: var(--primary-color);
    --gradient-end: var(--secondary-color);
    --text-dark: #212529;
    --text-medium: #495057;
    --text-light: #adb5bd;
    --bg-light: #ffffff;
    --bg-medium: #f8f9fa;
    --bg-dark: #343a40;
    --border-color: #e9ecef;
    --success-color: #198754; /* Darker Green */
    --error-color: #dc3545; /* Standard Red */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
    --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --border-radius: 8px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-medium);
    margin: 0;
    padding-top: 80px; /* Adjust for new navbar height */
    color: var(--text-medium);
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 16px;
}

.main-content {
    flex: 1;
    padding: 30px 15px;
}

.container {
    width: 100%;
    max-width: 960px; /* Wider container for content */
    margin: 20px auto;
    padding: 0 15px; /* Padding managed by inner elements */
}

.card {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 25px;
    padding: 30px 35px;
    overflow: hidden; /* Contain child elements */
}

h1 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 2.2em;
    text-align: center;
}

.subtitle {
    color: var(--text-medium);
    margin-bottom: 40px;
    font-size: 1.15em;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Navbar --- */
.navbar {
    background: linear-gradient(90deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    box-shadow: var(--shadow-md);
    padding: 0 1rem;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1050;
    height: 70px; /* Slightly taller */
    transition: background 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.nav-logo {
    font-size: 1.8em;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.nav-logo span {
    opacity: 0.8;
    font-weight: 400;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
}

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

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 1em;
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.2s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #fff;
    opacity: 0;
    transition: width 0.3s ease, opacity 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: #fff;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
    opacity: 1;
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: var(--text-light);
    font-size: 0.9em;
    background-color: var(--bg-dark);
    color: rgba(255,255,255,0.6);
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    font-weight: 500;
    color: #fff;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    background-color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: var(--border-radius);
    transition: all 0.2s ease-in-out;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    filter: brightness(1.1);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(90deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    border: none;
}

.btn-secondary {
    background-color: var(--text-light);
    border-color: var(--text-light);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background-color: var(--text-medium);
    border-color: var(--text-medium);
    color: #fff;
}

.btn-large {
    padding: 0.8rem 1.8rem;
    font-size: 1.1rem;
}

.btn-small {
    padding: 0.35rem 0.8rem;
    font-size: 0.9rem;
}

button:disabled,
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    filter: grayscale(50%);
}

/* --- Forms & Options --- */
.options {
    text-align: left;
    padding: 2rem;
    background-color: var(--bg-light);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.options h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 1.4em;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.option-group {
    margin-bottom: 1.5rem;
    display: block;
}

.option-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.95rem;
}

.option-group .icon {
    margin-right: 8px;
    font-size: 1.1em;
    color: var(--primary-color);
    opacity: 0.9;
    min-width: 20px;
    text-align: center;
}

.option-group input[type="text"],
.option-group input[type="password"],
.option-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background-color: var(--bg-light);
}

.option-group input[type="text"]:hover,
.option-group input[type="password"]:hover,
.option-group select:hover {
    border-color: var(--text-light);
}

.option-group input[type="text"]:focus,
.option-group input[type="password"]:focus,
.option-group select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.1);
}

.option-group input[type="text"]::placeholder,
.option-group input[type="password"]::placeholder {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Checkbox styling */
.checkbox-group {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-medium);
    transition: all 0.2s ease;
    cursor: pointer;
}

.checkbox-group:hover {
    border-color: var(--text-light);
    background-color: var(--bg-light);
}

.checkbox-group.checked {
    border-color: var(--primary-color);
    background-color: rgba(106, 17, 203, 0.05);
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.75rem;
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-dark);
    -webkit-user-select: none;
    user-select: none;
    display: flex;
    align-items: center;
}

/* --- Upload Area --- */
.upload-area {
    border: 2px dashed var(--text-light);
    border-radius: var(--border-radius);
    padding: 60px 30px;
    margin-bottom: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: var(--bg-medium);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '☁️';
    font-size: 3em;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.1;
    transition: all 0.3s ease;
}

.upload-area.dragover {
    background-color: rgba(106, 17, 203, 0.05);
    border-color: var(--primary-color);
    border-style: solid;
}

.upload-area.dragover::before {
     transform: translateX(-50%) scale(1.2);
     opacity: 0.3;
}

.upload-area p {
    margin: 0;
    color: var(--text-medium);
    font-size: 1.2em;
    font-weight: 500;
    text-align: center;
    position: relative; /* Keep text above ::before */
    z-index: 1;
}

/* --- Preview Area --- */
.preview-area {
    width: 100%; /* Ensure it takes available width */
    margin-bottom: 30px;
    text-align: center;
    display: flex; /* Use flexbox */
    flex-direction: column; /* Stack image and button vertically */
    align-items: center; /* Ensure horizontal centering */
}

.preview-area img {
    max-width: 100%; /* Keep max width */
    height: auto; /* Maintain aspect ratio */
    max-height: 60vh; /* Limit height based on viewport */
    margin-bottom: 20px; /* More space before button */
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    display: block;
    margin-left: auto; /* Explicitly center */
    margin-right: auto; /* Explicitly center */
}

.preview-area .btn {
    margin-top: 0;
    /* Centering is handled by align-items on the flex container */
}

/* --- Progress Area --- */
.progress-area {
    margin: 30px 0;
    text-align: center;
    color: var(--text-medium);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    border-radius: 4px;
    transition: width 0.3s ease-out;
}

/* --- Result Area --- */
.result-area {
    background-color: var(--bg-light);
    border-color: var(--success-color);
    text-align: center;
    border-width: 2px;
    border-style: solid;
    padding: 25px;
}

.result-area h2 {
    color: var(--success-color);
    margin-bottom: 20px;
    font-weight: 600;
}

.url-container {
    display: flex;
    align-items: center;
    margin: 20px 0;
}

.url-container input[type="text"] {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px 0 0 6px;
    margin-right: -1px;
    background-color: var(--bg-medium);
    font-size: 1em;
    color: var(--text-dark);
}

.url-container .btn {
    border-radius: 0 6px 6px 0;
}

.copy-status {
    margin-top: 10px;
    font-size: 0.95em;
    height: 1.3em;
    font-weight: 500;
}

/* --- Error Area --- */
.error-area {
     background-color: rgba(220, 53, 69, 0.1);
     border-color: var(--error-color);
     color: var(--error-color);
     text-align: center;
     font-weight: 500;
     padding: 15px 20px;
}

/* --- View Page Specific --- */
.view-container {
     padding: 15px 15px 30px 15px; /* Reduced top padding */
     text-align: center; /* Keep text-align for potential inline text */
     display: flex; /* Use Flexbox */
     flex-direction: column; /* Stack items vertically */
     align-items: center; /* Ensure this is set */
}

.view-container h1 {
    margin-bottom: 30px;
}

.view-container img.image-display {
    max-width: 100%;
    max-height: 75vh;
    margin-bottom: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    cursor: zoom-in;
    display: block; /* Ensure block behavior */
    margin-left: auto;
    margin-right: auto;
}

.password-form {
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.password-form h1 {
    font-size: 1.6em;
    margin-bottom: 15px;
}

.actions {
    margin-top: 25px;
    padding: 20px;
    background-color: var(--bg-medium);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    vertical-align: top;
    box-shadow: var(--shadow-sm);
    width: auto; /* Allow it to size based on content */
    max-width: 90%; /* Prevent overflow on small screens */
}

.actions p {
    margin-bottom: 12px;
    display: flex; /* Align items in action rows */
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.actions p:last-child {
    margin-bottom: 0;
}

.actions strong {
    color: var(--text-dark);
    margin-right: 8px;
}

.actions p .icon {
    margin-right: 6px; /* Space for icons in action lines */
    font-size: 1.1em;
    opacity: 0.7;
}

.actions #view-count {
    font-weight: 600;
    color: var(--text-dark);
    margin-left: 4px;
}

.actions .url-container {
     margin: 0; /* Remove default margin */
     width: 100%;
     max-width: 400px; /* Limit width of URL input */
     margin-top: 5px;
}

.actions .url-container input[type="text"] {
    /* Inherits base input styles, add cursor */
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.actions .url-container input[type="text"]:hover {
    background-color: #f0f0f0; /* Slight hover effect */
}

.back-link {
    margin-top: 30px;
    font-size: 1em;
}

.back-link a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

.back-link a:hover {
    text-decoration: underline;
}

/* --- Public Gallery --- */
.gallery-container h1 {
    margin-bottom: 10px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.gallery-item {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: var(--bg-light);
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease-in-out, box-shadow 0.25s ease-in-out;
    text-decoration: none;
    color: inherit;
    display: flex; /* Use flex for layout */
    flex-direction: column;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid var(--border-color);
    cursor: zoom-in;
}

.gallery-item-info {
    padding: 12px 15px;
    font-size: 0.9em;
    color: var(--text-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: auto; /* Push info to bottom */
}

.gallery-item-info a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.gallery-item-info a:hover {
    text-decoration: underline;
}

.no-images {
    text-align: center;
    margin-top: 60px;
    color: var(--text-light);
    font-size: 1.1em;
}

/* --- Features Section --- */
.features-section {
    background: var(--bg-medium); /* Use medium background */
    padding: 70px 0 80px 0;
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
    /* Removed bottom border */
}

.features-section h2 {
    text-align: center;
    margin-bottom: 60px; /* More space */
    font-size: 2.4em; /* Slightly larger title */
    font-weight: 600;
    color: var(--text-dark);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Slightly wider min width */
    gap: 40px;
}

.feature-item {
    background-color: var(--bg-light);
    padding: 35px 30px;
    border-radius: var(--border-radius);
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

/* Subtle gradient overlay effect on hover */
.feature-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-item:hover::after {
     opacity: 1;
}

.feature-icon {
    font-size: 2.8em;
    margin-bottom: 20px;
    line-height: 1;
    color: var(--primary-color); /* Use primary color for icons */
    /* background: -webkit-linear-gradient(var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent; */ /* Optional: Gradient Icons */
}

.feature-item h3 {
    margin-bottom: 15px;
    font-size: 1.4em;
    color: var(--text-dark);
    font-weight: 600;
}

.feature-item p {
    color: var(--text-medium);
    font-size: 1em;
    line-height: 1.7; /* Increased line-height for readability */
}

/* --- Scroll Animations --- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animation delay */
.features-grid > * { transition-duration: 0.5s; }
.features-grid > *:nth-child(1) { transition-delay: 0.05s; }
.features-grid > *:nth-child(2) { transition-delay: 0.1s; }
.features-grid > *:nth-child(3) { transition-delay: 0.15s; }
.features-grid > *:nth-child(4) { transition-delay: 0.2s; }
.features-grid > *:nth-child(5) { transition-delay: 0.25s; }
.features-grid > *:nth-child(6) { transition-delay: 0.3s; }

/* --- Lightbox --- */
.lightbox {
    display: none;
    position: fixed;
    z-index: 2000; /* Highest */
    padding: 20px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(33, 37, 41, 0.92); /* Darker overlay */
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 95%;
    max-height: 90vh;
    animation: zoomIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bounce effect */
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

@keyframes zoomIn {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

#lightbox-caption {
    display: none; /* Hide the caption element entirely */
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: rgba(255,255,255,0.7);
    font-size: 45px;
    font-weight: 300; /* Lighter close button */
    transition: 0.3s ease;
    cursor: pointer;
    line-height: 1;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #fff;
    transform: scale(1.1);
}

/* Add cursor for clickable images */
.lightbox-trigger {
    cursor: zoom-in;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .container {
        max-width: 95%;
    }
    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 70px;
        font-size: 15px;
    }
    h1 { font-size: 2em; }
    .subtitle { font-size: 1.1em; margin-bottom: 30px; }
    .card { padding: 25px 20px; }
    .upload-area { padding: 50px 20px; }
    .features-section { padding: 40px 0; }
    .option-group {
        flex-direction: column;
        align-items: stretch;
    }
    .option-group label {
        flex-basis: auto;
        margin-bottom: 10px;
        margin-right: 0;
    }
    .option-group input[type="password"],
    .option-group select {
        width: 100%;
    }
    .nav-container {
        padding: 0 15px;
    }
    .nav-item { margin-left: 1rem; }
}

@media (max-width: 576px) {
    .nav-menu {
        /* Could implement a toggle menu here */
        display: none;
    }
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }
    .gallery-item img {
        height: 150px;
    }
    .lightbox-content { max-width: 100%; max-height: 80vh; }
    .lightbox-close { font-size: 35px; top: 15px; right: 20px; }
}

.qr-code-container {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.qr-code-container p strong {
    color: var(--text-dark);
    margin-bottom: 10px; /* Space between label and QR */
    display: block; /* Make label take full width */
}

.qr-code-img {
    display: block; /* Center image */
    margin: 0 auto;
    max-width: 150px; /* Limit QR size */
    border: 1px solid var(--border-color);
    padding: 5px; /* Small padding */
    background-color: var(--bg-light);
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
}

/* --- Authentication Pages (Login/Register) --- */
.auth-container {
    max-width: 450px;
    margin: 3rem auto; /* More top/bottom margin */
    padding: 2.5rem; /* Increase padding */
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 2.5rem; /* More space below title */
    color: var(--primary-color);
    font-weight: 600;
}

/* Use Flexbox for form group alignment */
.auth-container .form-group {
    display: flex;
    align-items: center; /* Vertically center label/input */
    gap: 10px; /* Space between label and input */
    margin-bottom: 1.8rem; /* Slightly more space between fields */
}

.auth-container .form-group label {
    flex: 0 0 110px; /* Fixed width for label+icon, prevent shrinking */
    display: flex;
    align-items: center;
    gap: 8px; /* Space between icon and text */
    font-weight: 500;
    color: var(--text-medium);
    margin-bottom: 0; /* Remove default margin */
}

.auth-container .form-group label .icon {
    font-size: 1.3em; /* Slightly larger icons */
    color: var(--primary-color);
    opacity: 0.8;
    width: 20px; /* Ensure icon width */
    text-align: center;
    /* Removed margin-right as gap is used */
}

.auth-container .form-group input[type="text"],
.auth-container .form-group input[type="password"] {
    flex-grow: 1; /* Allow input to take remaining space */
    padding: 12px 15px; /* Adjust padding if needed */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.auth-container .form-group input:focus {
     border-color: var(--primary-color);
     outline: 0;
     box-shadow: 0 0 0 0.2rem rgba(106, 17, 203, 0.2);
}


.auth-container .btn-primary {
    width: 100%;
    padding: 0.9rem;
    margin-top: 1.5rem; /* More space above button */
    font-size: 1.1em;
}

.auth-switch {
    text-align: center;
    margin-top: 2rem; /* More space above switch link */
    font-size: 0.95rem;
    color: var(--text-medium);
}

.auth-switch a {
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: underline;
}

.auth-switch a:hover {
    color: var(--secondary-color);
}

/* --- Flash Messages --- */
.flash-container {
    /* Container defined in base.html for positioning */
    padding-top: 1rem; /* Add some space if messages appear */
    padding-bottom: 0; /* Reset bottom padding */
}

.flash-messages {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 5px;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.close-alert {
    position: absolute;
    top: 50%;
    right: 1.25rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    color: inherit; /* Inherit color from parent alert */
    opacity: 0.6;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.close-alert:hover {
    opacity: 0.9;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
    }
    .nav-menu {
        margin-top: 1rem;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    .nav-item {
        margin-left: 0;
        margin-bottom: 0.5rem;
        width: 100%;
    }
    .nav-link {
        display: block;
        padding: 0.5rem 0;
    }
    .nav-link::after {
        display: none; /* Disable underline on mobile */
    }
    .user-greeting {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    .result-details {
        flex-direction: column;
        align-items: center;
    }
    .result-url-section,
    .result-qr-section {
        flex-basis: auto;
        width: 100%;
        max-width: 400px; /* Limit width on mobile */
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 15px;
    }
    .card {
        padding: 1.5rem;
    }
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    .upload-area {
        padding: 2rem;
    }
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    .gallery-item img {
        height: 150px;
    }
}

.qr-code-container {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.qr-code-container p strong {
    color: var(--text-dark);
    margin-bottom: 10px; /* Space between label and QR */
    display: block; /* Make label take full width */
}

.qr-code-img {
    display: block; /* Center image */
    margin: 0 auto;
    max-width: 150px; /* Limit QR size */
    border: 1px solid var(--border-color);
    padding: 5px; /* Small padding */
    background-color: var(--bg-light);
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
}

/* --- Authentication Pages (Login/Register) --- */
.auth-container {
    max-width: 450px;
    margin: 3rem auto; /* More top/bottom margin */
    padding: 2.5rem; /* Increase padding */
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 2.5rem; /* More space below title */
    color: var(--primary-color);
    font-weight: 600;
}

/* Use Flexbox for form group alignment */
.auth-container .form-group {
    display: flex;
    align-items: center; /* Vertically center label/input */
    gap: 10px; /* Space between label and input */
    margin-bottom: 1.8rem; /* Slightly more space between fields */
}

.auth-container .form-group label {
    flex: 0 0 110px; /* Fixed width for label+icon, prevent shrinking */
    display: flex;
    align-items: center;
    gap: 8px; /* Space between icon and text */
    font-weight: 500;
    color: var(--text-medium);
    margin-bottom: 0; /* Remove default margin */
}

.auth-container .form-group label .icon {
    font-size: 1.3em; /* Slightly larger icons */
    color: var(--primary-color);
    opacity: 0.8;
    width: 20px; /* Ensure icon width */
    text-align: center;
    /* Removed margin-right as gap is used */
}

.auth-container .form-group input[type="text"],
.auth-container .form-group input[type="password"] {
    flex-grow: 1; /* Allow input to take remaining space */
    padding: 12px 15px; /* Adjust padding if needed */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.auth-container .form-group input:focus {
     border-color: var(--primary-color);
     outline: 0;
     box-shadow: 0 0 0 0.2rem rgba(106, 17, 203, 0.2);
}


.auth-container .btn-primary {
    width: 100%;
    padding: 0.9rem;
    margin-top: 1.5rem; /* More space above button */
    font-size: 1.1em;
}

.auth-switch {
    text-align: center;
    margin-top: 2rem; /* More space above switch link */
    font-size: 0.95rem;
    color: var(--text-medium);
}

.auth-switch a {
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: underline;
}

.auth-switch a:hover {
    color: var(--secondary-color);
}

/* --- Flash Messages --- */
.flash-container {
    /* Container defined in base.html for positioning */
    padding-top: 1rem; /* Add some space if messages appear */
    padding-bottom: 0; /* Reset bottom padding */
}

.flash-messages {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 5px;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.close-alert {
    position: absolute;
    top: 50%;
    right: 1.25rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    color: inherit; /* Inherit color from parent alert */
    opacity: 0.6;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.close-alert:hover {
    opacity: 0.9;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
    }
    .nav-menu {
        margin-top: 1rem;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    .nav-item {
        margin-left: 0;
        margin-bottom: 0.5rem;
        width: 100%;
    }
    .nav-link {
        display: block;
        padding: 0.5rem 0;
    }
    .nav-link::after {
        display: none; /* Disable underline on mobile */
    }
    .user-greeting {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    .result-details {
        flex-direction: column;
        align-items: center;
    }
    .result-url-section,
    .result-qr-section {
        flex-basis: auto;
        width: 100%;
        max-width: 400px; /* Limit width on mobile */
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 15px;
    }
    .card {
        padding: 1.5rem;
    }
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    .upload-area {
        padding: 2rem;
    }
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    .gallery-item img {
        height: 150px;
    }
}

.qr-code-container {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.qr-code-container p strong {
    color: var(--text-dark);
    margin-bottom: 10px; /* Space between label and QR */
    display: block; /* Make label take full width */
}

.qr-code-img {
    display: block; /* Center image */
    margin: 0 auto;
    max-width: 150px; /* Limit QR size */
    border: 1px solid var(--border-color);
    padding: 5px; /* Small padding */
    background-color: var(--bg-light);
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
}

/* --- Authentication Pages (Login/Register) --- */
.auth-container {
    max-width: 450px;
    margin: 3rem auto; /* More top/bottom margin */
    padding: 2.5rem; /* Increase padding */
}

.auth-container h2 {
    text-align: center;
    margin-bottom: 2.5rem; /* More space below title */
    color: var(--primary-color);
    font-weight: 600;
}

/* Use Flexbox for form group alignment */
.auth-container .form-group {
    display: flex;
    align-items: center; /* Vertically center label/input */
    gap: 10px; /* Space between label and input */
    margin-bottom: 1.8rem; /* Slightly more space between fields */
}

.auth-container .form-group label {
    flex: 0 0 110px; /* Fixed width for label+icon, prevent shrinking */
    display: flex;
    align-items: center;
    gap: 8px; /* Space between icon and text */
    font-weight: 500;
    color: var(--text-medium);
    margin-bottom: 0; /* Remove default margin */
}

.auth-container .form-group label .icon {
    font-size: 1.3em; /* Slightly larger icons */
    color: var(--primary-color);
    opacity: 0.8;
    width: 20px; /* Ensure icon width */
    text-align: center;
    /* Removed margin-right as gap is used */
}

.auth-container .form-group input[type="text"],
.auth-container .form-group input[type="password"] {
    flex-grow: 1; /* Allow input to take remaining space */
    padding: 12px 15px; /* Adjust padding if needed */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.auth-container .form-group input:focus {
     border-color: var(--primary-color);
     outline: 0;
     box-shadow: 0 0 0 0.2rem rgba(106, 17, 203, 0.2);
}


.auth-container .btn-primary {
    width: 100%;
    padding: 0.9rem;
    margin-top: 1.5rem; /* More space above button */
    font-size: 1.1em;
}

.auth-switch {
    text-align: center;
    margin-top: 2rem; /* More space above switch link */
    font-size: 0.95rem;
    color: var(--text-medium);
}

.auth-switch a {
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: underline;
}

.auth-switch a:hover {
    color: var(--secondary-color);
}

/* --- Flash Messages --- */
.flash-container {
    /* Container defined in base.html for positioning */
    padding-top: 1rem; /* Add some space if messages appear */
    padding-bottom: 0; /* Reset bottom padding */
}

.flash-messages {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 5px;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.close-alert {
    position: absolute;
    top: 50%;
    right: 1.25rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    color: inherit; /* Inherit color from parent alert */
    opacity: 0.6;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.close-alert:hover {
    opacity: 0.9;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
    }
    .nav-menu {
        margin-top: 1rem;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    .nav-item {
        margin-left: 0;
        margin-bottom: 0.5rem;
        width: 100%;
    }
    .nav-link {
        display: block;
        padding: 0.5rem 0;
    }
    .nav-link::after {
        display: none; /* Disable underline on mobile */
    }
    .user-greeting {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    .result-details {
        flex-direction: column;
        align-items: center;
    }
    .result-url-section,
    .result-qr-section {
        flex-basis: auto;
        width: 100%;
        max-width: 400px; /* Limit width on mobile */
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 15px;
    }
    .card {
        padding: 1.5rem;
    }
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    .upload-area {
        padding: 2rem;
    }
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    .gallery-item img {
        height: 150px;
    }
} 
/* Image Editor Styles (Temporarily Disabled) */
/*
.preview-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.editor-area {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.editor-container {
    background-color: var(--bg-light);
    border-radius: 8px;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.editor-header h2 {
    margin: 0;
    color: var(--text-dark);
}

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-medium);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-close:hover {
    background-color: var(--bg-medium);
}

.editor-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.editor-canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: #1a1a1a;
    position: relative;
    min-height: 400px;
    overflow: auto;
}

#editor-canvas {
    cursor: move;
    display: block;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.editor-controls {
    width: 300px;
    padding: 20px;
    background-color: var(--bg-medium);
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
}

.control-group {
    margin-bottom: 25px;
}

.control-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-dark);
}

.aspect-ratio-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 8px;
}

.aspect-btn {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-light);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    color: var(--text-medium);
}

.aspect-btn:hover {
    background-color: var(--bg-white);
    border-color: var(--primary-color);
}

.aspect-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.rotation-buttons {
    display: flex;
    gap: 10px;
}

.rotate-btn {
    flex: 1;
    font-size: 1.1rem;
}


.help-text {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.4;
    margin: 0;
}

.editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-light);
}

/* Responsive design for editor */
@media (max-width: 768px) {
    .editor-main {
        flex-direction: column;
    }
    
    .editor-controls {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
    
    .editor-canvas-wrapper {
        min-height: 300px;
    }
    
    .aspect-ratio-buttons {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
}
*/

/* Mobile responsive styles for upload options */
@media (max-width: 576px) {
    .options {
        padding: 1.5rem;
    }
    
    .options h2 {
        font-size: 1.2em;
        margin-bottom: 1.5rem;
    }
    
    .option-group {
        margin-bottom: 1.25rem;
    }
    
    .option-group label {
        font-size: 0.9rem;
    }
    
    .option-group input[type="text"],
    .option-group input[type="password"],
    .option-group select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem 1rem;
    }
    
    .checkbox-group {
        padding: 1rem;
    }
}

