/* ===================================
   Wilhelm Immobilien — CI Stylesheet
   Farben: #1e3a5f (Blau), #c8a84e (Gold)
   Font: Source Sans 3
   =================================== */

:root {
    --primary: #1e3a5f;
    --primary-light: #2a4f7a;
    --primary-dark: #152a45;
    --accent: #c8a84e;
    --accent-light: #dfc06a;
    --accent-dark: #b0913a;
    --bg: #f5f7fa;
    --bg-white: #ffffff;
    --text: #333333;
    --text-light: #4a5a6a;
    --text-muted: #9ca3af;
    --border: #e2e8f0;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
    --transition: 0.2s ease;
}

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

body {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }

/* Header */
.main-header {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff !important;
    display: flex;
    gap: 0.4rem;
}
.logo-immobilien { color: var(--accent); }

.main-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.main-nav a { color: rgba(255,255,255,0.85); font-weight: 500; transition: color var(--transition); }
.main-nav a:hover { color: var(--accent); }
.nav-user { color: var(--accent); font-weight: 600; }

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
    flex: 1;
}

/* Footer */
.main-footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.7);
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
}
.main-footer a { color: var(--accent); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); color: #fff; }

.btn-accent { background: var(--accent); color: var(--primary-dark); }
.btn-accent:hover { background: var(--accent-light); color: var(--primary-dark); }

.btn-outline { background: transparent; border: 2px solid rgba(255,255,255,0.4); color: #fff; padding: 0.4rem 1rem; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.btn-block { width: 100%; justify-content: center; }

/* Cards */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-header {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--accent);
}

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text);
    font-size: 0.9rem;
}
.form-group .hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 2px solid #c5cdd8;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: #fcfcfd;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(30,58,95,0.15);
}
.form-control:hover {
    border-color: #9aa8b8;
}
/* Ausgefüllte Felder in Blau */
.form-control.has-value {
    color: var(--primary);
    font-weight: 600;
}
select.form-control.has-value {
    color: var(--primary);
    font-weight: 600;
}
textarea.form-control.has-value {
    color: var(--primary);
    font-weight: 500;
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-section {
    margin-bottom: 2rem;
}
.form-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.form-section-title::before {
    content: '';
    width: 4px;
    height: 1.2em;
    background: var(--accent);
    border-radius: 2px;
}

/* Checkbox/Toggle */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}
.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Alerts */
.alert {
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-weight: 500;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* Auth Pages */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 64px - 80px);
}
.auth-card {
    width: 100%;
    max-width: 420px;
}
.auth-card .card-header {
    text-align: center;
    font-size: 1.5rem;
}
.auth-links {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Dashboard */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-title { font-size: 1.6rem; font-weight: 700; color: var(--primary); }

.search-bar {
    display: flex;
    gap: 0.5rem;
    max-width: 400px;
}
.search-bar input { flex: 1; }

/* Table */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
table th, table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
table th {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
table th:first-child { border-radius: var(--radius) 0 0 0; }
table th:last-child { border-radius: 0 var(--radius) 0 0; }
table tr:hover { background: #f8fafc; }
table .actions { display: flex; gap: 0.5rem; }

/* Ergebnis */
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.result-card { padding: 1.5rem; }
.result-card .value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}
.result-card .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.result-table { margin-bottom: 1.5rem; }
.result-table td:last-child { text-align: right; font-weight: 600; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge-auto {
    background: #fef3c7;
    color: #92400e;
}

/* Responsive */
@media (max-width: 768px) {
    .header-inner { padding: 0 1rem; }
    .main-nav { gap: 0.75rem; font-size: 0.9rem; }
    .main-content { padding: 1rem; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .form-row { grid-template-columns: 1fr; }
    #besonderheiten-grid { grid-template-columns: 1fr !important; }
    .result-grid { grid-template-columns: 1fr; }
    table { font-size: 0.85rem; }
    table th, table td { padding: 0.5rem; }
}

@media (max-width: 480px) {
    .main-nav { flex-wrap: wrap; gap: 0.5rem; }
    .logo { font-size: 1.1rem; }
    .card { padding: 1.25rem; }
}

/* Hamburger Menu for Mobile */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}
@media (max-width: 768px) {
    .menu-toggle { display: block; }
    .main-nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--primary);
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    }
    .main-nav.active { display: flex; }
}

/* Print */
@media print {
    .main-header, .main-footer, .btn, .search-bar, .actions { display: none !important; }
    .main-content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}
