* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    color: #333;
    -webkit-tap-highlight-color: transparent;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 20px);
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

header h1 {
    font-size: 24px;
    margin-bottom: 15px;
    font-weight: 600;
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    touch-action: manipulation;
    user-select: none;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: #4CAF50;
    color: white;
    flex: 1;
    max-width: 200px;
}

.btn-primary:hover {
    background: #45a049;
}

.btn-primary.stop {
    background: #f44336;
}

.btn-primary.stop:hover {
    background: #da190b;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-success {
    background: #2196F3;
    color: white;
    width: 100%;
    margin-top: 10px;
}

.btn-success:hover {
    background: #0b7dda;
}

.camera-container {
    position: relative;
    width: 100%;
    flex: 1;
    background: #000;
    overflow: hidden;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Ayna efekti kaldırıldı - doğal görüntü */
}

#canvas {
    display: none;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.scan-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 300px;
    height: 200px;
    border: 3px solid #4CAF50;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.scan-line {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 300px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #4CAF50, transparent);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0%, 100% {
        transform: translate(-50%, -100px);
    }
    50% {
        transform: translate(-50%, 100px);
    }
}

.focus-indicator {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 3px solid #fff;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    transform: translate(-50%, -50%);
}

.focus-indicator.active {
    opacity: 1;
    animation: focusPulse 0.6s ease-out;
}

@keyframes focusPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0;
    }
}

.result-container {
    padding: 20px;
    background: #f5f5f5;
    border-top: 2px solid #e0e0e0;
}

.result-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
}

.barcode-result {
    background: white;
    padding: 15px;
    border-radius: 10px;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: break-all;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 2px solid #e0e0e0;
}

.barcode-result .placeholder {
    color: #999;
    font-weight: normal;
    font-size: 16px;
}

.barcode-result.has-result {
    border-color: #4CAF50;
    background: #e8f5e9;
    color: #2e7d32;
}

.barcode-type {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    text-align: center;
}

.status-container {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.status {
    text-align: center;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.status.error {
    color: #f44336;
    font-weight: 600;
}

.status.success {
    color: #4CAF50;
    font-weight: 600;
}

/* iPhone ve mobil cihazlar için özel stiller */
@media (max-width: 768px) {
    .container {
        height: 100vh;
        border-radius: 0;
    }

    header h1 {
        font-size: 20px;
    }

    .btn {
        font-size: 14px;
        padding: 10px 20px;
    }

    .barcode-result {
        font-size: 18px;
    }
}

/* Yatay mod için */
@media (orientation: landscape) {
    .camera-container {
        min-height: 200px;
    }

    .scan-frame {
        height: 150px;
    }
}

/* Karanlık mod desteği */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }

    .container {
        background: #1e1e1e;
        color: #fff;
    }

    .result-container {
        background: #2a2a2a;
    }

    .barcode-result {
        background: #333;
        color: #fff;
        border-color: #555;
    }

    .status-container {
        background: #1e1e1e;
    }
}
