/**
 * Artensuche-Modul - Styles
 */

/* ============================================
   PANEL CONTAINER
   ============================================ */
#artensuche-panel {
    display: none;
    flex-direction: column;
    height: 100%;
}

#artensuche-panel.visible {
    display: flex;
}

/* ============================================
   SUCHFORMULAR
   ============================================ */
.artensuche-form {
    padding: 12px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    background: var(--bg-light, #f8f9fa);
}

.artensuche-form.compact {
    padding: 10px;
}

.artensuche-form-group {
    margin-bottom: 10px;
}

.artensuche-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #555);
    margin-bottom: 4px;
}

.artensuche-info-box {
    padding: 8px 10px;
    background: #e7f3ff;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.5;
    color: #333;
}

/* Suchzeile */
.artensuche-search-row {
    display: flex;
    gap: 4px;
    position: relative;
}

.artensuche-search-row input {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    font-size: 12px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.artensuche-search-row input:focus {
    outline: none;
    border-color: var(--primary-color, #8B0000);
    box-shadow: 0 0 0 2px rgba(139, 0, 0, 0.1);
}

/* ============================================
   AUTOCOMPLETE DROPDOWN
   ============================================ */
#artensuche-autocomplete {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10000;
    max-height: 250px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border-color, #ddd);
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.artensuche-ac-item {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.artensuche-ac-item:last-child {
    border-bottom: none;
}

.artensuche-ac-item:hover {
    background: var(--bg-light, #f5f5f5);
}

.artensuche-ac-german {
    font-size: 12px;
    font-weight: 500;
    color: #333;
}

.artensuche-ac-scientific {
    font-size: 11px;
    color: #888;
    font-style: italic;
}

.artensuche-ac-empty {
    padding: 10px;
    text-align: center;
    color: #999;
    font-size: 12px;
}

/* ============================================
   BUTTONS
   ============================================ */
.artensuche-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    font-size: 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    gap: 4px;
    white-space: nowrap;
}

.artensuche-btn-primary {
    background: var(--primary-color, #8B0000);
    color: #fff;
    border-color: var(--primary-color, #8B0000);
}

.artensuche-btn-primary:hover {
    background: var(--primary-hover, #B22222);
    border-color: var(--primary-hover, #B22222);
}

.artensuche-btn-secondary {
    background: #fff;
    color: #555;
    border-color: #ccc;
}

.artensuche-btn-secondary:hover {
    background: #f0f0f0;
    border-color: #999;
}

.artensuche-button-row {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

/* ============================================
   AUSGEWAEHLTE ARTEN (Tags)
   ============================================ */
#artensuche-selected {
    display: none;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

#artensuche-selected-list {
    display: flex;
    flex-direction: column;
}

/* Art-Zeile (B-Plan-Stil) */
.artensuche-species-item {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    border-bottom: 1px solid var(--border-color, #eee);
    transition: background-color 0.15s;
    border-left: 3px solid var(--primary-color, #8B0000);
}

.artensuche-species-item:hover {
    background-color: var(--bg-hover, #f5f5f5);
}

.artensuche-species-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.artensuche-species-de {
    font-weight: 500;
    font-size: 12px;
    color: var(--text-primary, #333);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.artensuche-species-sci {
    font-size: 10px;
    color: var(--text-muted, #888);
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.artensuche-species-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    margin-left: 6px;
}

.artensuche-species-toggle,
.artensuche-species-remove {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted, #888);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
    font-size: 13px;
}

.artensuche-species-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary, #333);
}

.artensuche-species-remove:hover {
    background: #ffebee;
    color: #c62828;
}

/* Deaktivierte Art */
.artensuche-species-item.artensuche-species-off {
    opacity: 0.5;
    border-left-color: #ccc;
}

.artensuche-species-item.artensuche-species-off .artensuche-species-de {
    text-decoration: line-through;
}

/* ============================================
   LOADING & MESSAGES
   ============================================ */
#artensuche-loading {
    display: none;
    padding: 15px;
    text-align: center;
    color: #666;
    font-size: 12px;
}

#artensuche-loading .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top-color: var(--primary-color, #8B0000);
    border-radius: 50%;
    animation: artensuche-spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes artensuche-spin {
    to { transform: rotate(360deg); }
}

#artensuche-message {
    display: none;
    padding: 8px 12px;
    margin: 8px 10px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.5;
}

.artensuche-msg-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.artensuche-msg-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.artensuche-msg-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.artensuche-msg-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ============================================
   MODAL (Rasterzelle / Report)
   ============================================ */
#artensuche-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    width: 520px;
    max-width: 90vw;
    max-height: 80vh;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    overflow: hidden;
    display: none;
    flex-direction: column;
}

#artensuche-modal .artensuche-modal-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-light, #f8f9fa);
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

#artensuche-modal .artensuche-modal-title-bar h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.artensuche-modal-close {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #666;
    padding: 4px 6px;
    border-radius: 4px;
}

.artensuche-modal-close:hover {
    background: #eee;
    color: #333;
}

.artensuche-modal-body {
    padding: 12px 14px;
    overflow-y: auto;
    max-height: calc(80vh - 50px);
}

.artensuche-modal-header {
    margin-bottom: 10px;
}

.artensuche-modal-header h4 {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 600;
}

.artensuche-modal-header p {
    margin: 4px 0;
    font-size: 12px;
    color: #555;
}

.artensuche-modal-actions {
    margin-top: 6px;
}

.artensuche-btn-export {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    background: #1d6f42;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.15s;
}

.artensuche-btn-export:hover {
    background: #145a34;
    color: #fff;
    text-decoration: none;
}

/* ============================================
   GRID-TABELLE (Artenliste in Rasterzelle)
   ============================================ */
/* Modal-Body als Flex-Container: Header fixiert, Tabelle scrollbar */
#modalBody_artensuche.artensuche-grid-view {
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    padding: 0 !important;
}

.artensuche-grid-sticky-header {
    flex-shrink: 0;
    padding: 15px 15px 0;
    border-bottom: 1px solid #ddd;
    background: #fff;
}

.artensuche-grid-sticky-header .artensuche-grid-table-head {
    margin-bottom: 0;
}

/* Report-Ansicht: Header fixiert, Nachweise scrollbar */
#modalBody_artensuche.artensuche-report-view {
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    padding: 0 !important;
}

.artensuche-report-sticky-header {
    flex-shrink: 0;
    padding: 15px;
    border-bottom: 1px solid #ddd;
    background: #fff;
}

.artensuche-report-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 15px 15px;
}

.artensuche-grid-table-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 0 15px 15px;
}

.artensuche-grid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.artensuche-grid-table th {
    background: var(--bg-light, #f5f5f5);
    font-weight: 600;
    text-align: left;
    padding: 6px 8px;
    border-bottom: 2px solid #ddd;
    font-size: 11px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.artensuche-grid-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.artensuche-row-separator td {
    height: 3px;
    padding: 0 !important;
    background: var(--primary-color, #8B0000);
    border: none !important;
}

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

.artensuche-row-selected {
    background: #d4edda !important;
}

.artensuche-report-link,
.artensuche-apply-link {
    color: var(--primary-color, #8B0000);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.artensuche-report-link:hover,
.artensuche-apply-link:hover {
    text-decoration: underline;
}

.artensuche-back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary-color, #8B0000);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.artensuche-back-link:hover {
    text-decoration: underline;
}

/* ============================================
   REPORT-TABELLE
   ============================================ */
.artensuche-report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
}

.artensuche-report-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #eee;
}

.artensuche-report-table td:first-child {
    width: 130px;
    font-weight: 500;
    color: #555;
    background: #fafafa;
}

.artensuche-report-head td {
    background: var(--bg-light, #f0f0f0) !important;
    font-weight: 600 !important;
    color: #333 !important;
}

.artensuche-empty {
    padding: 15px;
    text-align: center;
    color: #999;
    font-size: 12px;
}

/* ============================================
   OVERLAY (Modal-Hintergrund)
   ============================================ */
#artensuche-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 10000;
}
