/**
 * custom.css — Hausnimm Manager custom styles
 *
 * Overrides and extensions to Bootstrap 5.
 * All application-specific styles live here — no inline CSS anywhere else.
 *
 * Design direction: Refined heritage / archival aesthetic
 * Primary palette: Deep slate navy + warm parchment + antique gold accents
 * Typography: Playfair Display (headings) + Source Sans 3 (body)
 */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
    --hn-navy:       #1e2d40;
    --hn-navy-light: #2c3e56;
    --hn-gold:       #c9a84c;
    --hn-gold-light: #e8c97a;
    --hn-parchment:  #f8f4ed;
    --hn-warm-gray:  #e8e2d9;
    --hn-text:       #2a2a2a;
    --hn-text-muted: #6b6256;
    --hn-border:     #d4cbbf;
    --hn-shadow:     rgba(30, 45, 64, 0.12);
    --hn-font-heading: 'Playfair Display', Georgia, serif;
    --hn-font-body:    'Source Sans 3', 'Segoe UI', sans-serif;
}

/* ===== BASE ===== */
body {
    font-family: var(--hn-font-body);
    background-color: var(--hn-parchment);
    color: var(--hn-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5 {
    font-family: var(--hn-font-heading);
    color: var(--hn-navy);
}

/* ===== NAVIGATION BAR ===== */
.hn-navbar {
    background: linear-gradient(135deg, var(--hn-navy) 0%, var(--hn-navy-light) 100%);
    border-bottom: 3px solid var(--hn-gold);
    padding: 0.6rem 1.5rem;
    box-shadow: 0 2px 12px var(--hn-shadow);
}

.hn-brand-title {
    font-family: var(--hn-font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--hn-gold-light);
    letter-spacing: 0.02em;
}

.hn-navbar .nav-link {
    color: rgba(255,255,255,0.85) !important;
    font-size: 0.92rem;
    font-weight: 500;
    padding: 0.5rem 0.85rem;
    border-radius: 4px;
    transition: background 0.18s, color 0.18s;
}

.hn-navbar .nav-link:hover,
.hn-navbar .nav-link.active {
    background: rgba(201,168,76,0.18);
    color: var(--hn-gold-light) !important;
}

.hn-username {
    font-size: 0.88rem;
    opacity: 0.75;
    cursor: default;
}

/* ===== MAIN CONTENT ===== */
main.container-fluid {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding-left: 2rem;
    padding-right: 2rem;
}

/* ===== FLASH MESSAGES ===== */
.hn-flash {
    border-left: 4px solid currentColor;
    border-radius: 6px;
    font-size: 0.95rem;
}

/* ===== PAGE HEADER BLOCK ===== */
.hn-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--hn-warm-gray);
}

.hn-page-header h1 {
    font-size: 1.8rem;
    margin: 0;
}

/* ===== CARDS ===== */
.card {
    border: 1px solid var(--hn-border);
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--hn-shadow);
    background: #fff;
}

.card-header {
    background: linear-gradient(135deg, var(--hn-navy) 0%, var(--hn-navy-light) 100%);
    color: white;
    font-family: var(--hn-font-heading);
    font-size: 1.05rem;
    border-radius: 7px 7px 0 0 !important;
    border-bottom: 2px solid var(--hn-gold);
    padding: 0.8rem 1.25rem;
}

.card-header i {
    color: var(--hn-gold-light);
}

/* ===== HOUSE LIST TABLE ===== */
.hn-table {
    font-size: 0.92rem;
}

.hn-table thead th {
    background-color: var(--hn-navy);
    color: white;
    border-color: var(--hn-navy-light);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    padding: 0.75rem 1rem;
}

.hn-table thead th a {
    color: var(--hn-gold-light);
    text-decoration: none;
}

.hn-table thead th a:hover {
    color: #fff;
}

.hn-table thead th .sort-icon {
    margin-left: 4px;
    opacity: 0.6;
    font-size: 0.75rem;
}

.hn-table tbody tr {
    cursor: pointer;
    transition: background 0.12s;
}

.hn-table tbody tr:hover {
    background-color: rgba(201,168,76,0.08);
}

.hn-table td {
    padding: 0.7rem 1rem;
    vertical-align: middle;
    border-color: var(--hn-warm-gray);
}

/* ===== CATEGORY BADGE ===== */
.hn-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 6px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    white-space: nowrap;
}

