/* ============================================================
   gaussianHawkins — estilos globales
   - Reglas comunes (reset, tipografía)
   - Reglas específicas del visor (body.viewer)
   - Reglas de las páginas con chrome (body.page)
   ============================================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    color: #fff;
}

a { color: #6cb2ff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== VISOR (viewer.html) ============================================= */
body.viewer {
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    background: black;
    text-shadow: 0 0 3px black;
    color: white;
}

body.viewer #info {
    z-index: 100;
    position: absolute;
    top: 10px;
    left: 15px;
    max-width: 320px;
}

body.viewer h3 { margin: 5px 0; }
body.viewer p  { margin: 5px 0; font-size: small; }

body.viewer #instructions {
    background: rgba(0, 0, 0, 0.6);
    white-space: pre-wrap;
    padding: 10px;
    border-radius: 10px;
    font-size: x-small;
}

body.viewer details { font-size: small; }

body.viewer #progress {
    position: absolute;
    top: 0;
    height: 5px;
    background: #6cb2ff;
    z-index: 99;
    transition: width 0.1s ease-in-out;
}

body.viewer #quality {
    position: absolute;
    bottom: 10px;
    z-index: 999;
    right: 10px;
    font-size: small;
}

body.viewer #caminfo {
    position: absolute;
    top: 10px;
    z-index: 999;
    right: 10px;
    font-size: small;
}

body.viewer #canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

body.viewer .scene,
body.viewer #message {
    position: absolute;
    display: flex;
    inset: 0;
    z-index: 2;
    height: 100%;
    width: 100%;
    align-items: center;
    justify-content: center;
}

body.viewer #message {
    font-weight: bold;
    font-size: large;
    color: #ff6b6b;
    pointer-events: none;
}

/* spinner cube */
body.viewer .cube-wrapper { transform-style: preserve-3d; }
body.viewer .cube {
    transform-style: preserve-3d;
    transform: rotateX(45deg) rotateZ(45deg);
    animation: gh-rotation 2s infinite;
}
body.viewer .cube-faces {
    transform-style: preserve-3d;
    height: 80px;
    width: 80px;
    position: relative;
    transform-origin: 0 0;
    transform: translateX(0) translateY(0) translateZ(-40px);
}
body.viewer .cube-face {
    position: absolute;
    inset: 0;
    background: #6cb2ff;
    border: solid 1px #ffffff;
}
body.viewer .cube-face.top   { transform: translateZ(80px); }
body.viewer .cube-face.front { transform-origin: 0 50%; transform: rotateY(-90deg); }
body.viewer .cube-face.back  { transform-origin: 0 50%; transform: rotateY(-90deg) translateZ(-80px); }
body.viewer .cube-face.right { transform-origin: 50% 0; transform: rotateX(-90deg) translateY(-80px); }
body.viewer .cube-face.left  { transform-origin: 50% 0; transform: rotateX(-90deg) translateY(-80px) translateZ(80px); }

@keyframes gh-rotation {
    0%   { transform: rotateX(45deg) rotateY(0) rotateZ(45deg);
           animation-timing-function: cubic-bezier(0.17, 0.84, 0.44, 1); }
    50%  { transform: rotateX(45deg) rotateY(0) rotateZ(225deg);
           animation-timing-function: cubic-bezier(0.76, 0.05, 0.86, 0.06); }
    100% { transform: rotateX(45deg) rotateY(0) rotateZ(405deg);
           animation-timing-function: cubic-bezier(0.17, 0.84, 0.44, 1); }
}

/* ===== PÁGINAS ESTÁNDAR (index.html, upload.html) ====================== */
body.page {
    background: #0d1117;
    color: #e6edf3;
    min-height: 100vh;
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

body.page header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid #30363d;
    margin-bottom: 24px;
}

body.page header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

body.page header nav a {
    margin-left: 16px;
    font-size: 0.95rem;
}

body.page .grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

