/*
 * Theme Name:  N2R-Theme 3.0
 * Theme URI:   https://www.net2rent.com
 * Author:      Net2Rent - Property Management Solution
 * Author URI:  https://www.net2rent.com
 * Description: Starter Theme optimizado para Net2Rent. Gutenberg + Elementor/Pro, headers dinámicos, WCAG 2.1/2.2 AA.
 * Version:     3.1.0
 * Requires at least: 6.4
 * Tested up to: 6.7
 * Requires PHP: 8.1
 * License:     GPL-2.0-or-later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: n2r-theme
 * Domain Path: /languages
 * Tags:        block-editor,elementor,custom-colors,custom-logo,responsive-layout,accessibility-ready,real-estate
 */

:root {
  /* Static defaults — only vars NOT generated by the Customizer */
  --n2rtheme-color-muted:      #6B7280;
  --n2rtheme-transition:       0.3s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 100%; scroll-behavior: smooth; }
body { font-family: var(--n2rtheme-font-body); font-size: var(--n2rtheme-font-size-base); line-height: var(--n2rtheme-line-height); color: var(--n2rtheme-color-text); background: var(--n2rtheme-color-bg); }
img, svg { max-width: 100%; height: auto; display: block; }

.n2rtheme-container { width: 100%; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
/* Builder areas set max-width inline via the Customizer */

:where(h1,h2,h3,h4,h5,h6) { font-family: var(--n2rtheme-font-heading); font-weight: 700; line-height: 1.2; color: var(--n2rtheme-color-primary); }
:where(h1) { font-size: clamp(1.75rem, 4vw, 3rem); }
:where(h2) { font-size: clamp(1.5rem, 3vw, 2.25rem); }
:where(h3) { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
:where(p)  { margin-bottom: 1em; }
:where(p:last-child) { margin-bottom: 0; }

:where(a) { color: var(--n2rtheme-color-primary); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; transition: color var(--n2rtheme-transition); }
:where(a:hover) { color: var(--n2rtheme-color-secondary); text-decoration-thickness: 2px; }
nav a { text-decoration: none; }

:focus-visible { outline: var(--n2rtheme-focus-width) var(--n2rtheme-focus-style) var(--n2rtheme-focus-color); outline-offset: 3px; border-radius: 2px; }
:focus:not(:focus-visible) { outline: none; }

.skip-link { position: absolute; top: -100%; left: 1rem; background: var(--n2rtheme-color-primary); color: #fff; padding: .75rem 1.5rem; border-radius: 0 0 6px 6px; font-weight: 700; text-decoration: none; z-index: 99999; transition: top .2s; }
.skip-link:focus { top: 0; }
.sr-only { clip: rect(1px,1px,1px,1px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }

/* ── ELEMENTOR: Ocultar header/footer nativos cuando Elementor Theme Builder los gestiona ── */
body.elementor-template-canvas .n2rtheme-header,
body.elementor-template-canvas .n2rtheme-footer,
body.elementor-template-canvas .n2rtheme-offcanvas,
body.elementor-template-canvas .n2rtheme-offcanvas__overlay,
body.elementor-template-canvas .skip-link,
body.elementor-template-canvas .n2rtheme-back-to-top { display: none !important; }

/* Cuando Elementor Pro gestiona header o footer individualmente */
body.n2rtheme-elementor-header .n2rtheme-header,
body.n2rtheme-elementor-header .n2rtheme-offcanvas,
body.n2rtheme-elementor-header .n2rtheme-offcanvas__overlay { display: none !important; }

body.n2rtheme-elementor-footer .n2rtheme-footer { display: none !important; }

/* Compensar sticky header cuando Elementor Pro gestiona el header */
body.n2rtheme-elementor-header { padding-top: 0 !important; }

/* Elementor: asegurar que los widgets usen las variables del tema */
.elementor-widget-heading .elementor-heading-title { font-family: var(--n2rtheme-font-heading); }
.elementor-widget-text-editor { font-family: var(--n2rtheme-font-body); line-height: var(--n2rtheme-line-height); }

/* HEADER */
.n2rtheme-header { position: relative; width: 100%; height: var(--n2rtheme-header-height); background: var(--n2rtheme-color-header-bg); z-index: 1000; transition: background var(--n2rtheme-transition), box-shadow var(--n2rtheme-transition), transform var(--n2rtheme-transition); }
.n2rtheme-header.has-border { border-bottom: 1px solid rgba(0,0,0,.1); }
.n2rtheme-header.is-sticky { position: fixed; top: 0; left: 0; box-shadow: 0 2px 12px rgba(0,0,0,.12); }
.n2rtheme-header.is-transparent { background: transparent; position: absolute; }
.n2rtheme-header.is-transparent.scrolled { background: var(--n2rtheme-color-header-bg); box-shadow: 0 2px 12px rgba(0,0,0,.12); }
.n2rtheme-header__inner { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 1.5rem; }
.n2rtheme-header__logo img { max-height: 50px; width: auto; }
.n2rtheme-header__site-name { font-family: var(--n2rtheme-font-heading); font-weight: 700; font-size: 1.25rem; color: var(--n2rtheme-color-header-txt); text-decoration: none; }

/* NAV */
.n2rtheme-nav__list { display: flex; list-style: none; gap: 2rem; }
.n2rtheme-nav__list a { font-weight: 600; font-size: .95rem; color: var(--n2rtheme-color-header-txt); }
.n2rtheme-nav__list a:hover, .n2rtheme-nav__list a[aria-current="page"] { color: var(--n2rtheme-color-secondary); }
.n2rtheme-nav__list .menu-item-has-children { position: relative; }
.n2rtheme-nav__list .menu-item-has-children > a::after { content: ''; display: inline-block; width: .35em; height: .35em; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-left: .4em; vertical-align: .1em; opacity: .6; transition: transform var(--n2rtheme-transition); }
.n2rtheme-nav__list .menu-item-has-children:hover > a::after { transform: rotate(-135deg); }
.n2rtheme-nav__list .sub-menu { position: absolute; top: 100%; left: 0; background: var(--n2rtheme-color-bg); border: 1px solid #E5E7EB; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); list-style: none; min-width: 200px; padding: .5rem 0; z-index: 100; }
.n2rtheme-nav__list .sub-menu a { display: block; padding: .6rem 1.25rem; color: var(--n2rtheme-color-text); font-size: .9rem; }
.n2rtheme-nav__list .sub-menu a:hover { background: #F3F4F6; }
.n2rtheme-submenu-toggle { background: none; border: none; cursor: pointer; color: inherit; padding: .25rem; border-radius: 2px; min-width: 32px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; }
.n2rtheme-submenu-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.n2rtheme-hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; background: none; border: none; padding: .6rem; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
.n2rtheme-hamburger span { display: block; width: 24px; height: 2px; background: var(--n2rtheme-color-header-txt); transition: transform var(--n2rtheme-transition), opacity var(--n2rtheme-transition); border-radius: 2px; }

.btn--primary, .btn--secondary { min-height: 44px; padding: var(--n2rtheme-btn-pv) var(--n2rtheme-btn-ph); border-radius: var(--n2rtheme-btn-radius); font-size: 1rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .5em; text-decoration: none; border: 2px solid transparent; transition: background var(--n2rtheme-transition), color var(--n2rtheme-transition); }
.btn--primary { background: var(--n2rtheme-btn-bg); color: var(--n2rtheme-btn-txt); border-color: var(--n2rtheme-btn-bg); }
.btn--primary:hover { background: var(--n2rtheme-color-primary); color: #fff; border-color: var(--n2rtheme-color-primary); text-decoration: none; }

.n2rtheme-header--rental { background: var(--n2rtheme-color-primary); }
.n2rtheme-header--rental .n2rtheme-header__site-name, .n2rtheme-header--rental .n2rtheme-nav__list a { color: #fff; }
.n2rtheme-header--rental .n2rtheme-hamburger span { background: #fff; }
.n2rtheme-header__booking-steps { display: flex; gap: 1rem; align-items: center; font-size: .85rem; color: rgba(255,255,255,.9); }

.n2rtheme-offcanvas { position: fixed; inset: 0 0 0 auto; width: min(320px, 85vw); background: var(--n2rtheme-color-primary); color: #fff; transform: translateX(100%); transition: transform var(--n2rtheme-transition); z-index: 9999; padding: 1.5rem; overflow-y: auto; }
.n2rtheme-offcanvas.is-open { transform: translateX(0); }
.n2rtheme-offcanvas__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.n2rtheme-offcanvas__close { background: none; border: 2px solid rgba(255,255,255,.4); color: #fff; cursor: pointer; border-radius: 6px; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.n2rtheme-offcanvas__close:hover { background: rgba(255,255,255,.15); }
.n2rtheme-offcanvas__list { list-style: none; }
.n2rtheme-offcanvas__list li { border-bottom: 1px solid rgba(255,255,255,.1); }
.n2rtheme-offcanvas__list a { display: flex; align-items: center; padding: .85rem 0; color: #fff; font-weight: 600; min-height: 44px; text-decoration: none; }
.n2rtheme-offcanvas__list a:hover, .n2rtheme-offcanvas__list a[aria-current="page"] { color: var(--n2rtheme-color-secondary); }
.n2rtheme-offcanvas__list .menu-item-has-children > a::after { content: ''; display: inline-block; width: .35em; height: .35em; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-left: auto; opacity: .5; }
.n2rtheme-offcanvas__overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity var(--n2rtheme-transition); z-index: 9998; }
.n2rtheme-offcanvas__overlay.is-open { opacity: 1; pointer-events: all; }

.n2rtheme-hero { position: relative; display: flex; align-items: center; justify-content: center; min-height: 60vh; overflow: hidden; text-align: center; }
.n2rtheme-hero--fullwidth { width: 100vw; margin-inline: calc(50% - 50vw); }
.n2rtheme-hero__bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.n2rtheme-hero__bg iframe { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.n2rtheme-hero__overlay { position: absolute; inset: 0; z-index: 1; }
.n2rtheme-hero__content { position: relative; z-index: 2; color: #fff; padding: 2rem; max-width: 800px; width: 100%; }
.n2rtheme-hero__content h1, .n2rtheme-hero__content h2 { color: #fff; font-size: clamp(2rem, 5vw, 4rem); }

.n2rtheme-footer { background: var(--n2rtheme-color-footer-bg); color: var(--n2rtheme-color-footer-txt); padding: 3rem 0 1.5rem; }
.n2rtheme-footer__grid { display: grid; grid-template-columns: repeat(var(--n2rtheme-footer-cols, 4), 1fr); gap: 2rem; margin-bottom: 2rem; }
.n2rtheme-footer .widget__title { color: var(--n2rtheme-color-footer-txt); font-size: 1rem; margin-bottom: 1rem; }
.n2rtheme-footer a { color: rgba(255,255,255,.85); }
.n2rtheme-footer a:hover { color: var(--n2rtheme-color-secondary); }
.n2rtheme-footer__menu-list { list-style: none; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; }
.n2rtheme-footer__bottom { border-top: 1px solid rgba(255,255,255,.15); padding-top: 1.5rem; font-size: .85rem; text-align: center; opacity: .8; }
.n2rtheme-social-links { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .75rem; }
.n2rtheme-social-links a { width: 44px; height: 44px; background: rgba(255,255,255,.12); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; text-decoration: none; transition: background var(--n2rtheme-transition); }
.n2rtheme-social-links a:hover { background: var(--n2rtheme-color-secondary); }

.n2rtheme-back-to-top { position: fixed; bottom: 2rem; width: 48px; height: 48px; background: var(--n2rtheme-btt-bg, var(--n2rtheme-color-primary)); color: var(--n2rtheme-btt-color, #fff); border: none; border-radius: 50%; cursor: pointer; z-index: 500; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,.2); transition: background var(--n2rtheme-transition), transform var(--n2rtheme-transition); }
.n2rtheme-back-to-top.btt-right { right: 2rem; }
.n2rtheme-back-to-top.btt-left  { left: 2rem; }
.n2rtheme-back-to-top:hover { background: var(--n2rtheme-color-secondary); transform: translateY(-3px); }
.n2rtheme-back-to-top[hidden] { display: none; }

label { display: block; font-weight: 600; margin-bottom: .35rem; }
input, select, textarea { width: 100%; padding: .65rem .85rem; min-height: 44px; border: 2px solid #9CA3AF; border-radius: var(--n2rtheme-btn-radius); font-size: 1rem; font-family: inherit; color: var(--n2rtheme-color-text); background: #fff; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--n2rtheme-focus-color); box-shadow: 0 0 0 var(--n2rtheme-focus-width) var(--n2rtheme-focus-color); outline: none; }
input[aria-invalid="true"] { border-color: #DC2626; }
.field-error { color: #B91C1C; font-size: .875rem; margin-top: .25rem; }

.n2rtheme-main { min-height: 60vh; }
.n2rtheme-post { padding: 2rem 0; border-bottom: 1px solid #E5E7EB; }
.post-meta { color: var(--n2rtheme-color-muted); font-size: .85rem; margin-bottom: .75rem; }
.n2rtheme-404 { text-align: center; padding: 5rem 2rem; }
.n2rtheme-404__code { font-size: clamp(5rem, 15vw, 10rem); font-weight: 900; color: var(--n2rtheme-color-primary); line-height: 1; }
.n2rtheme-404__msg { font-size: 1.25rem; color: var(--n2rtheme-color-muted); margin: 1rem 0 2rem; }
.n2rtheme-search-placeholder { background: rgba(255,255,255,.1); border: 1px dashed rgba(255,255,255,.4); padding: .5rem 1rem; border-radius: 6px; font-size: .85rem; }

@media (forced-colors: active) {
  :focus-visible { outline: 3px solid ButtonText; }
  .n2rtheme-header, .n2rtheme-footer { border: 1px solid ButtonText; }
  .btn--primary { border: 2px solid ButtonText; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .n2rtheme-hero__bg iframe { display: none; }
}
@media (max-width: 768px) { .n2rtheme-nav { display: none; } .n2rtheme-hamburger { display: flex; } .n2rtheme-footer__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .n2rtheme-footer__grid { grid-template-columns: 1fr; } }
@media print { .n2rtheme-header, .n2rtheme-footer, .n2rtheme-hamburger, .n2rtheme-offcanvas, .n2rtheme-back-to-top { display: none !important; } }
