:root {
    --primary: 0 0 0; /* #000000 */
    --secondary: 128 128 128; /* #808080 */
    --scan-color: 37 99 235; /* #2563EB - Blau für Scanfeld */
    --success: 34 197 94; /* #22C55E */
    --error: 220 38 127; /* #DC267F */
    --background: 255 255 255; /* #FFFFFF */
    --surface: 255 255 255; /* #FFFFFF */
    --text: 0 0 0; /* #000000 */
    --text-secondary: 128 128 128; /* #808080 */
    --border: 224 224 224; /* #E0E0E0 */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: #000000;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 8px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 10px;
    padding: 10px 0;
    flex-shrink: 0;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #000000;
    margin-bottom: 5px;
}

header h1 i {
    margin-right: 8px;
}

header p {
    color: #808080;
    font-size: 0.85rem;
    font-weight: 400;
}

.scanner-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.camera-section {
    position: relative;
    padding: 12px; /* Increased padding */
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 20; /* Increased flex value to make it larger */
    min-height: 0;
}

#video {
    width: 50%;
    max-width: 320px;
    height: 500px;
    max-height: 500px;
    border-radius: 6px;
    background: #f5f5f5;
    display: none;
    border: 1px solid #e0e0e0;
    object-fit: cover;
}

.scanning-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    pointer-events: none;
    display: none;
    z-index: 10;
}

.scan-frame {
    position: relative;
    width: 100%;
    height: 100%;
    border: 2px solid #24eb4b;
    border-radius: 12px;
}



.corner.top-left {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
}

.corner.top-right {
    top: -3px;
    right: -3px;
    border-left: none;
    border-bottom: none;
}

.corner.bottom-left {
    bottom: -3px;
    left: -3px;
    border-right: none;
    border-top: none;
}

.corner.bottom-right {
    bottom: -3px;
    right: -3px;
    border-left: none;
    border-top: none;
}

.camera-controls {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.btn {
    padding: 12px 20px;
    border: 2px solid #000000;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    min-height: 44px;
    min-width: 120px;
    justify-content: center;
}

.btn-primary {
    background: #000000;
    color: white;
    border: 2px solid #000000;
}

.btn-primary:hover {
    background: #333333;
    border: 2px solid #333333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: white;
    color: #808080;
    border: 2px solid #808080;
}

.btn-secondary:hover {
    background: #808080;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-copy {
    background: #22c55e;
    color: white;
    font-size: 0.9rem;
    padding: 10px 18px;
    border: 2px solid #22c55e;
    min-height: 40px;
    min-width: 100px;
}

.btn-copy:hover {
    background: #16a34a;
    border: 2px solid #16a34a;
    transform: translateY(-1px);
}

.result-section {
    border-top: 1px solid #d4d4d4;
    padding: 12px;
    flex-shrink: 0;
    min-height: 120px;
    max-height: 50vh;
    overflow-y: auto;
}

.status {
    text-align: center;
    padding: 12px;
    color: #808080;
    font-size: 0.95rem;
}

.status i {
    margin-right: 8px;
    color: #000000;
}

.result {
    text-align: center;
}

.result h3 {
    color: #22c55e;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.result h3 i {
    margin-right: 8px;
}

.result-content {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: left;
}

.result-content label {
    font-weight: 600;
    color: #808080;
    display: block;
    margin-bottom: 50px;
    font-size: 0.9rem;
}

.qr-content {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    word-break: break-all;
    min-height: 40px;
    font-family: monospace;
    font-size: 0.85rem;
    color: #000000;
    line-height: 1.4;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    color: #dc2626;
}

.error i {
    margin-right: 8px;
    font-size: 1.2rem;
}



/* iPhone und Mobile Optimierungen */
@media (max-width: 500px) {
    body {
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
        height: 100vh;
        overflow: hidden;
    }
    
    .container {
        padding: 3px;
        height: 100vh;
        max-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    header {
        margin-bottom: 5px;
        padding: 3px 0;
        flex-shrink: 0;
    }
    
    header h1 {
        font-size: 1.2rem;
        margin: 0;
    }
    
    header p {
        font-size: 0.7rem;
        margin: 2px 0 0 0;
    }
    
    .scanner-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }
    
    .camera-section {
        padding: 3px;
        flex-shrink: 0;
    }
    
    #video {
        max-width: 100%;
        max-height: 140px;
        border-radius: 4px;
    }
    
    .camera-controls {
        flex-direction: row;
        justify-content: center;
        gap: 4px;
        margin-top: 5px;
        flex-wrap: wrap;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 0.7rem;
        min-height: 34px;
        min-width: 85px;
        flex: 0 0 auto;
    }
    
    .scanning-overlay {
        width: 100px;
        height: 100px;
    }
    
    .result-section {
        padding: 5px;
        flex: 20;
        min-height: 0;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }
    
    .status {
        padding: 5px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }
    
    .result {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }
    
    .result-content {
        padding: 8px;
        margin-bottom: 6px;
    }
    
    .qr-content {
        padding: 6px;
        font-size: 0.7rem;
        min-height: 25px;
        line-height: 1.2;
        max-height: 120px;
        overflow-y: auto;
        word-break: break-all;
    }
    
    .result h3 {
        font-size: 0.9rem;
        margin: 0 0 6px 0;
    }
    
    .result-content label {
        font-size: 0.7rem;
        margin-bottom: 3px;
    }
}

/* Alle mobilen Geräte */
@media (max-width: 768px) {
    .result-actions {
        gap: 8px;
        margin-top: 8px;
    }
    
    .result-actions .btn {
        padding: 6px 10px;
        font-size: 0.7rem;
        min-height: 32px;
        min-width: 70px;
    }
}

/* Ultra kompakt für kleine iPhones */
@media (max-width: 480px) and (max-height: 800px) {
    .container {
        padding: 2px;
    }
    
    header h1 {
        font-size: 1.1rem;
    }
    
    .camera-section {
        padding: 2px;
    }
    
    #video {
        max-height: 120px;
    }
    
    .btn {
        padding: 6px 10px;
        font-size: 0.65rem;
        min-height: 30px;
        min-width: 90px;
    }
    
    .camera-controls {
        gap: 3px;
        margin-top: 5px;
    }
    
    .scanning-overlay {
        width: 100px;
        height: 100px;
    }
    
    .result-section {
        padding: 5px;
        max-height: 25vh;
    }
    
    .status {
        padding: 5px;
        font-size: 0.8rem;
    }
}

/* Animation for scanning */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

.scanning .scan-frame {
    animation: pulse 2s infinite;
}

/* Loading states */
.loading {
    opacity: 0.7;
    pointer-events: none;
}
