/* ==========================================================================
   Components — components.css
   CTA, Button, Toast Notification
   Sistema Gestionale Immobiliare — Design System Luxury
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CTA Component (Req 8.16)
   Varianti: Primary, Secondary, Outlined, Ghost
   -------------------------------------------------------------------------- */
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 39px;
  min-height: 50px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.cta:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* CTA Primary — filled verde scuro, testo bianco */
.cta-primary {
  background-color: var(--primary);
  color: var(--white);
  border: 1px solid var(--primary);
}

.cta-primary:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-light);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(24, 48, 40, 0.25);
  transform: translateY(-1px);
}

.cta-primary:active {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(0);
}

/* CTA Secondary — filled nero, testo bianco */
.cta-secondary {
  background-color: var(--black);
  color: var(--white);
  border: 1px solid var(--black);
}

.cta-secondary:hover {
  background-color: #1a1a1a;
  border-color: #1a1a1a;
  color: var(--white);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.cta-secondary:active {
  background-color: #333333;
  transform: translateY(0);
}

/* CTA Outlined — trasparente, bordo 1px */
.cta-outlined {
  background-color: transparent;
  color: var(--black);
  border: 1px solid var(--black);
}

.cta-outlined:hover {
  background-color: var(--black);
  color: var(--white);
  transform: translateY(-1px);
}

.cta-outlined:active {
  background-color: #333333;
  color: var(--white);
  transform: translateY(0);
}

/* CTA Outlined on dark backgrounds */
.cta-outlined-light {
  background-color: transparent;
  color: var(--white);
  border: 1px solid var(--white);
}

.cta-outlined-light:hover {
  background-color: var(--white);
  color: var(--black);
  transform: translateY(-1px);
}

.cta-outlined-light:active {
  background-color: rgba(255, 255, 255, 0.9);
  color: var(--black);
  transform: translateY(0);
}

/* CTA Ghost — solo testo, nessuno sfondo né bordo */
.cta-ghost {
  background-color: transparent;
  color: var(--black);
  border: 1px solid transparent;
  padding: 14px 39px;
}

.cta-ghost:hover {
  background-color: rgba(0, 0, 0, 0.04);
  color: var(--primary);
}

.cta-ghost:active {
  background-color: rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   2. Button Component (Req 8.17)
   Uppercase bold, Tema chiaro + Tema scuro
   Varianti: Filled, Outlined, Ghost
   -------------------------------------------------------------------------- */
.btn-luxury {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 40px;
  min-height: 50px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-luxury:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* --- Tema Chiaro (su sfondo chiaro) --- */

/* Filled — sfondo verde scuro, testo bianco */
.btn-luxury-filled {
  background-color: var(--primary);
  color: var(--white);
  border: 1px solid var(--primary);
}

.btn-luxury-filled:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-light);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(24, 48, 40, 0.25);
  transform: translateY(-1px);
}

.btn-luxury-filled:active {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(0);
}

/* Outlined — trasparente, bordo grigio scuro, testo nero */
.btn-luxury-outlined {
  background-color: transparent;
  color: var(--black);
  border: 1px solid var(--gray-dark);
}

.btn-luxury-outlined:hover {
  background-color: var(--black);
  border-color: var(--black);
  color: var(--white);
  transform: translateY(-1px);
}

.btn-luxury-outlined:active {
  background-color: #333333;
  border-color: #333333;
  color: var(--white);
  transform: translateY(0);
}

/* Ghost — nessuno sfondo né bordo, testo nero */
.btn-luxury-ghost {
  background-color: transparent;
  color: var(--black);
  border: 1px solid transparent;
}

.btn-luxury-ghost:hover {
  background-color: rgba(0, 0, 0, 0.04);
  color: var(--primary);
}

.btn-luxury-ghost:active {
  background-color: rgba(0, 0, 0, 0.08);
}

/* --- Tema Scuro (su sfondo scuro/verde) --- */

/* Filled — sfondo bianco, testo verde scuro */
.btn-luxury-dark.btn-luxury-filled {
  background-color: var(--white);
  color: var(--primary);
  border: 1px solid var(--white);
}

.btn-luxury-dark.btn-luxury-filled:hover {
  background-color: var(--gray-light);
  border-color: var(--gray-light);
  color: var(--primary);
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.btn-luxury-dark.btn-luxury-filled:active {
  background-color: #e0e0e0;
  border-color: #e0e0e0;
  transform: translateY(0);
}

/* Outlined — trasparente, bordo bianco/grigio chiaro, testo bianco */
.btn-luxury-dark.btn-luxury-outlined {
  background-color: transparent;
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.btn-luxury-dark.btn-luxury-outlined:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--white);
  color: var(--white);
  transform: translateY(-1px);
}

.btn-luxury-dark.btn-luxury-outlined:active {
  background-color: rgba(255, 255, 255, 0.15);
  transform: translateY(0);
}

/* Ghost — nessuno sfondo né bordo, testo bianco */
.btn-luxury-dark.btn-luxury-ghost {
  background-color: transparent;
  color: var(--white);
  border: 1px solid transparent;
}

.btn-luxury-dark.btn-luxury-ghost:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.btn-luxury-dark.btn-luxury-ghost:active {
  background-color: rgba(255, 255, 255, 0.12);
}

/* --------------------------------------------------------------------------
   3. Toast Notification (Req 8.13)
   Angolo basso-destra, sfondo #183028 semi-trasparente, bordo bianco sottile
   -------------------------------------------------------------------------- */
.toast-luxury {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  min-width: 320px;
  max-width: 420px;
  padding: var(--space-lg) var(--space-xl);
  background-color: rgba(24, 48, 40, 0.92);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 1100;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.toast-luxury.show {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.toast-luxury-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-luxury-content {
  flex: 1;
}

.toast-luxury-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: var(--space-xs);
}

.toast-luxury-message {
  font-size: 0.8125rem;
  opacity: 0.85;
}

.toast-luxury-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.3s ease;
  line-height: 1;
}

.toast-luxury-close:hover {
  color: var(--white);
}

/* Toast variants */
.toast-luxury-success .toast-luxury-icon {
  color: #6ee7b7;
}

.toast-luxury-error {
  background-color: rgba(193, 18, 31, 0.92);
  border-color: rgba(255, 255, 255, 0.25);
}

.toast-luxury-error .toast-luxury-icon {
  color: #fca5a5;
}

.toast-luxury-warning .toast-luxury-icon {
  color: var(--warning);
}

/* Slide-in animation keyframe */
@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.toast-luxury.animate-in {
  animation: toastSlideIn 0.3s ease forwards;
  pointer-events: auto;
}

.toast-luxury.animate-out {
  animation: toastSlideOut 0.3s ease forwards;
  pointer-events: none;
}

/* Toast stacking for multiple toasts */
.toast-luxury:nth-child(2) {
  bottom: calc(var(--space-xl) + 80px);
}

.toast-luxury:nth-child(3) {
  bottom: calc(var(--space-xl) + 160px);
}

/* ============================================
   Property Card — Catalogo griglia
   ============================================ */

.card-property {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-property:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.card-property-img-wrapper {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--gray-light, #efefef);
}

.card-property-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card-property:hover .card-property-img {
    transform: scale(1.03);
}

.card-property-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #ccc;
    background: var(--gray-light, #efefef);
}

.card-property-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 1rem 0.75rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
}

.card-property-price {
    color: #fff;
    font-weight: 400;
    font-size: 1.1rem;
    font-family: 'Bellefair', Georgia, serif;
}

.card-property-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
}

