/* ============================================================================
   OBJEKTLISTE FRONTEND STYLES
   ============================================================================ */

/* Base Container */
.objektliste-container {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* ============================================================================
   ERROR MESSAGES
   ============================================================================ */

.objektliste-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    margin: 20px 0;
    border: 1px solid #f5c6cb;
}

.objektliste-error strong {
    display: block;
    margin-bottom: 5px;
}

.objektliste-no-results {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
    color: #6c757d;
    margin: 20px 0;
}

.objektliste-debug {
    background: #e7f3ff;
    padding: 10px;
    border: 1px solid #007cba;
    margin: 10px 0;
    font-family: monospace;
    font-size: 12px;
    border-radius: 4px;
}

/* ============================================================================
   LOGIN PROMPT
   ============================================================================ */

.objektliste-login-prompt {
    text-align: center;
    padding: 40px 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 20px 0;
}

.objektliste-login-prompt h3 {
    margin-top: 0;
    color: #333;
}

.objektliste-login-button {
    display: inline-block;
    background: #007cba;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 4px;
    margin-top: 15px;
    transition: background-color 0.2s;
}

.objektliste-login-button:hover {
    background: #005a87;
    color: white;
    text-decoration: none;
}

/* ============================================================================
   FILTERS
   ============================================================================ */

.objektliste-filters {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

.filter-group {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.objektliste-filter {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    min-width: 150px;
}

.objektliste-filter:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.25);
}

.objektliste-reset {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.objektliste-reset:hover {
    background: #545b62;
}

/* ============================================================================
   TABLE VIEW
   ============================================================================ */

.objektliste-table-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.objektliste-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.objektliste-table th {
    background: #f8f9fa;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.objektliste-table th.sortable {
    cursor: pointer;
    position: relative;
}

.objektliste-table th.sortable:hover {
    background: #e9ecef;
}

.objektliste-table th.sort-asc::after {
    content: " ↑";
    color: #007cba;
}

.objektliste-table th.sort-desc::after {
    content: " ↓";
    color: #007cba;
}

.objektliste-table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: top;
}

.objektliste-table tbody tr:hover {
    background: #f8f9fa;
}

.objektliste-table .objekt-id {
    font-weight: 600;
    color: #6c757d;
    width: 80px;
}

.objektliste-table .objekt-name strong {
    color: #495057;
    font-size: 16px;
}

.objektliste-table .objekt-adresse small {
    color: #6c757d;
    font-size: 12px;
}

.objektliste-table .price {
    color: #28a745;
    font-size: 16px;
    font-weight: 700;
}

/* ============================================================================
   STATUS BADGES
   ============================================================================ */

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-verfügbar {
    background: #d4edda;
    color: #155724;
}

.status-reserviert {
    background: #fff3cd;
    color: #856404;
}

.status-verkauft {
    background: #f8d7da;
    color: #721c24;
}

/* ============================================================================
   RESPONSIVE OBJECT LIST (TABLE + CARDS)
   ============================================================================ */

.ol-table-wrapper {
    overflow-x: auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    margin: 20px 0;
    border: 1px solid #e5e7eb;
}

.ol-cards-wrapper { display: none; }

@media (max-width: 768px) {
    .ol-table-wrapper { display: none; }
    .ol-cards-wrapper { display: grid; }
}

@media (min-width: 769px) {
    .ol-table-wrapper { display: block; }
    .ol-cards-wrapper { display: none; }
}

.ol-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin: 20px 0;
}

