:root {
    --primary-color: #ff6600;
    --primary-hover: #cc5200;
    --container-padding: clamp(20px, 5vw, 40px);
}

/* Grundlegende Styles für mobile Geräte */
body {
    margin: 0;
    padding: 0;
    background: url('background.jpg') no-repeat center center fixed;
    background-size: cover;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: white;
    text-align: center;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    width: 100%;
    overflow-x: hidden; /* Verhindert horizontales Scrollen */
}

.container {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: var(--container-padding);
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    box-sizing: border-box; /* Wichtig: Padding wird in die Breite eingerechnet */
}

h1 {
    font-size: clamp(24px, 5vw, 32px);
    margin-bottom: 20px;
    font-weight: 700;
}

.info-text {
    font-size: clamp(14px, 4vw, 16px);
    line-height: 1.5;
    margin-bottom: 25px;
    color: rgba(255, 255, 255, 0.9);
}

/* Kamera-Container Styles */
#cameraContainer {
    position: relative;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 3/4;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin: 0 auto 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box; /* Wichtig: Padding wird in die Breite eingerechnet */
}

#cameraPreview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #222;
    display: block;
}

.circle-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.camera-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    z-index: 10;
    width: 100%;
}

.camera-button {
    background: rgba(36, 152, 236, 0.9);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 28px;
    cursor: pointer;
    z-index: 3;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

#captureButton {
    background: rgba(236, 36, 36, 0.9);
    padding: 15px 30px;
    font-size: 18px;
}

.camera-button:active {
    background: #1b76be;
    transform: scale(0.95);
}

#captureButton:active {
    background: #c41e1e;
}

/* Für bessere Sichtbarkeit auf mobilen Geräten */
@media (max-width: 768px) {
    .camera-controls {
        bottom: 30px;
    }
    
    .camera-button {
        padding: 14px 20px;
        font-size: 15px;
    }
    
    #captureButton {
        padding: 16px 28px;
        font-size: 16px;
    }
}

/* Bestehende Styles für Upload-Form */
#uploadForm {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.file-upload-container {
    position: relative;
    margin: 20px 0;
}

.file-upload-button {
    display: block;
    width: 80%;
    max-width: 300px;
    margin: 10px auto;
    padding: 15px 20px;
    background-color: #4285f4;
    color: white;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    border: none;
    -webkit-tap-highlight-color: transparent;
}

.file-upload-button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* Verstecke den nativen Datei-Input */
input[type="file"] {
    display: none;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 15px;
    width: 100%;
    cursor: pointer;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 102, 0, 0.7);
    }
    
    70% {
        transform: scale(1.02);
        box-shadow: 0 0 0 10px rgba(255, 102, 0, 0);
    }
    
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 102, 0, 0);
    }
}

button[type="submit"]:not(:disabled) {
    animation: pulse 2s infinite;
}

/* Bestehende hover-Effekte überschreiben */
button[type="submit"]:not(:disabled):hover {
    background-color: var(--primary-hover);
    transform: scale(1.05);
    animation: none;
}

#previewContainer {
    position: relative;
    text-align: center;
}

.image-zoom-container {
    margin-top: 20px;
    position: relative;
    width: 100%;
    max-height: calc(100vh - 200px);
    overflow: auto; /* Erlaubt Scrollen */
}

#uploadedImage {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Buttons über dem Bild */
.save-button,
.restart-button {
    position: relative;
    z-index: 2;
    margin: 10px 5px;
}

.save-button {
    background: #2ecc71;
}

.save-button:hover {
    background: #27ae60;
}

.restart-button {
    background: #3498db;
}

.restart-button:hover {
    background: #2980b9;
}

/* Mobile Optimierungen */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .container {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        padding: 15px;
    }
    
    #cameraContainer {
        width: 100%;
        border-radius: 0;
        margin: 0 0 15px 0;
    }
    
    button {
        padding: 12px;
        font-size: 15px;
    }
    
    .save-button,
    .restart-button {
        width: calc(100% - 20px); /* Volle Breite minus Margins */
        margin: 5px 10px; /* Kleinere Margins auf Mobile */
    }
}

/* iOS-spezifische Anpassungen */
@supports (-webkit-touch-callout: none) {
    .container {
        margin-bottom: 40px; /* Extra Abstand für iOS-Navigation */
    }
}

#loadingContainer {
    text-align: center;
    padding: 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    margin: 0 auto 20px;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    margin-bottom: 15px;
    font-size: 16px;
}

.loading-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    animation: progress 3s ease-in-out forwards;
}

@keyframes progress {
    0% { width: 0%; }
    20% { width: 20%; }
    50% { width: 60%; }
    80% { width: 80%; }
    100% { width: 95%; }
}

.warning-text {
    color: #e74c3c;
    margin-top: 15px;
    padding: 10px;
    background-color: rgba(231, 76, 60, 0.1);
    border-radius: 5px;
    font-size: 14px;
    text-align: center;
}

/* Kamera-Overlay Styles */
#cameraContainer {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto 20px;
    overflow: hidden;
    background-color: #000;
}

#cameraPreview {
    width: 100%;
    height: auto;
    display: block;
    transform: scaleX(-1); /* Spiegelt die Kamera horizontal */
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2;
    pointer-events: none;
}

.circle-cutout {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 90vmin; /* Verwende vmin für responsive Kreise */
    height: 90vmin;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);
    pointer-events: none;
}

.capture-button {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    background-color: #ff4d4d;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 16px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.capture-button:hover {
    background-color: var(--primary-hover);
}
