/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: #000;
    color: #fff;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.screen.active {
    display: flex;
}

/* Welcome Screen */
#welcome-screen {
    background: linear-gradient(135deg, #5fbcee 0%, #2b47e3 100%);
    z-index: 1000;
}

.welcome-content {
    text-align: center;
    padding: 2rem;
    max-width: 500px;
}

.icon-camera {
    margin-bottom: 2rem;
}

.icon-camera .material-icons {
    font-size: 80px;
    color: rgba(255, 255, 255, 0.9);
}

.welcome-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.welcome-content p {
    font-size: 1rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.permissions-list {
    list-style: none;
    text-align: left;
    margin: 1.5rem auto;
    max-width: 280px;
}

.permissions-list li {
    display: flex;
    align-items: center;
    margin-bottom: 0.8rem;
    font-size: 1rem;
}

.permissions-list .material-icons {
    margin-right: 0.8rem;
    color: #4ade80;
    font-size: 24px;
}

.instructions {
    font-size: 0.9rem;
    margin: 1.5rem 0;
    opacity: 0.8;
}

.safari-note {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 152, 0, 0.2);
    padding: 0.8rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.safari-note .material-icons {
    margin-right: 0.5rem;
    color: #ff9800;
}

/* Buttons */
.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    min-width: 200px;
}

.primary-button:hover,
.primary-button:active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.primary-button .material-icons {
    font-size: 24px;
}

/* Loading Screen */
#loading-screen {
    background: #000;
    z-index: 999;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 2rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-text {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.progress-bar {
    width: 250px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
}

/* AR Container */
#ar-container {
    z-index: 1;
}

#ar-container.active {
    display: block;
}

/* A-Frame canvas */
a-scene {
    width: 100%;
    height: 100%;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1a1a1a;
    border-radius: 16px;
    padding: 2rem;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-button:hover,
.close-button:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Error Modal */
.error-content {
    text-align: center;
    max-width: 400px;
}

.error-icon {
    font-size: 64px;
    color: #ff9800;
    margin-bottom: 1rem;
}

.error-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.error-content p {
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.error-instructions {
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.error-instructions p {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.error-instructions ol {
    margin-left: 1.5rem;
    opacity: 0.9;
}

.error-instructions li {
    margin-bottom: 0.5rem;
}

/* Utilidades */
.hidden {
    display: none !important;
}

/* Prevenir zoom en iOS */
input, textarea, select {
    font-size: 16px !important;
}

/* Optimización touch en iOS */
button, a {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}