/* ============================================
   Photo Grid — Riordino drag & drop
   ============================================ */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.photo-grid-item {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: 8px;
    overflow: hidden;
    cursor: grab;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, opacity 0.2s ease;
}

.photo-grid-item:active {
    cursor: grabbing;
}

.photo-grid-item.dragging {
    opacity: 0.4;
    border-color: var(--primary, #183028);
}

.photo-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-badge-main {
    position: absolute;
    top: 4px;
    left: 4px;
    background: var(--primary, #183028);
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.photo-delete-form {
    position: absolute;
    top: 4px;
    right: 4px;
}

.photo-delete-btn {
    background: rgba(220, 53, 69, 0.85);
    color: #fff;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.photo-grid-item:hover .photo-delete-btn {
    opacity: 1;
}

/* ============================================
   Upload Zone
   ============================================ */

.upload-zone {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease;
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone-active {
    border-color: var(--primary, #183028);
    background: rgba(24, 48, 40, 0.03);
}

/* ============================================
   Lightbox
   ============================================ */

.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10000;
    line-height: 1;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    padding: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
    z-index: 10000;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255,255,255,0.3);
}

.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }

/* ============================================
   Utility
   ============================================ */

.cursor-pointer { cursor: pointer; }

.card-luxury {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.05);
}

/* ============================================
   Calendar — Vista mensile e settimanale
   ============================================ */

.calendar-grid {
    width: 100%;
}

.calendar-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--primary, #183028);
    color: #fff;
}

