/* ImmoConfirm – self-contained UI stylesheet (no external dependencies).
   Replaces the former Bootstrap 4 + Kendo Nova theme. */

:root {
    --brand-yellow-1: #f1c664;
    --brand-yellow-2: #f1c761;
    --brand-blue: #275b9d;
    --brand-blue-dark: #1f4a80;

    --gray-900: #1f2933;
    --gray-700: #3e4c59;
    --gray-600: #52606d;
    --gray-500: #7b8794;
    --gray-400: #9aa5b1;
    --gray-300: #cbd2d9;
    --gray-200: #e4e7eb;
    --gray-100: #f5f7fa;

    --danger: #d64545;
    --danger-bg: #fdecec;
    --ok: #2f855a;

    --radius: 8px;
    --radius-sm: 5px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 12px rgba(0, 0, 0, .06);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .18);
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--gray-900);
    background: var(--gray-100);
}

h1, h2, h3, h4 { font-weight: 600; line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h4 { font-size: 1.05rem; font-weight: 500; }

a { color: var(--brand-blue); }

/* ---------- Navbar ---------- */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .6rem 1.5rem;
    min-height: 56px;
    flex-wrap: wrap;
}
.navbar--yellow { background-image: linear-gradient(to right, var(--brand-yellow-1), var(--brand-yellow-2)); }
.navbar--blue { background-color: var(--brand-blue); }
.navbar-brand {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--gray-700);
    text-decoration: none;
    word-break: break-word;
}
.navbar-brand--light { color: #fff; }

/* ---------- Hauptnavigation ---------- */
.nav-links {
    display: flex;
    align-items: center;
    gap: .25rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    flex: 1;
}
.nav-link {
    display: inline-block;
    padding: .4rem .9rem;
    border-radius: var(--radius-sm);
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}
.nav-link:hover { background: rgba(255, 255, 255, .45); }
.nav-link--active {
    background: rgba(255, 255, 255, .75);
    color: var(--gray-900);
    box-shadow: inset 0 -2px 0 var(--brand-blue);
}

/* ---------- User dropdown ---------- */
.user-menu { position: relative; }
.user-menu__toggle {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: rgba(255, 255, 255, .35);
    border: none;
    border-radius: var(--radius-sm);
    padding: .4rem .8rem;
    font: inherit;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
}
.user-menu__toggle:hover { background: rgba(255, 255, 255, .6); }
.user-menu__caret { font-size: .7rem; }
.user-menu__list {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 180px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    list-style: none;
    margin: 0;
    padding: .3rem 0;
    z-index: 50;
}
.user-menu__list[hidden] { display: none; }
.user-menu__list a {
    display: block;
    padding: .5rem 1rem;
    color: var(--gray-700);
    text-decoration: none;
}
.user-menu__list a:hover { background: var(--gray-100); }

/* ---------- Layout ---------- */
.app-main { padding: 1.5rem; }
.page { max-width: 1200px; margin: 0 auto; }
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem 1.1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .15s, border-color .15s;
}
.btn-primary { background: var(--brand-blue); color: #fff; }
.btn-primary:hover { background: var(--brand-blue-dark); }
.btn-secondary { background: #fff; color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-100); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.94); }
.btn-link {
    background: none;
    border: none;
    color: var(--brand-blue);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font: inherit;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-field { margin-bottom: .85rem; }
.form-field > label,
.form-label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: .25rem;
}
input[type=text],
input[type=email],
input[type=password],
input[type=number],
select,
textarea {
    width: 100%;
    padding: .5rem .65rem;
    font: inherit;
    color: var(--gray-900);
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(39, 91, 157, .15);
}
input[readonly] { color: var(--gray-500); background: var(--gray-100); }
textarea { resize: vertical; min-height: 60px; }

.input-validation-error,
.textarea-validation-error {
    border-color: var(--danger) !important;
    background-color: var(--danger-bg) !important;
}
.field-validation-error, .validation-summary-errors { color: var(--danger); font-size: .85rem; }

.control-panel { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1rem; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
@media (max-width: 640px) { .form-grid-2 { grid-template-columns: 1fr; } }

/* ---------- Card ---------- */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--gray-200); vertical-align: middle; }
.table thead th { background: var(--gray-100); color: var(--gray-600); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
.table tbody tr:hover { background: var(--gray-100); }
.table .num { text-align: right; white-space: nowrap; }
.table .empty { text-align: center; color: var(--gray-500); padding: 2rem; }

/* Sortierbare Spaltenköpfe */
.table thead th[data-sortable] { cursor: pointer; user-select: none; }
.table thead th[data-sortable]:hover { background: var(--gray-200); }
.table thead th[data-sortable]::after {
    content: "\2195";
    margin-left: .4rem;
    opacity: .35;
    font-size: .8em;
}
.table thead th[data-sort-dir="asc"]::after { content: "\25B2"; opacity: 1; }
.table thead th[data-sort-dir="desc"]::after { content: "\25BC"; opacity: 1; }

/* ---------- Badges / status ---------- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge--ok { background: #e3f4ea; color: var(--ok); }
.badge--pending { background: var(--gray-200); color: var(--gray-600); }

/* ---------- Checkbox (custom) ---------- */
.checkbox-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding-left: 26px;
    min-height: 20px;
    cursor: pointer;
    user-select: none;
}
.checkbox-container input { position: absolute; opacity: 0; height: 0; width: 0; }
.checkmark {
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    height: 18px; width: 18px;
    background: #fff;
    border: 1px solid var(--gray-500);
    border-radius: 3px;
}
.checkbox-container:hover input:not(:disabled) ~ .checkmark { background: var(--gray-200); }
.checkmark:after { content: ""; position: absolute; display: none; left: 5px; top: 1px; width: 5px; height: 10px; border: solid var(--brand-blue); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.checkbox-container input:checked ~ .checkmark:after { display: block; }
.checkbox-container input:disabled ~ .checkmark { opacity: .6; }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(31, 41, 51, .5);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
    z-index: 100;
}
.modal-backdrop[hidden] { display: none; }
.modal {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 640px;
    margin: auto;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .9rem 1.2rem;
    border-bottom: 1px solid var(--gray-200);
    background-image: linear-gradient(to right, var(--brand-yellow-1), var(--brand-yellow-2));
    border-radius: var(--radius) var(--radius) 0 0;
    font-weight: 600;
    color: var(--gray-700);
}
.modal--blue .modal-header { background: var(--brand-blue); color: #fff; }
.modal-close { background: none; border: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: inherit; }
.modal-body { padding: 1.2rem; }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: calc(100vh - 56px); display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { text-align: center; font-weight: 400; margin-bottom: 1.5rem; }

/* ---------- ImmoConfirm public page ---------- */
.agency-logo { max-width: 100%; max-height: 160px; }
.agency-logo-preview { max-width: 300px; max-height: 90px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); }
.agreement-block {
    border: 1px solid var(--gray-200);
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-top: 1rem;
    padding: 1.25rem;
}
.agreement-block .checkbox-container { color: var(--brand-blue); font-weight: 500; margin-top: .5rem; }
.confirmation-note { margin-left: 1rem; color: var(--ok); font-weight: 500; }
.confirmation-textarea { margin-top: .5rem; }
.download-links { margin-top: 1rem; }

/* ---------- Settings ---------- */
.upload-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-top: 1rem; }
.placeholder-hint { font-size: .85rem; color: var(--gray-600); background: var(--gray-100); border-radius: var(--radius-sm); padding: .5rem .75rem; margin: .5rem 0; }

