* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 2em;
    font-weight: 600;
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.3s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 60px 40px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.hero-title {
    font-size: 3em;
    margin-bottom: 15px;
    font-weight: 700;
}

.hero-subtitle {
    font-size: 1.3em;
    opacity: 0.95;
}

/* Main Content */
.main-content {
    padding: 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.detection-layout {
    grid-template-columns: 1.2fr 0.8fr;
}

/* Camera Section */
.camera-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.video-container {
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

#video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

#canvas {
    display: none;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.camera-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 15px;
}

.preview {
    margin-top: 20px;
    text-align: center;
}

#capturedImage {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.status-indicator {
    text-align: center;
    padding: 15px;
    background: #e3f2fd;
    border-radius: 8px;
    font-weight: 600;
    color: #1976d2;
}

/* Form Section */
.form-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 0.95em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-success {
    background: #10b981;
    color: white;
    width: 100%;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Results Section */
.results-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.results-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.result-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.result-card.empty {
    text-align: center;
    color: #999;
}

.result-card.success {
    border-left: 5px solid #10b981;
}

.result-card.failed {
    border-left: 5px solid #ef4444;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.result-icon {
    font-size: 3em;
}

.result-title {
    font-size: 1.5em;
    font-weight: 700;
}

.result-subtitle {
    color: #666;
    font-size: 0.9em;
}

.result-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.detail-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

.detail-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
}

.detail-value {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

.confidence-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 4px;
    transition: width 0.5s;
}

/* History */
.history-section {
    margin-top: 30px;
}

.history-section h3 {
    margin-bottom: 15px;
    color: #555;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-status {
    font-weight: 600;
}

.history-status.success {
    color: #10b981;
}

.history-status.failed {
    color: #ef4444;
}

.history-time {
    font-size: 0.85em;
    color: #999;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    padding: 40px;
}

.feature-card {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.card-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.feature-card h2 {
    margin-bottom: 15px;
    color: #333;
}

.feature-card p {
    color: #666;
    margin-bottom: 25px;
    line-height: 1.6;
}

/* Features List */
.features-list {
    padding: 40px;
    background: #f8f9fa;
}

.features-list h2 {
    text-align: center;
    margin-bottom: 40px;
    color: #333;
    font-size: 2em;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.feature-icon {
    font-size: 2.5em;
}

.feature-item h3 {
    margin-bottom: 8px;
    color: #333;
}

.feature-item p {
    color: #666;
    line-height: 1.5;
}

/* Instructions */
.instructions {
    background: #fff3cd;
    padding: 30px 40px;
    border-top: 3px solid #ffc107;
}

.instructions h3 {
    margin-bottom: 15px;
    color: #856404;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: #856404;
    line-height: 1.6;
}

.instructions li:before {
    content: "✓";
    position: absolute;
    left: 0;
    font-weight: bold;
    color: #ffc107;
}

/* Result Messages */
.result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
}

.result.success {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

.result.error {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.footer p {
    margin: 5px 0;
    color: #666;
}

.status-badge {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    background: white;
    border-radius: 20px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-content,
    .detection-layout {
        grid-template-columns: 1fr;
    }

    .cards-grid,
    .features-grid {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 2em;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .header {
        padding: 20px;
        flex-direction: column;
        gap: 15px;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .result-details {
        grid-template-columns: 1fr;
    }
}