.calendar-header-cell {
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calendar-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid #eee;
}

.calendar-cell {
    min-height: 100px;
    padding: 0.375rem;
    border-right: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s ease;
    overflow: hidden;
}

.calendar-cell:last-child {
    border-right: none;
}

.calendar-cell:hover {
    background: rgba(24, 48, 40, 0.03);
}

.calendar-cell-today {
    background: rgba(24, 48, 40, 0.06);
}

.calendar-cell-today .calendar-cell-date {
    background: var(--primary, #183028);
    color: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-cell-other {
    opacity: 0.4;
}

.calendar-cell-date {
    font-weight: 600;
    font-size: 0.8125rem;
    margin-bottom: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.calendar-event {
    padding: 2px 6px;
    border-radius: 4px;
    color: #fff;
    font-size: 0.6875rem;
    margin-bottom: 2px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s ease;
}

.calendar-event:hover {
    opacity: 0.85;
}

.calendar-event-time {
    font-weight: 600;
}

.calendar-event-title {
    font-weight: 400;
}

.calendar-event-sub {
    font-size: 0.625rem;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event-more {
    font-size: 0.6875rem;
    color: var(--primary, #183028);
    font-weight: 600;
    padding: 1px 4px;
    cursor: pointer;
}

/* ---- Vista settimanale ---- */

.calendar-week-grid {
    width: 100%;
    overflow-x: auto;
}

.calendar-week-header {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    background: var(--primary, #183028);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 2;
}

.calendar-week-time-header {
    padding: 0.5rem;
}

.calendar-week-day-header {
    padding: 0.5rem;
    text-align: center;
}

.calendar-week-day-header.calendar-week-today {
    background: rgba(255, 255, 255, 0.15);
}

.calendar-week-day-name {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calendar-week-day-num {
    font-size: 1.25rem;
    font-weight: 700;
}

.calendar-week-body {
    max-height: 600px;
    overflow-y: auto;
}

.calendar-week-row {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    border-bottom: 1px solid #f0f0f0;
}

.calendar-week-time {
    padding: 0.375rem;
    font-size: 0.75rem;
    color: #999;
    text-align: right;
    padding-right: 0.5rem;
    border-right: 1px solid #eee;
}

.calendar-week-cell {
    min-height: 50px;
    padding: 2px;
    border-right: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s ease;
}

.calendar-week-cell:hover {
    background: rgba(24, 48, 40, 0.03);
}

.calendar-event-week {
    font-size: 0.6875rem;
    padding: 3px 6px;
    border-radius: 4px;
    margin-bottom: 1px;
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .calendar-cell {
        min-height: 60px;
        padding: 0.25rem;
    }

    .calendar-event {
        font-size: 0.5625rem;
        padding: 1px 3px;
    }

    .calendar-event-time {
        display: none;
    }

    .calendar-header-cell {
        font-size: 0.6875rem;
        padding: 0.375rem 0.125rem;
    }

    .calendar-week-body {
        max-height: 400px;
    }
}

/* ============================================
   Quick Search — Dropdown risultati
   Requisiti: 24.1, 24.2, 24.3
   ============================================ */

.quick-search-wrapper {
    position: relative;
    width: 100%;
}

.quick-search-results {
    max-height: 420px;
    overflow-y: auto;
    padding: var(--space-sm, 0.5rem) 0;
    border: none;
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    background: var(--white, #fff);
}

.quick-search-results.show {
    display: block;
}

.quick-search-category {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-dark, #6b6b6b);
    display: flex;
    align-items: center;
    gap: 0.375rem;
    border-top: 1px solid var(--gray-light, #efefef);
    margin-top: 0.25rem;
}

.quick-search-category:first-child {
    border-top: none;
    margin-top: 0;
}

.quick-search-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--black, #000);
    transition: background-color 0.15s ease;
    cursor: pointer;
}

.quick-search-item:hover,
.quick-search-item.active {
    background-color: var(--gray-light, #efefef);
    color: var(--black, #000);
}

.quick-search-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(24, 48, 40, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--primary, #183028);
    font-size: 0.875rem;
}

.quick-search-item-body {
    flex: 1;
    min-width: 0;
}

.quick-search-item-title {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-search-item-meta {
    font-size: 0.75rem;
    color: var(--gray-dark, #6b6b6b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
