:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #f3f4f6;
    --secondary-hover: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --background: #ffffff;
    --background-alt: #f9fafb;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 8px;
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    color: var(--text-primary);
    background-color: var(--background-alt);
    line-height: 1.5;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.app-header {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-color);
}

.logo svg {
    stroke: var(--primary-color);
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.app-content {
    padding: 1rem 0 3rem;
}

.step-container {
    background-color: var(--background);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    display: none;
}

.step-container.active {
    display: block;
}

.photo-input-options {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 768px) {
    .photo-input-options {
        flex-direction: row;
        align-items: stretch;
    }
}

.camera-container,
.upload-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.camera-frame {
    width: 100%;
    aspect-ratio: 4/3;
    background-color: #000;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
}

#camera {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider::before {
    margin-right: 0.5rem;
}

.divider::after {
    margin-left: 0.5rem;
}

@media (min-width: 768px) {
    .divider {
        flex-direction: column;
        padding: 0 1.5rem;
    }

    .divider::before,
    .divider::after {
        border-bottom: none;
        border-left: 1px solid var(--border-color);
        height: 100px;
        margin: 1rem 0;
    }
}

.upload-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    text-align: center;
    transition: var(--transition);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(99, 102, 241, 0.05);
}

.upload-area svg {
    stroke: var(--text-secondary);
    margin-bottom: 1rem;
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

#fileInput {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.875rem;
}

.primary-button {
    background-color: var(--primary-color);
    color: white;
}

.primary-button:hover {
    background-color: var(--primary-hover);
}

.secondary-button {
    background-color: var(--secondary-color);
    color: var(--text-primary);
}

.secondary-button:hover {
    background-color: var(--secondary-hover);
}

.preview-content,
.result-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.preview-image-container {
    width: 400px;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    background: #f8f8f8;
    border-radius: 12px;
    overflow: hidden;
}

.preview-image-container img,
#preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.result-image-container {
    width: 100%;
    max-height: 500px;
    border-radius: var(--radius);
    overflow: hidden;
    background-color: #000;
}

#result {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-actions,
.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    background-color: var(--background);
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Login Section Styles */
.login-container {
    display: flex;
    flex-direction: column; /* Stack header and main content vertically */
    align-items: center; /* Center login form horizontally */
    justify-content: flex-start; /* Align to top, header will push form down */
    min-height: 100vh;
    padding-top: 4rem; /* Add some padding from the top */
    box-sizing: border-box; /* Ensure padding is included in height calculation */
}

.login-container .app-header {
    width: 100%;
    max-width: 500px; /* Max width for header content */
    border-bottom: none; /* Remove border if not desired for login header */
    margin-bottom: 1rem; /* Space between header and login form */
    padding: 1rem; /* Adjust padding as needed */
}

.login-container .app-content {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0 1rem; /* Horizontal padding for smaller screens */
}

.login-form {
    background-color: var(--background);
    padding: 2.5rem 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px; /* Max width of the login form */
    text-align: center; /* Center the h2 */
}

.login-form h2 {
    margin-bottom: 1.5rem;
    font-size: 1.75rem; /* Slightly larger title for login */
    color: var(--text-primary);
}

.login-form input[type="email"],
.login-form input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    box-sizing: border-box;
}

.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.login-form .primary-button {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    margin-top: 0.5rem;
}

.error-message {
    color: #ef4444; /* Red color for errors */
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-top: 1rem;
    font-size: 0.875rem;
    text-align: left;
}

/* Ensure app-container which is hidden by default doesn't affect layout */
.app-container[style*="display: none"] {
    display: none !important; /* Override inline style if necessary for initial load */
}

/* Ensure login-container is visible if it's supposed to be */
#login-section[style*="display: block"] {
    display: flex !important; /* Ensure flex properties apply */
}

/* Add this to your JavaScript to handle section transitions */
/* 
  function showSection(sectionId) {
    document.querySelectorAll('.step-container').forEach(section => {
      section.classList.remove('active');
    });
    document.getElementById(sectionId).classList.add('active');
  }
  
  function showLoading(show) {
    const loader = document.getElementById('loading');
    if (show) {
      loader.classList.add('active');
    } else {
      loader.classList.remove('active');
    }
  }
  */