/* Minimal rich-text editor */
.rte-toolbar { display: flex; gap: .25rem; flex-wrap: wrap; border: 1px solid var(--gray-300); border-bottom: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0; padding: .4rem; background: var(--gray-100); }
.rte-toolbar button { min-width: 34px; height: 30px; border: 1px solid var(--gray-300); background: #fff; border-radius: 4px; cursor: pointer; font-size: .9rem; }
.rte-toolbar button:hover { background: var(--gray-200); }
.rte-surface { min-height: 320px; max-height: 55vh; overflow-y: auto; border: 1px solid var(--gray-300); border-radius: 0 0 var(--radius-sm) var(--radius-sm); padding: .75rem; background: #fff; }
.rte-surface:focus { outline: none; border-color: var(--brand-blue); }

/* ---------- Utilities ---------- */
.hidden, [hidden] { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1rem; }
.text-danger { color: var(--danger); }
.text-muted { color: var(--gray-500); }
.text-right { text-align: right; }
.w-full { width: 100%; }

@media (max-width: 640px) {
    .app-main { padding: 1rem; }
    .control-panel { flex-direction: column; }
    .control-panel .btn { width: 100%; }
    .navbar { gap: .5rem; }
    .nav-links { order: 3; width: 100%; flex: 0 0 100%; }
    .nav-link { padding: .35rem .6rem; font-size: .92rem; }
}
