/* ═══════════════════════════════════════════════════
   Splendido RentCAL — stylesheet
   Primary: #1a7cb8  Accent: #f5a623
   ═══════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue:    #1a7cb8;
    --blue-dk: #145f8e;
    --orange:  #f5a623;
    --orange-dk: #d48a10;
    --free-bg:    rgba(56,  181, 74,  0.80);
    --occ-bg:     rgba(220,  53, 53,  0.80);
    --free-light: rgba(56,  181, 74,  0.15);
    --occ-light:  rgba(220,  53, 53,  0.15);
    --radius: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,.10);
}

html { font-size: 15px; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #f0f4f8; color: #222; min-height: 100vh; display: flex; flex-direction: column; }
.calendar-page .cal-main,
.admin-page .admin-main { flex: 1; }
a    { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Buttons ────────────────────────────────────── */
.btn {
    display: inline-block; padding: 8px 18px; border-radius: 6px; border: none;
    cursor: pointer; font-size: .875rem; font-weight: 600; transition: .15s;
    text-decoration: none; line-height: 1.4;
}
.btn-primary  { background: var(--blue);    color: #fff; }
.btn-primary:hover { background: var(--blue-dk); color: #fff; text-decoration: none; }
.btn-outline  { background: #fff; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-outline:hover { background: var(--blue); color: #fff; text-decoration: none; }
.btn-danger   { background: #dc3535; color: #fff; border: none; }
.btn-danger:hover { background: #b52a2a; }
.btn-sm       { padding: 5px 12px; font-size: .8rem; }
.btn-xs       { padding: 3px 8px;  font-size: .75rem; }
.btn-block    { display: block; width: 100%; text-align: center; }
.btn-nav      { background: var(--blue); color: #fff; padding: 7px 16px; font-size: .85rem; }
.btn-nav:hover { background: var(--blue-dk); color: #fff; text-decoration: none; }
.btn-today    { background: var(--orange); }
.btn-today:hover { background: var(--orange-dk); }

/* ── Alerts ─────────────────────────────────────── */
.alert { padding: 11px 16px; border-radius: 6px; margin-bottom: 16px; font-size: .9rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ── Header ─────────────────────────────────────── */
.admin-header, .cal-header {
    background: var(--blue); color: #fff; padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    position: sticky; top: 0; z-index: 100;
}
.header-inner {
    max-width: 1100px; margin: 0 auto; padding: 10px 20px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; min-height: 0;
}
.header-brand  { display: flex; align-items: center; gap: 12px; min-width: 0; overflow: hidden; }
.header-logo   { height: 50px; width: auto; flex-shrink: 0; max-width: 140px; object-fit: contain; }
.header-title  { font-size: 1.15rem; color: #fff; letter-spacing: .02em; white-space: nowrap; }
.header-title strong { font-weight: 800; }
.header-title em { color: var(--orange); font-style: normal; font-size: .85em; }
.landlord-name { font-size: 1rem; color: rgba(255,255,255,.85); font-weight: 500; }

/* ── Login / PIN page ────────────────────────────── */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box {
    background: #fff; padding: 40px 36px; border-radius: 12px;
    box-shadow: var(--shadow); width: 100%; max-width: 380px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { max-width: 220px; margin-bottom: 12px; display: block; margin-left: auto; margin-right: auto; }
.login-logo h1 { font-size: 1.5rem; color: var(--blue); font-weight: 700; }
.login-logo h1 span { color: var(--orange); }
.pin-greeting { margin-bottom: 20px; color: #555; font-size: 1rem; }

/* ── Forms ───────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: .82rem; font-weight: 600; color: #555; }
.form-group input[type=text],
.form-group input[type=password],
.form-group input[type=url] {
    padding: 8px 11px; border: 1.5px solid #d0d8e4; border-radius: 6px;
    font-size: .9rem; transition: border-color .15s;
}
.form-group input:focus { outline: none; border-color: var(--blue); }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-row-sm { gap: 8px; }
.form-group-wide { flex: 1; min-width: 200px; }
.form-group-btn  { flex: 0 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.form-check label { display: flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 500; cursor: pointer; }
.form-check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); }

/* ── Admin Layout ────────────────────────────────── */
.admin-main { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }
.card { background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px; }
.card-title { font-size: 1.05rem; font-weight: 700; color: var(--blue); margin-bottom: 18px; }
.empty-note { color: #999; font-size: .9rem; font-style: italic; }

/* Landlord card */
.landlord-card { border: 1.5px solid #e2eaf3; border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.landlord-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.landlord-info { display: flex; flex-direction: column; gap: 5px; }
.landlord-info strong { font-size: 1rem; color: #222; }
.landlord-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.slug-badge { background: #eef3f9; color: var(--blue); padding: 2px 8px; border-radius: 4px; font-size: .78rem; font-family: monospace; }
.pin-badge { font-size: .78rem; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.pin-on  { background: #fff3cd; color: #856404; }
.pin-off { background: #d1e7dd; color: #0f5132; }
.edit-form { background: #f6f9fd; padding: 14px; border-radius: 6px; margin-top: 12px; border: 1px solid #dde8f0; }

/* Apartments table */
.apartments-section { margin-top: 16px; border-top: 1px solid #eee; padding-top: 14px; }
.apartments-section h4 { font-size: .85rem; color: #666; margin-bottom: 10px; }
.apt-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.apt-table th { background: #f0f4f8; text-align: left; padding: 7px 10px; font-size: .78rem; color: #555; font-weight: 600; }
.apt-table td { padding: 7px 10px; border-bottom: 1px solid #f0f4f8; vertical-align: middle; }
.apt-actions { display: flex; gap: 4px; }
.url-truncate { display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #888; font-family: monospace; font-size: .78rem; vertical-align: middle; }
.add-apt-form { margin-top: 12px; }

/* ── Calendar Page ───────────────────────────────── */
.cal-main { max-width: 1100px; margin: 0 auto; padding: 20px; }

.apt-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.apt-tab {
    padding: 8px 20px; border-radius: 20px; font-size: .88rem; font-weight: 600;
    border: 2px solid var(--blue); color: var(--blue); background: #fff;
    text-decoration: none; transition: .15s;
}
.apt-tab:hover, .apt-tab.active { background: var(--blue); color: #fff; text-decoration: none; }
.apt-single-title h2 { font-size: 1.1rem; color: var(--blue); margin-bottom: 16px; }

.cal-nav { display: flex; gap: 10px; align-items: center; margin-bottom: 24px; flex-wrap: wrap; }

/* 3 months grid */
.months-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.month-block { background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding: 16px; }
.month-title { font-size: 1rem; font-weight: 700; color: var(--blue); margin-bottom: 12px; text-align: center; }

/* Day grid: 7 columns */
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.day-header {
    font-size: .7rem; font-weight: 700; text-align: center; color: #888;
    padding: 4px 0;
}
.day-cell {
    position: relative;
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 600; color: #fff;
    overflow: hidden;
    cursor: default;
}
.day-cell.empty        { background: transparent; }
.day-free              { background: var(--free-bg); color: #185c20; }
.day-occupied          { background: var(--occ-bg); color: #fff; }
.day-today             { outline: 2.5px solid var(--orange); outline-offset: -2px; }
.day-num               { position: relative; z-index: 2; }

/* Checkin: left=free, right=occupied (diagonal split) */
.day-checkin {
    background: linear-gradient(
        135deg,
        var(--free-bg) 50%,
        var(--occ-bg)  50%
    );
    color: #185c20;
}
/* Checkout: left=occupied, right=free */
.day-checkout {
    background: linear-gradient(
        135deg,
        var(--occ-bg)  50%,
        var(--free-bg) 50%
    );
    color: #fff;
}
/* Both same day checkout+checkin */
.day-checkin_checkout {
    background: linear-gradient(
        135deg,
        var(--occ-bg) 50%,
        var(--free-bg) 50%
    );
    color: #fff;
}

/* Legend */
.legend {
    display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
    background: #fff; padding: 14px 18px; border-radius: 8px;
    box-shadow: var(--shadow); margin-bottom: 16px;
}
.legend-item { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.legend-box  { width: 24px; height: 24px; border-radius: 4px; display: inline-block; }
.legend-box.free     { background: var(--free-bg); }
.legend-box.occupied { background: var(--occ-bg); }
.legend-box.checkin  { background: linear-gradient(135deg, var(--free-bg) 50%, var(--occ-bg) 50%); }
.legend-box.checkout { background: linear-gradient(135deg, var(--occ-bg) 50%, var(--free-bg) 50%); }

.update-note { font-size: .78rem; color: #aaa; margin-top: 4px; }

/* ── Share Panel ─────────────────────────────────── */
.share-panel {
    background: #f6f9fd;
    border: 1.5px solid #dde8f0;
    border-radius: 8px;
    padding: 14px 16px;
    margin: 12px 0;
}
.share-label {
    font-size: .78rem;
    font-weight: 700;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 10px;
}
.share-url-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    align-items: center;
}
.share-url-input {
    flex: 1;
    padding: 7px 11px;
    border: 1.5px solid #d0d8e4;
    border-radius: 6px;
    font-size: .8rem;
    font-family: monospace;
    color: #555;
    background: #fff;
    min-width: 0;
}
.btn-copy {
    flex-shrink: 0;
    transition: background .2s, color .2s, border-color .2s;
}
.share-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.btn-share {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 7px;
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
    transition: .15s;
    border: none;
    cursor: pointer;
}
.btn-share:hover { opacity: .88; text-decoration: none; }
.btn-whatsapp { background: #25d366; color: #fff; }
.btn-viber    { background: #7360f2; color: #fff; }
.btn-email    { background: var(--blue); color: #fff; }
.share-pin-note {
    font-size: .78rem;
    color: #856404;
    background: #fff8e1;
    border-radius: 5px;
    padding: 4px 10px;
    display: inline-block;
    margin: 0;
}
.share-pin-public {
    color: #0f5132;
    background: #d1e7dd;
}


.admin-footer, .cal-footer {
    display: block;
    width: 100%;
    clear: both;
    text-align: center;
    padding: 20px;
    font-size: .8rem;
    color: #aaa;
    border-top: 1px solid #e8edf3;
    margin-top: 24px;
    box-sizing: border-box;
    overflow: hidden;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 900px) {
    .months-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .header-inner { padding: 10px 14px; }
    .admin-main, .cal-main { padding: 14px; }
    .card { padding: 16px; }
    .landlord-header { flex-direction: column; }
    .landlord-actions { flex-wrap: wrap; }
    .apt-table { font-size: .75rem; }
    .url-truncate { max-width: 140px; }
    .day-cell { font-size: .65rem; }
    .month-block { padding: 10px; }
    .cal-nav { gap: 6px; }
    .btn-nav { padding: 6px 10px; font-size: .78rem; }
}

/* ── Booking Tables ──────────────────────────────── */
.booking-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}
.btable-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}
.btable-title {
    padding: 12px 16px;
    font-size: .88rem;
    font-weight: 800;
    letter-spacing: .01em;
}
.btable-title-occ  { background: rgba(220,53,53,.08);  color: #b91c1c; border-bottom: 2px solid rgba(220,53,53,.2); }
.btable-title-free { background: rgba(40,167,69,.08);  color: #166534; border-bottom: 2px solid rgba(40,167,69,.2); }
.btable-empty { padding: 14px 16px; color: var(--muted); font-size: .85rem; font-style: italic; }
.btable-wrap { overflow-x: auto; }
.btable {
    width: 100%;
    border-collapse: collapse;
    font-size: .83rem;
}
.btable th {
    background: #f8fafc;
    padding: 7px 12px;
    text-align: left;
    font-size: .72rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}
.btable td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f5fb;
    color: var(--text);
    white-space: nowrap;
}
.btable tbody tr:last-child td { border-bottom: none; }
.btable tbody tr:hover { background: #f8fafc; }
.row-past td { color: var(--muted); }
.td-num { color: var(--muted); font-size: .75rem; font-weight: 700; width: 32px; }
.td-nights { text-align: center; }
.nights-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: .75rem;
    font-weight: 700;
}
.nights-occ  { background: rgba(220,53,53,.12);  color: #b91c1c; }
.nights-free { background: rgba(40,167,69,.12);  color: #166534; }

@media (max-width: 700px) {
    .booking-tables { grid-template-columns: 1fr; }
}

/* ── Dropdown Menu ───────────────────────────────── */
.nav-menu {
    position: relative;
}
.nav-menu-btn {
    background: rgba(255,255,255,.15);
    border: 1.5px solid rgba(255,255,255,.3);
    color: #fff;
    border-radius: 7px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 700;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: .15s;
    white-space: nowrap;
}
.nav-menu-btn:hover {
    background: rgba(255,255,255,.25);
}
.nav-menu-btn .hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.nav-menu-btn .hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}
.nav-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    min-width: 210px;
    z-index: 999;
    overflow: hidden;
    border: 1px solid var(--border);
}
.nav-dropdown.open {
    display: block;
    animation: dropIn .15s ease;
}
@keyframes dropIn {
    from { opacity:0; transform: translateY(-6px); }
    to   { opacity:1; transform: translateY(0); }
}
.nav-dropdown a,
.nav-dropdown span {
    display: block;
    padding: 12px 18px;
    font-size: .9rem;
    font-weight: 600;
    color: #1a2332;
    text-decoration: none;
    border-bottom: 1px solid #eef2f7;
    transition: background .1s;
    font-family: 'Segoe UI', Arial, sans-serif;
    letter-spacing: 0;
}
.nav-dropdown a:last-child,
.nav-dropdown span:last-child {
    border-bottom: none;
}
.nav-dropdown a:hover {
    background: #eef6fc;
    color: #1a7cb8;
    text-decoration: none;
}
.nav-dropdown span {
    color: #aab4c0;
    cursor: default;
    font-style: italic;
    font-weight: 400;
    font-size: .82rem;
}
.nav-dropdown .nav-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ── Bottom nav (mobile) ─────────────────────────── */
.cal-nav-bottom {
    display: none;
    margin-bottom: 16px;
}
@media (max-width: 760px) {
    .cal-nav-bottom {
        display: flex;
    }
}

/* ── Central login extras ────────────────────────── */
.login-help {
    margin-top: 14px;
    font-size: .78rem;
    color: var(--muted);
    text-align: center;
}
.login-help em { color: var(--blue); font-style: normal; font-weight: 600; }
.login-footer {
    text-align: center;
    padding: 16px;
    font-size: .75rem;
    color: #aaa;
    margin-top: 12px;
}
.login-footer a { color: var(--blue); }

/* Logout button in calendar header */
.btn-logout-cal {
    padding: 4px 12px;
    border-radius: 6px;
    border: 1.5px solid rgba(255,255,255,.4);
    color: rgba(255,255,255,.85);
    font-size: .75rem;
    font-weight: 600;
    text-decoration: none;
    transition: .15s;
    white-space: nowrap;
}
.btn-logout-cal:hover {
    background: rgba(255,255,255,.2);
    color: #fff;
    text-decoration: none;
}
