/* ============================================
   Manesse Immobilien-Management – Main CSS
   ============================================ */

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

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 260px;
    --header-height: 60px;
    --border-radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.07), 0 10px 15px rgba(0,0,0,0.1);
}

html {
    font-size: 15px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

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

a:hover {
    text-decoration: underline;
}

/* App-Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-body {
    display: flex;
    flex: 1;
    padding-top: var(--header-height);
}

/* Header */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--gray-900);
    font-weight: 700;
    font-size: 18px;
}

.app-logo:hover {
    text-decoration: none;
}

.logo-icon {
    font-size: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.user-name {
    color: var(--gray-700);
    font-weight: 500;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-admin {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-benutzer, .badge-user {
    background: var(--success-light);
    color: var(--success);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    min-height: calc(100vh - var(--header-height) - 60px);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1;
    letter-spacing: 0.01em;
    vertical-align: middle;
    white-space: nowrap;
    box-sizing: border-box;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-primary {
    background: #fff;
    border-color: #2563eb;
    color: #2563eb;
}
.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 3px 10px rgba(37,99,235,0.3);
}

.btn-success {
    background: #fff;
    border-color: #16a34a;
    color: #16a34a;
}
.btn-success:hover {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
    box-shadow: 0 3px 10px rgba(22,163,74,0.3);
}

.btn-danger {
    background: #fff;
    border-color: #dc2626;
    color: #dc2626;
}
.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
    box-shadow: 0 3px 10px rgba(220,38,38,0.3);
}

.btn-secondary {
    background: #fff;
    border-color: var(--gray-300);
    color: var(--gray-600);
}
.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-500);
    color: var(--gray-700);
}

.btn-logout {
    background: #fff;
    color: var(--danger);
    border-color: var(--danger);
}
.btn-logout:hover {
    background: var(--danger);
    color: #fff;
    text-decoration: none;
}

/* Admin-Dropdown */
.admin-dropdown {
    position: relative;
}

.admin-dropdown-toggle {
    background: none;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: border-color 0.2s, background 0.2s;
}

.admin-dropdown-toggle:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.admin-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 200;
    padding: 6px 0;
    animation: dropdownFadeIn 0.15s ease;
}

.admin-dropdown-menu.open {
    display: block;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.admin-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    text-decoration: none;
    transition: background 0.1s, color 0.1s;
}

.admin-dropdown-item:hover {
    background: var(--gray-50);
    color: var(--primary);
    text-decoration: none;
}

.btn-sm {
    height: 30px;
    padding: 0 12px;
    font-size: 13px;
}

/* Alerts */
.alert {
    padding: 14px 44px 14px 48px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    animation: alertSlideIn 0.35s ease-out;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.alert::before {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
}

.alert-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.5;
    padding: 4px 6px;
    line-height: 1;
    border-radius: 4px;
    transition: opacity 0.2s, background 0.2s;
}
.alert-close:hover { opacity: 1; background: rgba(0,0,0,0.06); }

.alert-success {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    color: #15803d;
    border: 1px solid #86efac;
}
.alert-success::before { content: '✅'; }

.alert-error {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #b91c1c;
    border: 1px solid #fca5a5;
}
.alert-error::before { content: '⚠️'; }

@keyframes alertSlideIn {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Bestätigungs-Modal */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.confirm-dialog {
    background: #fff;
    border-radius: 14px;
    padding: 28px 32px 22px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
    text-align: center;
    animation: dialogPop 0.25s ease;
}
.confirm-dialog .confirm-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}
.confirm-dialog .confirm-text {
    font-size: 1rem;
    color: #334155;
    margin-bottom: 20px;
    line-height: 1.5;
}
.confirm-dialog .confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.confirm-dialog .confirm-actions .btn {
    min-width: 110px;
    padding: 10px 18px;
    font-size: 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    font-weight: 600;
    transition: all 0.15s;
}
.confirm-dialog .btn-cancel {
    background: #f1f5f9;
    color: #475569;
}
.confirm-dialog .btn-cancel:hover { background: #e2e8f0; }
.confirm-dialog .btn-confirm-danger {
    background: #ef4444;
    color: #fff;
}
.confirm-dialog .btn-confirm-danger:hover { background: #dc2626; }

@keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
}
@keyframes dialogPop {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

/* Tabellen */
.table-container {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--gray-500);
    letter-spacing: 0.05em;
}

table tr:hover {
    background: var(--gray-50);
}

table tr:last-child td {
    border-bottom: none;
}

/* Formulare */
.form-card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 32px;
    max-width: 640px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--gray-700);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    outline: none;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 4px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Page-Header */
.page-header {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    gap: 12px;
}

.page-header h1 {
    font-size: 24px;
    color: var(--gray-900);
    flex: 1;
}

.page-header .btn {
    flex-shrink: 0;
}

.page-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 16px;
    color: var(--gray-400);
    font-size: 13px;
    border-top: 1px solid var(--gray-200);
    background: #fff;
    margin-left: var(--sidebar-width);
}

/* Hamburger (standardmässig versteckt) */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    gap: 5px;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--gray-700);
    border-radius: 2px;
    transition: all 0.3s;
}

/* Sidebar-Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ============================================
   Action Icons (Tabellen-Aktionen)
   ============================================ */
.actions-cell {
    white-space: nowrap;
}

.action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 1.1rem;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
    background: transparent;
    border: none;
    cursor: pointer;
}

.action-icon:hover {
    text-decoration: none;
}

.action-icon + .action-icon {
    margin-left: 2px;
}

/* View / Details */
.action-view {
    color: var(--primary);
}
.action-view:hover {
    color: var(--primary-hover);
    background-color: var(--primary-light);
}

/* Edit */
.action-edit {
    color: var(--gray-500);
}
.action-edit:hover {
    color: var(--warning);
    background-color: var(--warning-light);
}

/* Delete */
.action-delete {
    color: var(--gray-500);
}
.action-delete:hover {
    color: var(--danger);
    background-color: var(--danger-light);
}

/* Download */
.action-download {
    color: var(--success);
}
.action-download:hover {
    color: #15803d;
    background-color: var(--success-light);
}

/* ============================================
   Detail-View Utility Classes
   ============================================ */
.detail-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.detail-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.detail-section-header h2 {
    margin: 0;
    font-size: 1.15rem;
}

/* Detail-Info-Grid (key-value Paare) */
.detail-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px 24px;
    margin-bottom: 0;
}

.detail-info-item label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.detail-info-item p {
    font-size: 15px;
    color: var(--gray-900);
    margin: 0;
}
