/* Document Scanner - Mobile First Design */

.scanner-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.scanner-header {
    text-align: center;
    margin-bottom: 30px;
}

.scanner-header h2 {
    font-size: 28px;
    color: #333;
    margin-bottom: 10px;
}

.scanner-header p {
    color: #666;
    font-size: 16px;
}

.scanner-body {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

/* Mode Selector */
.scan-mode-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.mode-btn {
    padding: 15px 20px;
    background: white;
    border: 3px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.mode-btn span {
    font-size: 24px;
}

.mode-btn:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.mode-btn.active {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

/* Scanner Area */
.scanner-area {
    margin-bottom: 30px;
}

/* Camera Section */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto 20px;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    aspect-ratio: 4/3;
}

#cameraVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.scan-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 70%;
    border: 3px dashed rgba(255,255,255,0.8);
    border-radius: 10px;
}

.camera-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.control-btn {
    padding: 12px 25px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn span {
    font-size: 20px;
}

.control-btn:hover {
    background: #f1f5f9;
    border-color: #3b82f6;
}

.control-btn.primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: #3b82f6;
}

.control-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59,130,246,0.3);
}

/* Upload Section */
.upload-area {
    border: 3px dashed #cbd5e1;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.upload-area.dragover {
    border-color: #10b981;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.upload-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.upload-area h3 {
    color: #1e293b;
    margin-bottom: 10px;
    font-size: 22px;
}

.upload-area p {
    color: #64748b;
    margin-bottom: 20px;
}

.browse-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.browse-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59,130,246,0.3);
}

/* Scanned Pages */
.scanned-pages {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 15px;
}

.pages-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.pages-header h3 {
    color: #92400e;
    font-size: 20px;
}

.pages-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 10px 18px;
    background: white;
    border: 2px solid #fbbf24;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #92400e;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn:hover {
    background: #fef3c7;
    transform: scale(1.05);
}

/* Pages Grid */
.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.page-item {
    position: relative;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s;
}

.page-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.page-image {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
}

.page-number {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 700;
}

.page-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
}

.page-action-btn {
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.page-action-btn:hover {
    background: #ef4444;
    transform: scale(1.1);
}

/* PDF Controls */
.pdf-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding-top: 20px;
    border-top: 2px solid #fbbf24;
}

.pdf-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.pdf-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #92400e;
    font-weight: 600;
    cursor: pointer;
}

.pdf-options input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.generate-pdf-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

.generate-pdf-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16,185,129,0.3);
}

.generate-pdf-btn span {
    font-size: 22px;
}

/* Info Cards */
.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.info-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    padding: 25px;
    border-radius: 15px;
}

.info-card h4 {
    color: #166534;
    margin-bottom: 15px;
    font-size: 18px;
}

.info-card ol,
.info-card ul {
    padding-left: 20px;
    color: #166534;
    line-height: 1.8;
}

.info-card li {
    margin-bottom: 8px;
}

.info-card strong {
    color: #15803d;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .scanner-body {
        padding: 20px 15px;
    }
    
    .scanner-container {
        padding: 15px 10px;
    }
    
    .scan-mode-selector {
        grid-template-columns: 1fr;
    }
    
    .camera-container {
        aspect-ratio: 3/4;
    }
    
    .control-btn {
        flex: 1;
        min-width: 120px;
    }
    
    .pages-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pdf-controls {
        flex-direction: column;
    }
    
    .pdf-options {
        width: 100%;
    }
    
    .generate-pdf-btn {
        width: 100%;
        justify-content: center;
    }
    
    .info-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .scanner-container {
        padding: 10px 5px;
    }
    
    .scanner-body {
        padding: 15px 10px;
    }
    
    .mode-btn {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .mode-btn span {
        font-size: 20px;
    }
    
    .upload-area {
        padding: 40px 15px;
    }
    
    .upload-icon {
        font-size: 48px;
    }
    
    .pages-grid {
        grid-template-columns: 1fr;
    }
    
    .control-btn {
        font-size: 14px;
        padding: 10px 20px;
    }
}