body.page .card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 16px;
    transition: border-color 0.15s ease;
}
body.page .card:hover { border-color: #6cb2ff; }

body.page .card h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

body.page .card .meta {
    font-size: 0.85rem;
    color: #8b949e;
}

body.page .empty {
    text-align: center;
    padding: 64px 16px;
    color: #8b949e;
}

body.page .btn {
    display: inline-block;
    padding: 8px 16px;
    background: #238636;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
}
body.page .btn:hover { background: #2ea043; text-decoration: none; }
body.page .btn.danger { background: #da3633; }
body.page .btn.danger:hover { background: #f85149; }
body.page .btn.secondary { background: #30363d; }
body.page .btn.secondary:hover { background: #484f58; }

body.page input[type="text"],
body.page input[type="password"],
body.page input[type="file"] {
    width: 100%;
    padding: 8px 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
    font-size: 0.95rem;
}

body.page label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #c9d1d9;
}

body.page .field { margin-bottom: 16px; }

body.page .dropzone {
    border: 2px dashed #30363d;
    border-radius: 8px;
    padding: 48px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
body.page .dropzone:hover,
body.page .dropzone.dragover {
    border-color: #6cb2ff;
    background: #161b22;
}

/* ===== HOME — grid de propiedades ====================================== */
body.page .prop-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

body.page .prop-card {
    padding: 0;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}
body.page .prop-card:hover { text-decoration: none; }

body.page .prop-card-cover {
    width: 100%;
    aspect-ratio: 16 / 10;
    background-size: cover;
    background-position: center;
    background-color: #1f2937;
}
body.page .prop-card-cover.no-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1f2937, #111827);
}
body.page .prop-card-cover.no-cover::before {
    content: "🏠";
    font-size: 48px;
    opacity: 0.4;
}

body.page .prop-card-body { padding: 16px; }
body.page .prop-card-body h3 { margin: 0 0 6px; font-size: 1.05rem; }

body.page .prop-price {
    margin-top: 8px;
    font-weight: 600;
    color: #3fb950;
}

/* ===== TOUR (página /p/<slug>) ========================================= */
body.tour .prop-hero {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 2fr;
    gap: 24px;
    margin-bottom: 8px;
}
@media (max-width: 720px) {
    body.tour .prop-hero { grid-template-columns: 1fr; }
}

body.tour .prop-cover {
    aspect-ratio: 16 / 10;
    background-size: cover;
    background-position: center;
    background-color: #1f2937;
    border-radius: 8px;
    border: 1px solid #30363d;
}
body.tour .prop-cover.no-cover {
    display: flex;
    align-items: center;
    justify-content: center;
}
body.tour .prop-cover.no-cover::before {
    content: "🏠";
    font-size: 80px;
    opacity: 0.4;
}

body.tour .prop-info h2 { margin: 0 0 8px; font-size: 1.6rem; }
body.tour .prop-address { color: #8b949e; margin: 0 0 12px; }

body.tour .prop-features {
    list-style: none;
    padding: 0;
    margin: 12px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
body.tour .prop-features li {
    background: #21262d;
    border: 1px solid #30363d;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
}

body.tour .prop-description {
    color: #c9d1d9;
    line-height: 1.5;
    margin: 12px 0 16px;
    white-space: pre-wrap;
}

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

body.tour .room-card {
    text-decoration: none;
    color: inherit;
    text-align: center;
}
body.tour .room-card:hover { text-decoration: none; }
body.tour .room-thumb {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 8px;
    opacity: 0.7;
}

/* ===== ADMIN =========================================================== */
body.admin h3 {
    margin: 24px 0 12px;
    font-size: 1.1rem;
    color: #c9d1d9;
}

body.admin .admin-section {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}
body.admin .admin-section h3 { margin-top: 0; }

body.admin .row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

body.admin textarea {
    width: 100%;
    padding: 8px 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

body.admin select {
    width: 100%;
    padding: 8px 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
}

body.admin .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
body.admin .badge-published { background: #238636; color: #fff; }
body.admin .badge-draft     { background: #6e7681; color: #fff; }
body.admin .badge-archived  { background: #30363d; color: #8b949e; }

body.admin .data-table {
    width: 100%;
    border-collapse: collapse;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    overflow: hidden;
}
body.admin .data-table th,
body.admin .data-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #21262d;
    font-size: 0.9rem;
}
body.admin .data-table th {
    background: #161b22;
    font-weight: 600;
    color: #8b949e;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}
body.admin .data-table tbody tr:last-child td { border-bottom: none; }
body.admin .data-table tbody tr:hover { background: #161b22; }

body.admin .cover-row {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 600px) {
    body.admin .cover-row { grid-template-columns: 1fr; }
}

body.admin .prop-cover-preview {
    aspect-ratio: 16 / 10;
    background-size: cover;
    background-position: center;
    background-color: #1f2937;
    border-radius: 6px;
    border: 1px solid #30363d;
}
body.admin .prop-cover-preview.no-cover {
    display: flex;
    align-items: center;
    justify-content: center;
}
body.admin .prop-cover-preview.no-cover::before {
    content: "📷";
    font-size: 48px;
    opacity: 0.4;
}

/* ===== TOAST ============================================================ */
.gh-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    z-index: 10000;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    transition: transform .25s ease;
    color: white;
    max-width: 90vw;
}
.gh-toast.show { transform: translateX(-50%) translateY(0); }
.gh-toast--info    { background: #2188ff; }
.gh-toast--success { background: #238636; }
.gh-toast--error   { background: #da3633; }

/* ===== SKELETON LOADERS ================================================= */
.skeleton {
    background: linear-gradient(90deg,
                                rgba(110,118,129,.15) 25%,
                                rgba(110,118,129,.3) 50%,
                                rgba(110,118,129,.15) 75%);
    background-size: 200% 100%;
    animation: gh-shimmer 1.5s linear infinite;
    border-radius: 6px;
}
@keyframes gh-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skel-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 16px;
    overflow: hidden;
}
.skel-card .skel-cover    { width: 100%; height: 160px; margin: -16px -16px 12px; border-radius: 0; }
.skel-card .skel-line     { height: 14px; margin-bottom: 8px; }
.skel-card .skel-line.sm  { height: 10px; width: 60%; }

/* ===== TOUR — galería de fotos extras (.gallery) ======================== */
body.tour .gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    margin: 16px 0;
}
body.tour .gallery a {
    aspect-ratio: 4 / 3;
    background-size: cover;
    background-position: center;
    background-color: #1f2937;
    border-radius: 8px;
    border: 1px solid #30363d;
    transition: transform .15s ease, border-color .15s ease;
}
body.tour .gallery a:hover {
    transform: scale(1.02);
    border-color: #6cb2ff;
}

/* Lightbox para abrir foto a pantalla completa */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 6px;
}

/* Modal nueva propiedad */
body.admin .modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}
body.admin .modal[hidden] { display: none; }
body.admin .modal-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 24px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}
