/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    user-select: none;
}

/* Screen Management */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    z-index: 1;
}

.screen.active {
    display: flex;
}

/* Loading Screen */
#loading-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-content {
    text-align: center;
    animation: fadeInUp 1s ease-out;
}

.loading-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.loading-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-icon {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255,255,255,0.1);
    color: white;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    box-shadow: 0 4px 15px rgba(255,107,107,0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,107,107,0.4);
}

.btn-secondary:hover, .btn-icon:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

.btn-icon {
    padding: 8px 12px;
    min-width: 44px;
    min-height: 44px;
}

/* AR View */
#ar-view {
    position: relative;
}

#video {
    width: 100vw;
    height: 100vh;
    object-fit: cover;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
}

/* UI Overlay */
.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.ui-overlay * {
    pointer-events: auto;
}

/* Top Bar */
.top-bar {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collection-counter {
    background: rgba(0,0,0,0.7);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.collection-icon {
    margin-left: 8px;
}

/* Scan Area */
.scan-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
}

.scan-frame {
    position: relative;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 16px;
    animation: pulse 2s infinite;
}

.corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #00ff88;
}

.corner.top-left {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
    border-radius: 8px 0 0 0;
}

.corner.top-right {
    top: -3px;
    right: -3px;
    border-left: none;
    border-bottom: none;
    border-radius: 0 8px 0 0;
}

.corner.bottom-left {
    bottom: -3px;
    left: -3px;
    border-right: none;
    border-top: none;
    border-radius: 0 0 0 8px;
}

.corner.bottom-right {
    bottom: -3px;
    right: -3px;
    border-left: none;
    border-top: none;
    border-radius: 0 0 8px 0;
}

.scan-instruction {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-size: 0.9rem;
    background: rgba(0,0,0,0.7);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

/* Bottom Bar */
.bottom-bar {
    position: absolute;
    bottom: 30px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

/* 3D Object Container */
#ar-object-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* Collection View */
#collection-view {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    flex-direction: column;
    padding: 20px;
}

.collection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255,255,255,0.1);
}

.collection-header h2 {
    font-size: 2rem;
    margin: 0;
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    flex: 1;
    overflow-y: auto;
}

.collection-item {
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid rgba(255,255,255,0.1);
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.collection-item.collected {
    background: linear-gradient(135deg, rgba(0,255,136,0.2), rgba(0,200,100,0.2));
    border-color: #00ff88;
    animation: collectPulse 0.6s ease-out;
}

.collection-item.locked {
    opacity: 0.5;
    background: rgba(255,255,255,0.05);
}

.collection-item .emoji {
    font-size: 3rem;
    margin-bottom: 10px;
    display: block;
}

.collection-item .name {
    font-weight: 600;
    margin-bottom: 5px;
}

.collection-item .description {
    font-size: 0.8rem;
    opacity: 0.7;
    line-height: 1.3;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    max-width: 90vw;
    max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: slideInUp 0.4s ease-out;
}

.modal-content h3 {
    font-size: 2rem;
    margin-bottom: 20px;
}

#collected-object-preview {
    font-size: 4rem;
    margin: 20px 0;
}

#object-description {
    font-size: 1.1rem;
    margin-bottom: 30px;
    opacity: 0.9;
    line-height: 1.4;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        border-color: rgba(255,255,255,0.5);
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        border-color: rgba(0,255,136,0.8);
        transform: translate(-50%, -50%) scale(1.05);
    }
}

@keyframes collectPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Responsive Design */
@media (max-width: 480px) {
    .loading-content h1 {
        font-size: 2rem;
    }
    
    .scan-area {
        width: 200px;
        height: 200px;
    }
    
    .collection-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 15px;
    }
    
    .collection-item {
        padding: 15px;
        min-height: 150px;
    }
    
    .collection-item .emoji {
        font-size: 2.5rem;
    }
    
    .modal-content {
        padding: 20px;
        margin: 20px;
    }
    
    .modal-content h3 {
        font-size: 1.5rem;
    }
}