.hn-category-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(255,255,255,0.7);
    flex-shrink: 0;
}

/* ===== SEARCH & FILTER BAR ===== */
.hn-filter-bar {
    background: #fff;
    border: 1px solid var(--hn-border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 4px var(--hn-shadow);
}

/* ===== DETAIL PAGE ===== */
.hn-detail-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--hn-text-muted);
    margin-bottom: 2px;
}

.hn-detail-value {
    font-size: 0.97rem;
    color: var(--hn-text);
    min-height: 1.4em;
}

.hn-detail-value.empty {
    color: var(--hn-text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

.hn-detail-row {
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--hn-warm-gray);
}

.hn-detail-row:last-child {
    border-bottom: none;
}

/* ===== MAP CONTAINERS ===== */
.hn-map-container {
    height: 500px;
    border-radius: 6px;
    border: 1px solid var(--hn-border);
    overflow: hidden;
}

/* ===== FORMS ===== */
.form-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--hn-navy);
    margin-bottom: 0.3rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--hn-gold);
    box-shadow: 0 0 0 0.2rem rgba(201,168,76,0.25);
}

.form-text {
    color: var(--hn-text-muted);
    font-size: 0.8rem;
}

/* Category color swatch in select */
.hn-cat-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.2);
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ===== BUTTONS ===== */
.btn-hn-primary {
    background: var(--hn-navy);
    color: white;
    border: none;
    font-weight: 600;
}

.btn-hn-primary:hover {
    background: var(--hn-navy-light);
    color: white;
}

.btn-hn-gold {
    background: var(--hn-gold);
    color: var(--hn-navy);
    border: none;
    font-weight: 700;
}

.btn-hn-gold:hover {
    background: var(--hn-gold-light);
    color: var(--hn-navy);
}

/* ===== LOGIN PAGE ===== */
.hn-login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--hn-navy) 0%, #0f1a28 100%);
    padding: 2rem 1rem;
}

.hn-login-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.hn-login-header {
    background: linear-gradient(135deg, var(--hn-navy-light), var(--hn-navy));
    border-bottom: 3px solid var(--hn-gold);
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
}

.hn-login-logo {
    height: 60px;
    margin-bottom: 1rem;
}

.hn-login-title {
    font-family: var(--hn-font-heading);
    font-size: 1.6rem;
    color: var(--hn-gold-light);
    margin: 0;
}

.hn-login-subtitle {
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

.hn-login-body {
    background: #fff;
    padding: 2rem 1.75rem;
}

/* ===== PAGINATION ===== */
.page-link {
    color: var(--hn-navy);
    border-color: var(--hn-border);
}

.page-link:hover {
    background-color: var(--hn-warm-gray);
    color: var(--hn-navy);
    border-color: var(--hn-border);
}

.page-item.active .page-link {
    background-color: var(--hn-navy);
    border-color: var(--hn-navy);
    color: white;
}

/* ===== FOOTER ===== */
.hn-footer {
    background: var(--hn-navy);
    border-top: 3px solid var(--hn-gold);
    color: rgba(255,255,255,0.65);
    padding: 1rem 2rem;
    font-size: 0.83rem;
    margin-top: 2rem;
}

.hn-footer-title {
    font-family: var(--hn-font-heading);
    color: var(--hn-gold-light);
    font-weight: 700;
}

.hn-footer-commission {
    line-height: 1.5;
}

/* ===== RICH TEXT CONTENT (Quill output display in detail view) ===== */
/* Quill 2.x saves ALL lists as <ol> with data-list="bullet" or data-list="ordered"
   on each <li>. Standard ul/ol CSS does not work — we must target the data attribute. */
.hn-rich-content p                              { margin-bottom: 0.4em; }
.hn-rich-content ol                             { padding-left: 1.5rem; margin-bottom: 0.4em; list-style: none; }
.hn-rich-content ol li[data-list="ordered"]     { list-style-type: decimal; display: list-item; margin-left: 0; }
.hn-rich-content ol li[data-list="bullet"]      { list-style-type: disc;    display: list-item; margin-left: 0; }
.hn-rich-content li                             { margin-bottom: 0.15em; }
.hn-rich-content strong                         { font-weight: 700; }
.hn-rich-content em                             { font-style: italic; }

/* Quill editor border matches Bootstrap form-control style */
#quill-description-editor {
    border: 1px solid #dee2e6;
    border-top: none;          /* toolbar sits above with its own border */
    border-radius: 0 0 4px 4px;
    font-family: var(--hn-font-body);
    font-size: 0.95rem;
}
.ql-toolbar {
    border: 1px solid #dee2e6 !important;
    border-radius: 4px 4px 0 0 !important;
}
.ql-container {
    font-family: var(--hn-font-body) !important;
}

