/* =========================================
   GLOBAL VARIABLES & BASE STYLES
   ========================================= */
:root {
    --bg-dark: #f1f5f9;
    --bg-darker: #f8fafc;
    --primary: #233152; /* Sanchis Navy Blue */
    --primary-hover: #17223b;
    --text-light: #0f172a; 
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(35, 49, 82, 0.15);
    --transition: all 0.3s ease;
    --accent: #d97706; /* Color de acento corporativo opcional */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-darker);
    color: var(--text-light);
    height: 100vh;
    overflow: hidden;
}

/* =========================================
   Glassmorphism Utilities
   ========================================= */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(35, 49, 82, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(35, 49, 82, 0.3);
}

.btn-primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: rgba(35, 49, 82, 0.05);
}

/* =========================================
   LOGIN SAAS MOCKUP
   ========================================= */
.login-wrapper {
    position: fixed;
    inset: 0;
    display: flex;
    z-index: 9999;
}

.login-left {
    flex: 1;
    background: var(--primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: white;
    text-align: center;
}

.login-left h1 {
    font-size: 36px;
    margin-top: 24px;
    margin-bottom: 16px;
}

.login-left p {
    font-size: 16px;
    opacity: 0.8;
    max-width: 400px;
    line-height: 1.5;
}

.login-right {
    flex: 1;
    background: var(--bg-darker);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
}

.login-card h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--primary);
}

.login-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
}

/* =========================================
   Admin Panel Layout
   ========================================= */
.admin-body {
    display: flex;
    overflow: auto;
}

.admin-layout {
    display: flex;
    width: 100%;
    height: 100vh;
}

.sidebar {
    width: 280px;
    padding: 30px;
    margin: 20px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info h4 {
    font-size: 14px;
    margin-bottom: 2px;
}

.user-info p {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(35, 49, 82, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.admin-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.admin-menu li {
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.admin-menu li:hover, .admin-menu li.active {
    background: rgba(35, 49, 82, 0.08);
    color: var(--primary);
}

.admin-menu li.active {
    border-left: 4px solid var(--primary);
}

.admin-menu li.admin-only {
    display: none; /* Hidden by default for non-admins */
}

.logout-btn {
    margin-top: auto;
    color: #ef4444 !important;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

.admin-main {
    flex: 1;
    padding: 20px 40px 20px 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.admin-header h1 {
    font-size: 28px;
    font-weight: 500;
}

/* =========================================
   SPA Views & Advanced UX
   ========================================= */
.view-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.view-section.active {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-row {
    display: flex;
    gap: 16px;
    align-items: center;
    background: var(--glass-bg);
    padding: 16px 20px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 200px;
}

.form-group.full-width {
    width: 100%;
}

.form-group label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.form-input {
    background: white;
    border: 1px solid var(--glass-border);
    color: var(--text-light);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Outfit';
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(35, 49, 82, 0.1);
}

.form-error {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

/* =========================================
   Dashboard (Analytics)
   ========================================= */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-title {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.stat-value {
    font-size: 32px;
    font-weight: 600;
    color: var(--primary);
}

.stat-trend {
    font-size: 12px;
    color: #10b981;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    padding: 4px 8px;
    border-radius: 20px;
    align-self: flex-start;
}

/* =========================================
   Tour Creation Logic
   ========================================= */
.upload-section {
    padding: 40px;
}

.upload-area {
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    background: rgba(0,0,0,0.02);
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary);
    background: rgba(35, 49, 82, 0.05);
}

.upload-icon {
    font-size: 48px;
}

.upload-area h3 {
    font-size: 20px;
    font-weight: 500;
}

.upload-area p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 8px;
}

.nodes-manager {
    padding: 30px;
    flex: 1;
    min-height: 300px;
}

.nodes-manager h3 {
    margin-bottom: 20px;
    font-size: 18px;
    color: var(--text-muted);
}

.nodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    color: var(--text-muted);
    font-size: 15px;
}

.node-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.node-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(35, 49, 82, 0.1);
}

.node-img {
    height: 120px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 24px;
    background-size: cover;
    background-position: center;
}

.node-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* =========================================
   Mis Tours Grid & Components
   ========================================= */
.tours-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tour-card {
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.tour-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.tour-img {
    height: 140px;
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: var(--bg-darker);
}

.tour-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary);
    color: white;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.tour-content {
    padding: 20px;
}

.tour-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.tour-meta {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.tour-actions {
    display: flex;
    gap: 8px;
}

.tour-actions button {
    flex: 1;
    font-size: 12px;
    padding: 8px;
}

/* Teams Table (Admin Option) */
.team-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.team-table th, .team-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.team-table th {
    background: var(--bg-dark);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
}

.team-table tr:hover {
    background: var(--bg-darker);
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 600px;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.qr-code-box {
    width: 200px;
    height: 200px;
    background: #e2e8f0;
    margin: 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 2px dashed var(--text-muted);
}

/* =========================================
   PUBLIC VIEWER SPECIFIC UI elements
   ========================================= */

/* Marca de Agua Inmune (Protección Enterprise Gran Formato) */
.watermark-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-position: center;
    background-repeat: no-repeat;
    background-size: min(800px, 75%) auto; /* Un solo logo súper gigante (3/4 de pantalla) */
    opacity: 0.04; /* Muy sutil en el centro de la pantalla */
    pointer-events: none; 
    z-index: 100;
    filter: grayscale(100%) invert(100%) blur(0.5px); /* Logo blanco suave, ligeramente difuminado */
}

/* Casi invisible en móvil, pero suficiente para proteger el copyright */
.panorama-container:hover .watermark-overlay {
    opacity: 0.07; 
}

/* Ficha de Propiedad Ultra Minimalista (En lugar de un Navbar gigante) */
.minimal-property-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.minimal-property-badge h2 {
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

.minimal-property-badge p {
    font-size: 12px;
    color: #cbd5e1;
    margin: 0;
}

/* Navigation Menu Horizontal (Bottom Center) */
.room-selector {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 8px 12px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    max-width: 80%;
    overflow-x: auto;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Ocultar barra de scroll para limpiar diseño */
.room-selector::-webkit-scrollbar {
    display: none;
}

.room-selector h3 {
    display: none; /* Innecesario, es intuitivo */
}

.room-selector ul {
    display: flex;
    list-style: none;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.scene-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.scene-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.scene-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
