/* MRZ Scanner Web App Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 10px;
    font-size: 2.5em;
}

h2 {
    color: #667eea;
    margin: 20px 0 15px 0;
    font-size: 1.5em;
}

.instruction {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1em;
}

/* Camera Container */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto 30px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}

#video {
    width: 100%;
    height: auto;
    display: block;
}

/* Scan Frame Overlay */
.scan-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    height: 30%;
    pointer-events: none;
}

.corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid #00ff00;
}

.corner.top-left {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
}

.corner.top-right {
    top: 0;
    right: 0;
    border-left: none;
    border-bottom: none;
}

.corner.bottom-left {
    bottom: 0;
    left: 0;
    border-right: none;
    border-top: none;
}

.corner.bottom-right {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
}

.mrz-zone {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 255, 0, 0.2);
    padding: 8px 15px;
    border-radius: 5px;
    border: 2px dashed #00ff00;
}

.mrz-zone span {
    color: #00ff00;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.btn {
    padding: 12px 30px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #38a169;
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #4a5568;
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 30px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #667eea;
    font-size: 18px;
    font-weight: 600;
}

/* Error Message */
.error {
    background: #fed7d7;
    color: #c53030;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #c53030;
}

/* Results Page Styles */
.results-container {
    margin-top: 20px;
}

.captured-image {
    margin-bottom: 30px;
}

.captured-image img {
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: block;
    margin: 15px auto;
}

.document-info {
    margin-bottom: 30px;
}

.data-grid {
    display: grid;
    gap: 15px;
}

.data-field {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 15px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.data-label {
    font-weight: 600;
    color: #4a5568;
}

.data-value {
    color: #2d3748;
    word-break: break-word;
}

.no-data {
    text-align: center;
    color: #718096;
    padding: 30px;
    font-size: 18px;
}

/* Raw Data */
.raw-data {
    margin-top: 30px;
    padding: 20px;
    background: #2d3748;
    border-radius: 8px;
}

.raw-data h3 {
    color: #fff;
    margin-bottom: 15px;
}

.raw-data pre {
    background: #1a202c;
    color: #68d391;
    padding: 20px;
    border-radius: 5px;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    .data-field {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}