/* ===== PHOTO GALLERY (house_view.php) ===== */
.hn-photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.hn-photo-item {
    flex: 0 0 auto;
    width: 160px;
}
.hn-photo-link {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid var(--hn-border);
    aspect-ratio: 4/3;
    background: #f0ede8;
}
.hn-photo-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
    display: block;
}
.hn-photo-link:hover .hn-photo-thumb { transform: scale(1.04); }
.hn-photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(30,45,64,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    color: white;
    font-size: 1.5rem;
}
.hn-photo-link:hover .hn-photo-overlay { opacity: 1; }
.hn-photo-caption {
    font-size: 0.78rem;
    color: var(--hn-text-muted);
    margin-top: 4px;
    line-height: 1.3;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== PHOTO EDIT GRID (house_edit.php) ===== */
.hn-photo-grid-edit {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 40px;
}
.hn-photo-edit-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--hn-parchment);
    border: 1px solid var(--hn-border);
    border-radius: 6px;
    cursor: default;
    transition: background 0.15s, box-shadow 0.15s;
}
.hn-photo-edit-item:hover    { background: var(--hn-warm-gray); }
.hn-photo-edit-item.dragging { opacity: 0.45; box-shadow: 0 4px 12px var(--hn-shadow); }
.hn-photo-drag-handle {
    color: var(--hn-text-muted);
    cursor: grab;
    font-size: 1.1rem;
    flex-shrink: 0;
    padding: 0 2px;
}
.hn-photo-drag-handle:active { cursor: grabbing; }
.hn-photo-edit-thumb {
    width: 72px;
    height: 54px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--hn-border);
    flex-shrink: 0;
}
.hn-photo-edit-meta {
    flex: 1;
    min-width: 0;
}
.hn-caption-input { font-size: 0.85rem; }

/* ===== TIMESTAMPS ===== */
.hn-timestamps {
    font-size: 0.78rem;
    color: var(--hn-text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    main.container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .hn-page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .hn-map-container {
        height: 350px;
    }
}

/* ===== PHOTO GALLERY (house_view.php) ===== */
.hn-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}
.hn-photo-item {
    display: flex;
    flex-direction: column;
}
.hn-photo-item a {
    display: block;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid var(--hn-border);
    background: var(--hn-warm-gray);
    aspect-ratio: 4 / 3;
}
.hn-photo-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.hn-photo-item a:hover .hn-photo-thumb {
    transform: scale(1.05);
    opacity: 0.92;
}
.hn-photo-caption {
    font-size: 0.78rem;
    color: var(--hn-text-muted);
    margin-top: 0.3rem;
    text-align: center;
    line-height: 1.3;
}

/* ===== PHOTO EDIT LIST (house_edit.php) ===== */
.hn-photo-edit-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.hn-photo-edit-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem;
    border: 1px solid var(--hn-border);
    border-radius: 6px;
    background: #fff;
    transition: box-shadow 0.15s ease;
}
.hn-photo-edit-item:hover {
    box-shadow: 0 2px 6px var(--hn-shadow);
}
.hn-photo-edit-item.sortable-ghost {
    opacity: 0.4;
    background: var(--hn-parchment);
}
.hn-photo-edit-item.sortable-chosen {
    box-shadow: 0 4px 12px var(--hn-shadow);
}
.hn-photo-edit-handle {
    cursor: grab;
    color: var(--hn-text-muted);
    padding: 0 0.25rem;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.hn-photo-edit-handle:active { cursor: grabbing; }
.hn-photo-edit-thumb {
    width: 72px;
    height: 54px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--hn-border);
    flex-shrink: 0;
    background: var(--hn-warm-gray);
}
.hn-photo-edit-info {
    flex: 1;
    min-width: 0;
}

/* ===== FLAG ICONS in language tabs ===== */
.fi {
    display: inline-block;
    vertical-align: middle;
    margin-bottom: 2px;
    border-radius: 2px;
}
