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

:root {
    --primary: #ff69b4;
    --secondary: #ffc0cb;
    --success: #4caf50;
    --danger: #f44336;
    --dark: #333;
    --light: #f5f5f5;
    --white: #fff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #ffeef8 0%, #fff0f5 100%);
    min-height: 100vh;
    color: var(--dark);
}

.app {
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, #ff1493 100%);
    color: var(--white);
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    opacity: 0.9;
    font-size: 0.9rem;
}

/* Navigation */
.nav {
    display: flex;
    background: var(--white);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.nav-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: var(--white);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s;
    position: relative;
}

.nav-btn:hover {
    background: var(--light);
}

.nav-btn.active {
    background: var(--primary);
    color: var(--white);
}

.badge {
    background: var(--danger);
    color: var(--white);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.nav-btn.active .badge {
    background: var(--white);
    color: var(--primary);
}

/* Views */
.view {
    flex: 1;
    padding: 1rem;
}

/* Camera View */
.camera-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Warning Box */
.warning-box {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 10px rgba(255, 193, 7, 0.3);
}

.warning-box h3 {
    color: #856404;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.warning-box p {
    color: #856404;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.solution-box {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.solution-box h4 {
    color: #28a745;
    margin-bottom: 0.8rem;
}

.solution-box ol {
    margin-left: 1.5rem;
    color: #333;
}

.solution-box li {
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

.solution-box code {
    background: #f8f9fa;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #e83e8c;
    font-weight: bold;
}

#video {
    width: 100%;
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    background: #000;
}

.camera-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--dark);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

/* Preview */
.preview {
    margin-top: 1rem;
}

.preview img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.preview-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

/* Gallery View */
.gallery-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.3s;
}

.gallery-item:hover {
    transform: scale(1.05);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: var(--white);
    padding: 0.5rem;
    font-size: 0.8rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #999;
}

.empty-state p:first-child {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: var(--white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--danger);
    color: var(--white);
}

.modal-content img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 10px;
}

.modal-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .nav-btn {
        font-size: 0.9rem;
        padding: 0.8rem;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.5rem;
    }

    .camera-controls,
    .preview-controls,
    .gallery-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        width: 100%;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item {
    animation: fadeIn 0.3s ease-out;
}
