/* ============================================================
   Pilates Studio System — Estilos Custom — Módulo 11
   Paleta: Ivory, Charcoal, Sage, Gold, Taupe, Blush
   ============================================================ */

:root {
    --color-ivory: #F8F5F0;
    --color-charcoal: #2C2C2C;
    --color-sage: #8B9E8A;
    --color-deep-sage: #5A7059;
    --color-gold: #C9A96E;
    --color-taupe: #9E8E7E;
    --color-blush: #E8D5D0;
    --color-terracotta: #C17C60;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Reset y Base ──────────────────────────────────────── */
* { box-sizing: border-box; }

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: contain;
}

/* Safe area para iOS notch/home indicator */
.pt-safe { padding-top: env(safe-area-inset-top, 0px); }
.safe-area-bottom { padding-bottom: var(--safe-area-bottom); }

/* ── Tipografía ────────────────────────────────────────── */
h1, h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
}

h3, h4 {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.label-caps {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-taupe);
}

.price {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 700;
    color: var(--color-gold);
}

/* ── Bottom Navigation ─────────────────────────────────── */
.nav-tab {
    color: var(--color-taupe);
    transition: color 0.2s ease;
    text-decoration: none;
}

.nav-tab.active,
.nav-tab:hover {
    color: var(--color-sage);
}

.nav-tab.active i {
    stroke-width: 2.5;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.class-card {
    border-left: 3px solid var(--color-sage);
}

/* ── Botones ───────────────────────────────────────────── */
.btn-primary {
    background: var(--color-gold);
    color: white;
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.04em;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn-primary:hover { background: #b8953f; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--color-sage);
    color: white;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-secondary:hover { background: var(--color-deep-sage); }

.btn-outline {
    background: transparent;
    color: var(--color-charcoal);
    border: 1.5px solid #e5e5e5;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.btn-outline:hover {
    border-color: var(--color-sage);
    background: rgba(139, 158, 138, 0.05);
}

/* ── Input Fields (underline style) ────────────────────── */
.input-field {
    width: 100%;
    padding: 12px 0;
    border: none;
    border-bottom: 1.5px solid #e5e5e5;
    background: transparent;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    color: var(--color-charcoal);
    outline: none;
    transition: border-color 0.2s ease;
}

.input-field:focus {
    border-bottom-color: var(--color-gold);
}

.input-field::placeholder {
    color: var(--color-taupe);
    opacity: 0.7;
}

.input-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-taupe);
    margin-bottom: 4px;
    display: block;
}

/* ── Badges ────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-available { background: rgba(139, 158, 138, 0.15); color: var(--color-deep-sage); }
.badge-few       { background: rgba(201, 169, 110, 0.15); color: var(--color-gold); }
.badge-full      { background: rgba(158, 142, 126, 0.15); color: var(--color-taupe); }
.badge-confirmed { background: rgba(139, 158, 138, 0.15); color: var(--color-deep-sage); }
.badge-pending   { background: rgba(201, 169, 110, 0.15); color: var(--color-gold); }
.badge-cancelled { background: rgba(193, 124, 96, 0.15); color: var(--color-terracotta); }

/* ── Toast Notifications ───────────────────────────────── */
.toast {
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: toast-in 0.3s ease, toast-out 0.3s ease 3.7s forwards;
    pointer-events: auto;
    max-width: 360px;
    text-align: center;
}

.toast-success { background: var(--color-deep-sage); color: white; }
.toast-warning { background: var(--color-gold); color: white; }
.toast-error   { background: var(--color-terracotta); color: white; }
.toast-info    { background: var(--color-charcoal); color: white; }

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

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

/* ── Skeleton Loading ──────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, #f0ece6 25%, #e8e4de 50%, #f0ece6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Modal (slide-up iOS style) ────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 60;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active { opacity: 1; }

.modal-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    z-index: 61;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    padding-bottom: var(--safe-area-bottom);
}

.modal-sheet.active { transform: translateY(0); }

.modal-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #d4d4d4;
    margin: 8px auto 0;
}

/* ── PWA Install Banner ────────────────────────────────── */
.install-banner {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 16px;
    margin: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slide-down 0.3s ease;
}

@keyframes slide-down {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Offline Indicator (barra superior) ───────────────── */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--color-charcoal);
    color: white;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    animation: slide-down 0.3s ease;
}

.offline-indicator.hiding {
    animation: slide-up 0.3s ease forwards;
}

@keyframes slide-up {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-100%); }
}

/* ── Update Toast (nueva versión disponible) ──────────── */
.update-toast {
    background: white;
    color: var(--color-charcoal);
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    pointer-events: auto;
    animation: toast-in 0.3s ease;
}

/* ── Toggle Switch (iOS style) ────────────────────────── */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 28px;
    background: #e0e0e0;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
    padding: 0;
    flex-shrink: 0;
}

.toggle-switch.active {
    background: var(--color-sage);
}

.toggle-switch.toggle-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.toggle-switch.active .toggle-knob {
    transform: translateX(20px);
}

/* ── Lazy Loading Images ──────────────────────────────── */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded,
img[loading="lazy"]:not([data-src]) {
    opacity: 1;
}

/* ── Scrollbar sutil ───────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d4d4; border-radius: 2px; }

/* ── Selection color ───────────────────────────────────── */
::selection {
    background: rgba(139, 158, 138, 0.3);
    color: var(--color-charcoal);
}

/* ── Focus visible (accesibilidad) ─────────────────────── */
:focus-visible {
    outline: 2px solid var(--color-sage);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Tap highlight para móvil ──────────────────────────── */
@media (hover: none) {
    * {
        -webkit-tap-highlight-color: rgba(139, 158, 138, 0.1);
    }
}
