/* Container */
.sos-cal-container { border: none; border-radius: 0; overflow: hidden; box-shadow: none; }

/* Header */
.sos-cal-hdr { background: var(--sos-teal-light); padding: 16px 20px; border-bottom: 1px solid var(--sos-sand-200); display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.sos-cal-nav { display: flex; align-items: center; gap: 12px; }
.sos-cal-nav__btn { width: 38px; height: 38px; border-radius: var(--sos-radius-sm); background: var(--sos-teal); color: #fff; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 0.85rem; transition: background var(--sos-duration); }
.sos-cal-nav__btn:hover { background: var(--sos-teal-hover); }
.sos-cal-nav__title { font-family: var(--sos-font-display); font-size: 1.2rem; font-weight: 700; color: var(--sos-slate-800); min-width: 220px; text-align: center; }

/* Filter */
.sos-cal-filters select { padding: 8px 14px; border: 1px solid var(--sos-sand-200); border-radius: var(--sos-radius-sm); }

/* Table wrapper */
.sos-cal-wrap { width: 100%; border-top: 1px solid var(--sos-sand-200); overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Table */
.sos-cal-tbl { width: 100%; border-collapse: collapse; background: var(--sos-white); table-layout: fixed; min-width: 100%; }
.sos-cal-tbl thead { background: var(--sos-sand-50); }
.sos-cal-tbl th { padding: 8px 0; text-align: center; font-weight: 600; font-size: 0.7rem; border-bottom: 2px solid var(--sos-sand-200); color: var(--sos-gray-500); white-space: nowrap; }
.sos-cal-tbl th:first-child { text-align: left; padding-left: 14px; width: 280px; min-width: 280px; background: var(--sos-sand-50); position: sticky; left: 0; z-index: 2; }

/* Rows */
.sos-cal-tbl tbody tr { border-bottom: 1px solid var(--sos-sand-100); }
.sos-cal-tbl td { padding: 0; text-align: center; height: 30px; font-size: 0.7rem; color: var(--sos-slate-800); vertical-align: middle; white-space: nowrap; border-right: 1px solid var(--sos-sand-100); line-height: 30px; font-weight: 500; }
.sos-cal-tbl td:first-child { text-align: left; padding-left: 14px; padding-right: 8px; font-weight: 500; background: var(--sos-white); border-right: 1px solid var(--sos-sand-200); position: sticky; left: 0; z-index: 1; width: 280px; min-width: 280px; }
.sos-cal-tbl tbody tr:hover td:first-child { background: var(--sos-sand-50); }

/* Property name link + favorite heart */
.sos-cal-pname-wrap { display: flex; align-items: center; gap: 6px; }
.sos-cal-pname { color: var(--sos-teal); text-decoration: none; font-size: 0.85rem; font-weight: 600; transition: color var(--sos-duration); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.sos-cal-pname:hover { color: var(--sos-teal-hover); text-decoration: underline; }
.sos-fav-heart--cal {
    position: static; width: 24px; height: 24px; font-size: 0.65rem;
    background: none; color: var(--sos-sand-300); flex-shrink: 0;
    border: none; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: color 0.2s;
}
.sos-fav-heart--cal:hover { color: #ef4444; }
.sos-fav-heart--cal.sos-fav-heart--active { color: #ef4444; }

/* Section headers */
.sos-cal-section td { background: var(--sos-teal-light) !important; border-bottom: 2px solid var(--sos-sand-200); height: 38px; font-weight: 700; font-size: 0.9rem; color: var(--sos-slate-800); }
.sos-cal-section td:first-child { background: var(--sos-teal-light) !important; position: sticky; left: 0; z-index: 2; padding-left: 14px; }

/* Cell states */
.sos-cal-tbl td.ca-avail { background: var(--sos-white); cursor: pointer; }
.sos-cal-tbl td.ca-avail:hover { background: var(--sos-teal-light) !important; }
.sos-cal-tbl td.ca-booked { background: var(--sos-teal); color: #fff; }
.sos-cal-tbl td.ca-checkin { background: linear-gradient(to bottom right, var(--sos-white) 50%, var(--sos-teal) 50%); cursor: pointer; border-radius: 0 !important; }
.sos-cal-tbl td.ca-checkin:hover { opacity: 0.85; }
.sos-cal-tbl td.ca-checkout { background: linear-gradient(to bottom right, var(--sos-teal) 50%, var(--sos-white) 50%); cursor: pointer; border-radius: 0 !important; }
.sos-cal-tbl td.ca-checkout:hover { opacity: 0.85; }
.sos-cal-tbl td.ca-flip { background: linear-gradient(to bottom right, var(--sos-teal) 50%, var(--sos-teal-hover) 50%); color: #fff; border-radius: 0 !important; }
.sos-cal-tbl td.ca-past { background: var(--sos-sand-200); color: var(--sos-gray-400); }
.sos-cal-tbl td.ca-today { box-shadow: inset 0 0 0 2px var(--sos-slate-800); }
.sos-cal-tbl td.ca-weekend { background: var(--sos-sand-50); }
.sos-cal-tbl td.ca-avail.ca-weekend { cursor: pointer; }
.sos-cal-tbl td.ca-avail.ca-weekend:hover { background: var(--sos-teal-light) !important; }
.sos-cal-tbl td.ca-booked.ca-weekend { background: var(--sos-teal); color: #fff; }
.sos-cal-tbl td.ca-checkin.ca-weekend { background: linear-gradient(to bottom right, var(--sos-sand-50) 50%, var(--sos-teal) 50%); cursor: pointer; border-radius: 0 !important; }
.sos-cal-tbl td.ca-checkout.ca-weekend { background: linear-gradient(to bottom right, var(--sos-teal) 50%, var(--sos-sand-50) 50%); border-radius: 0 !important; }
.sos-cal-tbl td.ca-flip.ca-weekend { background: linear-gradient(to bottom right, var(--sos-teal) 50%, var(--sos-teal-hover) 50%); color: #fff; border-radius: 0 !important; }

/* Min stay blocked dates */
.sos-cal-tbl td.ca-min-blocked { opacity: 0.35; cursor: not-allowed !important; }

/* Selection highlights */
.sos-cal-tbl td.ca-sel-start { background: var(--sos-slate-800) !important; color: #fff !important; font-weight: 700; }
.sos-cal-tbl td.ca-sel-end { background: var(--sos-slate-800) !important; color: #fff !important; font-weight: 700; }
.sos-cal-tbl td.ca-sel-range { background: var(--sos-sand-300) !important; color: var(--sos-slate-800) !important; }

/* Legend */
.sos-cal-legend { display: flex; gap: 20px; padding: 14px 20px; background: var(--sos-sand-50); flex-wrap: wrap; border-top: 1px solid var(--sos-sand-200); align-items: center; }
.sos-cal-legend__item { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--sos-gray-600); font-weight: 500; }
.sos-cal-swatch { width: 18px; height: 18px; border-radius: 0; border: 1px solid var(--sos-sand-300); flex-shrink: 0; }
.sos-cal-hint { text-align: center; padding: 14px 20px 4px; font-size: 0.85rem; color: var(--sos-gray-500); font-style: italic; }

/* Loading */
.sos-cal-loading { text-align: center; padding: 60px 20px; color: var(--sos-gray-500); font-size: 0.95rem; }
.sos-cal-dot { display: inline-block; animation: sosCalPulse 1.2s infinite; font-size: 1.5rem; margin: 0 2px; }
.sos-cal-dot:nth-child(2) { animation-delay: 0.2s; }
.sos-cal-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes sosCalPulse { 0%,80%,100% { opacity: 0.3; } 40% { opacity: 1; } }

/* Popup overlay */
.sos-cal-popup-overlay { display: none; position: fixed; inset: 0; z-index: 99999; background: rgba(0,0,0,0.45); align-items: center; justify-content: center; font-family: var(--sos-font-body); }
.sos-cal-popup-overlay--active { display: flex; }
.sos-cal-popup { background: var(--sos-white); border-radius: var(--sos-radius-xl); box-shadow: var(--sos-shadow-xl); max-width: 420px; width: 92%; overflow: hidden; animation: sosPopIn 0.25s ease; }
@keyframes sosPopIn { from { opacity: 0; transform: scale(0.95) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.sos-cal-popup__imgwrap { position: relative; overflow: hidden; }
.sos-cal-popup__img { width: 100%; height: 210px; object-fit: cover; display: block; transition: opacity 0.15s; }
.sos-cal-popup__badge { position: absolute; top: 12px; left: 12px; background: rgba(255,255,255,0.92); backdrop-filter: blur(8px); color: var(--sos-slate-800); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 5px 10px; border-radius: var(--sos-radius-sm); box-shadow: var(--sos-shadow-sm); }
.sos-cal-popup__garr { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; background: rgba(0,0,0,0.45); color: #fff; border: none; border-radius: 50%; cursor: pointer; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; z-index: 2; backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.2s; }
.sos-cal-popup__imgwrap:hover .sos-cal-popup__garr { opacity: 1; }
.sos-cal-popup__garr:hover { background: rgba(0,0,0,0.65); }
.sos-cal-popup__garr--prev { left: 10px; }
.sos-cal-popup__garr--next { right: 10px; }
.sos-cal-popup__gcnt { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,0.5); color: #fff; font-size: 0.7rem; font-weight: 600; padding: 3px 10px; border-radius: var(--sos-radius-full); z-index: 2; backdrop-filter: blur(4px); }
.sos-cal-popup__body { padding: 18px 22px 22px; }
.sos-cal-popup__body h3 { font-size: 1.15rem; font-weight: 700; margin: 0 0 10px; }
.sos-cal-popup__stats { display: flex; gap: 16px; padding: 0 0 12px; margin: 0 0 12px; border-bottom: 1px solid var(--sos-sand-200); font-size: 0.85rem; color: var(--sos-gray-600); }
.sos-cal-popup__stats i { color: var(--sos-teal); margin-right: 4px; }
.sos-cal-popup__dates { display: flex; gap: 16px; margin-bottom: 14px; }
.sos-cal-popup__date { flex: 1; }
.sos-cal-popup__date-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--sos-gray-500); margin-bottom: 4px; }
.sos-cal-popup__date-val { font-size: 0.95rem; font-weight: 600; color: var(--sos-slate-800); }
.sos-cal-popup__nights { text-align: center; padding: 10px; background: var(--sos-teal-light); border-radius: var(--sos-radius-sm); font-size: 0.85rem; color: var(--sos-gray-600); margin-bottom: 12px; }
.sos-cal-popup__nights strong { color: var(--sos-teal); font-weight: 700; }
.sos-cal-popup__pricing { text-align: center; margin-bottom: 16px; min-height: 44px; }
.sos-cal-popup__btns { display: flex; gap: 10px; }
.sos-cal-popup__book { flex: 1; background: var(--sos-orange); color: #fff; border: none; padding: 14px 20px; border-radius: var(--sos-radius-md); font-family: var(--sos-font-display); font-size: 0.95rem; font-weight: 700; cursor: pointer; text-align: center; text-decoration: none; display: block; transition: background var(--sos-duration); }
.sos-cal-popup__book:hover { background: var(--sos-orange-hover); color: #fff; }
.sos-cal-popup__cancel { flex: 0 0 auto; background: transparent; color: var(--sos-gray-500); border: 1px solid var(--sos-sand-200); padding: 14px 20px; border-radius: var(--sos-radius-md); font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all var(--sos-duration); }
.sos-cal-popup__cancel:hover { background: var(--sos-sand-50); border-color: var(--sos-sand-300); }

/* Responsive */
@media (max-width: 768px) {
    .sos-cal-hdr { flex-direction: column; gap: 12px; padding: 12px; }
    .sos-cal-nav__title { min-width: 160px; font-size: 1rem; }
    .sos-cal-filters { width: 100%; }
    .sos-cal-filters select { width: 100%; }
    .sos-cal-tbl { table-layout: auto; min-width: 900px; }
    .sos-cal-tbl th, .sos-cal-tbl td { padding: 8px 4px; font-size: 0.7rem; min-width: 32px; }
    .sos-cal-tbl th:first-child, .sos-cal-tbl td:first-child { min-width: 180px; width: 180px; }
    .sos-cal-popup { max-width: 95%; }
    .sos-cal-popup__img { height: 160px; }
    .sos-cal-popup__btns { flex-direction: column; }
}
@media (min-width: 769px) and (max-width: 1024px) {
    .sos-cal-tbl th, .sos-cal-tbl td { padding: 4px 2px; font-size: 0.65rem; min-width: 28px; }
    .sos-cal-tbl th:first-child, .sos-cal-tbl td:first-child { width: 220px; min-width: 220px; }
}