.ol-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.ol-card.ol-odd { background: #ffffff; }
.ol-card.ol-even { background: #fcfcfd; }

.ol-card h4 { margin: 0 0 8px 0; color: #111827; font-size: 16px; }
.ol-badge { display:inline-block; padding:2px 8px; border-radius:9999px; color:#fff; font-size:12px; font-weight:700; }
.ol-meta { color:#6b7280; font-size:13px; margin:6px 0; }
.ol-price { color:#059669; font-weight:800; }
.ol-actions { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; margin-top:10px; }
.ol-btn { background:#111827; color:#fff; padding:6px 10px; border:none; border-radius:6px; cursor:pointer; font-size:12px; font-weight:700; }
.ol-btn.kr { background:#2563eb; }
.ol-link { background:#0891b2; color:#fff; padding:6px 10px; text-decoration:none; border-radius:6px; font-size:12px; font-weight:600; }

/* Alternate full-unit background for desktop rows */
.objektliste-container tr.ol-unit-odd > td { background: #ffffff !important; }
.objektliste-container tr.ol-unit-even > td { background: #f3f4f6 !important; }
.objektliste-container tr.ol-unit-first > td { border-top: 1px solid #e5e7eb; }
.objektliste-container tr.ol-unit-last > td { border-bottom: 1px solid #e5e7eb; }

.status-unbekannt {
    background: #e2e3e5;
    color: #6c757d;
}

/* ============================================================================
   GRID VIEW
   ============================================================================ */

.objektliste-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.objektliste-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #e9ecef;
}

.objektliste-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.objektliste-card:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.card-header {
    padding: 20px 20px 15px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.card-title {
    margin: 0;
    font-size: 18px;
    color: #495057;
    flex: 1;
    line-height: 1.3;
}

.card-content {
    padding: 20px;
}

.card-content p {
    margin: 0 0 15px 0;
    line-height: 1.5;
}

.card-content p:last-child {
    margin-bottom: 0;
}

.objekt-adresse,
.objekt-preis,
.objekt-beschreibung {
    font-size: 14px;
    line-height: 1.5;
}

.objekt-preis .price {
    color: #28a745;
    font-size: 20px;
    font-weight: 700;
}

.objekt-beschreibung {
    color: #6c757d;
}

.card-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* ============================================================================
   BUTTONS AND LINKS
   ============================================================================ */

.objektliste-reserve-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-block;
}

.objektliste-reserve-btn:hover {
    background: #218838;
}

.objektliste-reserve-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.objektliste-reserve-btn:focus {
    outline: 2px solid #28a745;
    outline-offset: 2px;
}

.unterlagen-link {
    color: #007cba;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid #007cba;
    border-radius: 4px;
    display: inline-block;
    transition: all 0.2s;
}

.unterlagen-link:hover {
    background: #007cba;
    color: white;
    text-decoration: none;
}

.unterlagen-link:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* ============================================================================
   MODAL
   ============================================================================ */

.objektliste-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    position: relative;
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideIn 0.3s;
}

.modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.modal-close:hover,
.modal-close:focus {
    color: #000;
    background-color: #f1f1f1;
}

.modal-body {
    padding: 30px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ============================================================================
   DASHBOARD
   ============================================================================ */

.objektliste-dashboard {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

.dashboard-header {
    background: white;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.dashboard-header h2 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 28px;
}

.dashboard-header p {
    margin: 0;
    color: #6c757d;
    font-size: 16px;
}

.dashboard-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dashboard-content h3 {
    margin: 0 0 25px 0;
    color: #495057;
    font-size: 24px;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.user-stats {
    background: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.recent-activity {
    background: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ============================================================================
   STATISTICS
   ============================================================================ */

.objektliste-stats {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 20px 0;
}

.stats-overview,
.stats-chart,
.stats-table {
    margin-bottom: 20px;
}

.stats-overview h3,
.stats-chart h3,
.stats-table h3 {
    margin: 0 0 20px 0;
    color: #495057;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.stat-item {
    text-align: center;
    padding: 20px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.stat-item strong {
    display: block;
    font-size: 24px;
    color: #007cba;
    margin-bottom: 5px;
}

/* ============================================================================
   FORM STYLES (for reservation modal)
   ============================================================================ */

.objektliste-form {
    max-width: 100%;
}

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

.objektliste-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #495057;
}

.objektliste-form input,
.objektliste-form textarea,
.objektliste-form select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.objektliste-form input:focus,
.objektliste-form textarea:focus,
.objektliste-form select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.25);
}

.objektliste-form input.error,
.objektliste-form textarea.error,
.objektliste-form select.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
}

.objektliste-form .error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

.objektliste-form .form-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 15px;
}

.objektliste-form .required {
    color: #dc3545;
}

.objektliste-form .form-actions {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.objektliste-form .btn-primary {
    background: #007cba;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.objektliste-form .btn-primary:hover {
    background: #005a87;
}

.objektliste-form .btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.objektliste-form .btn-secondary:hover {
    background: #545b62;
}

/* ============================================================================
   LOADING STATES
   ============================================================================ */

.objektliste-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.objektliste-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================================================
   NOTIFICATIONS
   ============================================================================ */

.objektliste-success {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #c3e6cb;
    cursor: pointer;
}

.objektliste-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #f5c6cb;
    cursor: pointer;
}

/* ============================================================================
   FILTER NO RESULTS
   ============================================================================ */

.filter-no-results {
    text-align: center;
    padding: 40px 20px;
    background: #fff3cd;
    border-radius: 8px;
    border: 1px solid #ffeaa7;
    color: #856404;
    margin: 20px 0;
}

/* ============================================================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for better accessibility */
*:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    .objektliste-container {
        padding: 0 10px;
    }
    
    .objektliste-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .objektliste-filter {
        min-width: auto;
        width: 100%;
    }
    
    .objektliste-table-wrapper {
        border-radius: 0;
        margin: 0 -10px;
    }
    
    .objektliste-table th,
    .objektliste-table td {
        padding: 8px 6px;
        font-size: 13px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .card-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .card-footer .objektliste-reserve-btn,
    .card-footer .unterlagen-link {
        width: 100%;
        text-align: center;
    }
    
    .objektliste-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .objektliste-form .form-actions {
        flex-direction: column;
    }
    
    .dashboard-header {
        padding: 20px;
        margin: 0 -10px 30px;
        border-radius: 0;
    }
    
    .dashboard-content,
    .user-stats,
    .recent-activity,
    .objektliste-stats {
        margin-left: -10px;
        margin-right: -10px;
        border-radius: 0;
        padding: 20px;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .card-content {
        padding: 15px;
    }
    
    .card-footer {
        padding: 12px 15px;
    }
    
    .stat-item {
        padding: 15px 10px;
    }
    
    .stat-item strong {
        font-size: 20px;
    }
    
    .objektliste-table th,
    .objektliste-table td {
        padding: 6px 4px;
        font-size: 12px;
    }
    
    .dashboard-header h2 {
        font-size: 24px;
    }
    
    .dashboard-header p {
        font-size: 14px;
    }
}

/* === Integrated Overrides (2025-08-27) === */

/* Buttons: unify height/padding */
.objektliste-btn,
.objektliste-reserve-btn,
.res-btn,
.ol-kr-btn {
  min-height: 36px !important;
  padding: 8px 12px !important;
  line-height: 1.2 !important;
}
/* Cancel smaller text */
.objektliste-btn--secondary,
.button-cancel,
.res-btn.sec,
.ol-kr-btn.sec,
button[name="cancel"],
.button.cancel {
  font-size: 13px !important;
  font-weight: 500 !important;
  background: #f6f7f7 !important;
  color: #1e1e1e !important;
  border: 1px solid #dadcdf !important;
}

/* Action rows spacing */
.objektliste-reserve-group,
.card-actions,
.res-actions,
.ol-kr-actions,
.objektliste-form .form-actions {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  align-items: center !important;
  justify-content: flex-end !important;
}
.objektliste-reserve-btn + .objektliste-reserve-btn,
.res-btn + .res-btn,
.ol-kr-btn + .ol-kr-btn {
  margin-left: 8px !important;
}

/* Shortcode overlay modal: visibility & size */
.objektliste-res-overlay { z-index: 100000 !important; /* display controlled via JS (none|flex) */ }
.objektliste-res-modal {
  z-index: 100001 !important;
  width: 500px !important;
  height: 500px !important;
  max-width: 90vw !important;
  max-height: 90vh !important;
  border-radius: 12px !important;
}

/* Stack fields vertically in shortcode modal */
.objektliste-res-modal .res-grid,
.objektliste-res-modal .res-row {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 12px !important;
}

/* Kundendashboard Kauf-Reservierung modal */
.ol-kaufreg-overlay { z-index: 100000 !important; /* display controlled via JS (none|flex) */ }
.ol-kaufreg-modal {
  z-index: 100001 !important;
  width: 500px !important;
  height: 500px !important;
  max-width: 90vw !important;
  max-height: 90vh !important;
  border-radius: 12px !important;
}

/* Stack fields vertically in dashboard modal */
.ol-kr-grid,
.ol-kr-row {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 12px !important;
}

/* "Investitionsbetrachtung" link → primary button style */
a[href*="/investitionsbetrachtung"] {
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  padding: 8px 12px !important;
  min-height: 36px !important;
  border-radius: 6px !important;
  text-decoration: none !important;
  font-weight: 600 !important;
  background: #2271b1 !important;
  color: #fff !important;
  border: 1px solid #2271b1 !important;
}
a[href*="/investitionsbetrachtung"]:hover {
  background:#135e96 !important;
  border-color:#135e96 !important;
}
