/**
 * KontaktTool - Styles v1.0
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.5;
}

/* ============================================================
   LOGIN
   ============================================================ */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.login-box h1 {
    font-size: 24px;
    margin-bottom: 8px;
    color: #16213e;
}

.login-box p {
    color: #666;
    margin-bottom: 24px;
}

.login-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 16px;
}

.login-box input:focus {
    outline: none;
    border-color: #2563eb;
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

.login-box button:hover {
    background: #1d4ed8;
}

.error-msg {
    background: #fee2e2;
    color: #dc2626;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 16px;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 16px;
}

.app-header h1 {
    font-size: 22px;
    color: #16213e;
}

.header-subtitle {
    color: #666;
    font-size: 14px;
}

.logout-btn {
    margin-left: auto;
    color: #666;
    text-decoration: none;
    font-size: 14px;
}

.logout-btn:hover {
    color: #dc2626;
}

.section {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.section h2 {
    font-size: 18px;
    margin-bottom: 12px;
    color: #16213e;
}

.section h3 {
    font-size: 15px;
    margin-bottom: 8px;
    color: #444;
}

.hint {
    font-size: 13px;
    color: #888;
    margin-top: 6px;
}

/* ============================================================
   SUCHE
   ============================================================ */

.search-row {
    display: flex;
    gap: 8px;
}

.search-row input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
}

.search-row input:focus {
    outline: none;
    border-color: #2563eb;
}

.results-info {
    font-size: 13px;
    color: #888;
    margin-bottom: 12px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-success {
    background: #16a34a;
    color: #fff;
}

.btn-success:hover {
    background: #15803d;
}

.btn-small {
    padding: 6px 14px;
    font-size: 13px;
    background: #e5e7eb;
    color: #374151;
}

.btn-small:hover {
    background: #d1d5db;
}

.btn-large {
    padding: 14px 28px;
    font-size: 16px;
    width: 100%;
    margin-top: 16px;
}

/* ============================================================
   FIRMEN-KARTEN
   ============================================================ */

.company-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: border-color 0.2s;
}

.company-card:hover {
    border-color: #2563eb;
}

.company-card-main {
    flex: 1;
}

.company-name {
    font-weight: 600;
    font-size: 16px;
}

.company-city {
    font-size: 13px;
    color: #666;
}

.company-badges {
    display: inline-flex;
    gap: 4px;
    margin-top: 4px;
}

.company-info {
    font-size: 13px;
    color: #888;
    margin-top: 2px;
}

.btn-load-members {
    padding: 8px 16px;
    font-size: 13px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-load-members:hover {
    background: #1d4ed8;
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.badge-cs {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-brevo {
    background: #dcfce7;
    color: #16a34a;
}

.badge-none {
    background: #f3f4f6;
    color: #9ca3af;
    text-decoration: line-through;
}

.badge-link {
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.badge-link:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ============================================================
   EINZELPERSONEN
   ============================================================ */

.loose-persons-list {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.loose-person {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    flex-wrap: wrap;
}

.loose-person:last-child {
    border-bottom: none;
}

.person-name {
    font-weight: 500;
}

.person-email {
    font-size: 13px;
    color: #666;
}

.person-badges {
    display: inline-flex;
    gap: 4px;
    margin-left: auto;
}

/* ============================================================
   MITARBEITER-LISTE
   ============================================================ */

.member-actions-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.selected-count {
    font-size: 13px;
    color: #666;
    margin-left: auto;
}

.member-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.member-row:hover {
    background: #f8fafc;
}

.member-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}

.member-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}

.member-name {
    font-weight: 500;
}

.member-email {
    font-size: 13px;
    color: #666;
}

.member-badges {
    display: inline-flex;
    gap: 4px;
    margin-left: auto;
}

.no-members {
    padding: 20px;
    text-align: center;
    color: #888;
}

/* ============================================================
   TAG/ATTRIBUT-FELDER
   ============================================================ */

.tag-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.tag-field {
    flex: 1;
    position: relative;
}

.tag-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 4px;
}

.tag-field input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
}

.tag-field input:focus {
    outline: none;
    border-color: #2563eb;
}

/* ============================================================
   HISTORY DROPDOWN
   ============================================================ */

.history-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.history-item {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.history-item:hover {
    background: #f0f7ff;
}

.history-item:last-child {
    border-bottom: none;
}

/* ============================================================
   STATUS
   ============================================================ */

.status-message {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 14px;
    max-width: 600px;
    width: calc(100% - 40px);
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    line-height: 1.6;
}

.status-message.success {
    background: #dcfce7;
    color: #166534;
    border: 2px solid #86efac;
}

.status-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #fca5a5;
}

.status-message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 2px solid #93c5fd;
}

/* ============================================================
   LOADING
   ============================================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    font-size: 16px;
    color: #444;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
    .app-container {
        padding: 10px;
    }

    .company-card {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-load-members {
        width: 100%;
        text-align: center;
    }

    .tag-row {
        flex-direction: column;
        gap: 8px;
    }

    .member-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .member-badges {
        margin-left: 0;
    }

    .person-badges {
        margin-left: 0;
    }
}
