/* ============================================================
   style.css - Meine Zeitachse (PROFESSIONELL - FINAL)
   ============================================================ */

/* ============================================================
   1. GRUNDLAGEN & RESET
   ============================================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f7fa;
    color: #1a1a2e;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============================================================
   2. LOGIN SCREEN
   ============================================================ */
#login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 40px 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-header {
    margin-bottom: 24px;
}

.login-logo {
    max-width: 80px;
    height: auto;
    margin: 0 auto 12px;
    border-radius: 16px;
}

.login-container h1 {
    font-size: 28px;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.login-container .subtitle {
    font-size: 14px;
    color: #6b7280;
    font-weight: 400;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #f9fafb;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
    color: #9ca3af;
}

.btn-primary {
    display: inline-block;
    width: 100%;
    padding: 14px 24px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    display: inline-block;
    padding: 8px 16px;
    background: transparent;
    color: #374151;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-danger {
    display: inline-block;
    padding: 8px 16px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: #dc2626;
    transform: scale(0.98);
}

.switch-form {
    margin-top: 16px;
    font-size: 14px;
    color: #6b7280;
}

.switch-form a {
    color: #667eea;
    font-weight: 600;
    cursor: pointer;
}

.switch-form a:hover {
    text-decoration: underline;
}

.error-msg {
    margin-top: 12px;
    font-size: 14px;
    color: #ef4444;
    font-weight: 500;
    min-height: 20px;
}

.footer-credit {
    margin-top: 24px;
    font-size: 12px;
    color: #9ca3af;
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
}

/* ============================================================
   3. HAUPTANSICHT
   ============================================================ */
#main-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    background: #ffffff;
}

/* ============================================================
   4. HEADER
   ============================================================ */
#app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    min-height: 56px;
    flex-shrink: 0;
    z-index: 1000;
    flex-wrap: wrap;
    gap: 6px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo {
    height: 32px;
    width: auto;
    border-radius: 8px;
}

.user-badge {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    background: #f3f4f6;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.header-right .btn-outline {
    font-size: 12px;
    padding: 6px 12px;
}

.header-right .btn-danger {
    font-size: 12px;
    padding: 6px 12px;
}

/* ============================================================
   5. LIVE BUTTON (MIT RECORDER-BLINKEN)
   ============================================================ */
.btn-live {
    padding: 6px 14px;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #e5e7eb;
    color: #374151;
}

.btn-live.aus {
    background: #e74c3c;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.btn-live.aktiv {
    background: #27ae60;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.btn-live.aktiv:hover,
.btn-live.aus:hover {
    transform: scale(0.96);
}

/* BLINK-EFFEKT FÜR DEN LIVE-BUTTON */
.btn-live.recording {
    animation: blink-recording 1.2s ease-in-out infinite;
}

@keyframes blink-recording {
    0% { background-color: #27ae60; box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.5); }
    50% { background-color: #e74c3c; box-shadow: 0 0 15px 5px rgba(231, 76, 60, 0.7); }
    100% { background-color: #27ae60; box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.5); }
}

/* ============================================================
   6. MAIN CONTENT (MAP + SIDEBAR)
   ============================================================ */
#main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#map-container {
    flex: 1;
    position: relative;
    min-width: 0;
    height: 100%;
}

#map {
    width: 100%;
    height: 100%;
    background: #e8ecf1;
}

#geocoding-status,
#live-status {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

#live-status.aktiv {
    background: rgba(39, 174, 96, 0.9);
}

#live-status.stillstand {
    background: rgba(241, 196, 15, 0.9);
}

/* ============================================================
   7. SIDEBAR
   ============================================================ */
#sidebar {
    width: 380px;
    background: #f9fafb;
    border-left: 1px solid #e5e7eb;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.panel {
    background: #ffffff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #f3f4f6;
}

.panel h3 {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel .hint {
    font-size: 13px;
    color: #6b7280;
    margin: 4px 0;
}

/* ============================================================
   8. ROUTING PANEL
   ============================================================ */
.routing-inputs .form-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.routing-inputs .form-row label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    min-width: 40px;
}

.routing-inputs .form-row input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    background: #f9fafb;
    transition: all 0.2s ease;
}

.routing-inputs .form-row input:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
}

#route-ergebnis {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}

#route-steps-list li {
    margin-bottom: 4px;
    line-height: 1.4;
}

/* ============================================================
   9. ADD PANEL
   ============================================================ */
.add-methods {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    background: #f3f4f6;
    border-radius: 10px;
    padding: 4px;
}

.add-method {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.add-method.active {
    background: #ffffff;
    color: #1a1a2e;
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.add-content .form-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.add-content .form-row label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    min-width: 60px;
}

.add-content .form-row input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    background: #f9fafb;
    transition: all 0.2s ease;
}

.add-content .form-row input:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
}

/* ============================================================
   10. KALENDER
   ============================================================ */
#calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

#calendar-header button {
    background: #f3f4f6;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#calendar-header button:hover {
    background: #e5e7eb;
}

#calendar-header span {
    font-size: 14px;
    font-weight: 600;
}

#calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #1a1a2e;
    position: relative;
}

.cal-day:hover {
    background: #f3f4f6;
}

.cal-day.other-month {
    color: #d1d5db;
}

.cal-day.has-entry {
    font-weight: 700;
    color: #667eea;
}

.cal-day.has-entry::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #667eea;
}

.cal-day.today {
    background: #f3f4f6;
    font-weight: 700;
}

.cal-day.selected {
    background: #667eea;
    color: #ffffff;
}

.cal-day.selected.has-entry::after {
    background: #ffffff;
}

.cal-day.selected:hover {
    background: #5a6fd6;
}

/* ============================================================
   11. LISTE
   ============================================================ */
#standorte-liste {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.standort-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: #f9fafb;
    border-radius: 10px;
    transition: all 0.15s ease;
    cursor: pointer;
    gap: 8px;
}

.standort-item:hover {
    background: #f3f4f6;
}

.standort-item .info {
    flex: 1;
    min-width: 0;
}

.standort-item .addr {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.standort-item .meta {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}

.standort-item .distance {
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    white-space: nowrap;
}

.standort-item .delete-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.standort-item .delete-btn:hover {
    color: #ef4444;
    background: #fee2e2;
}

.log-button-panel .btn-outline {
    width: 100%;
    text-align: center;
    padding: 10px;
}

/* ============================================================
   12. KARTEN-MARKER & TOOLTIPS
   ============================================================ */
.home-marker {
    font-size: 24px;
    text-align: center;
    line-height: 30px;
}

.live-marker {
    font-size: 24px;
    text-align: center;
    line-height: 30px;
    filter: drop-shadow(0 0 8px rgba(74, 144, 217, 0.6));
    animation: pulse-live 2s ease-in-out infinite;
}

@keyframes pulse-live {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.live-marker-accuracy {
    animation: pulse-accuracy 3s ease-in-out infinite;
}

@keyframes pulse-accuracy {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

.route-marker-start,
.route-marker-ziel,
.strecken-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.custom-tooltip .leaflet-tooltip-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border: none;
}

.custom-tooltip .leaflet-tooltip-tip {
    display: none;
}

/* ============================================================
   13. STRECKEN-LEGENDE (DRAGGABLE)
   ============================================================ */
.strecken-legend {
    position: fixed;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 1000;
    width: auto;
    max-width: 90%;
    min-width: 180px;
    right: 20px;
    bottom: 20px;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.strecken-legend:active {
    cursor: grabbing;
}

.legend-title {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f3f4f6;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 12px;
    color: #374151;
    white-space: nowrap;
}

.legend-color {
    flex-shrink: 0;
    display: block;
}

.legend-text {
    white-space: nowrap;
}

/* ============================================================
   14. ROUTE PROFILE BUTTONS (HELLER HINTERGRUND, DÜNNER SCHWARZER RAHMEN)
   ============================================================ */
.route-profile-container {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: center;
}

.route-profile-btn {
    flex: 1;
    padding: 8px 4px;
    border: 1px solid #333; /* Dünner schwarzer Rahmen */
    border-radius: 8px;
    background: #f9fafb; /* Heller Hintergrund */
    color: #1a1a2e;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.route-profile-btn .emoji-icon {
    font-size: 24px;
    line-height: 1;
}

.route-profile-btn .profile-label {
    font-size: 10px;
    font-weight: 600;
    color: #666;
}

.route-profile-btn:hover {
    background: #ffffff;
    transform: scale(0.98);
}

.route-profile-btn.active {
    background: #d6eaf8;      /* Extrem helles Blau */
    border-color: #7fb3d5;    /* Rahmen */
    color: #000000 !important; /* Emoji & Text schwarz erzwingen */
}

/* Zusätzlich für die kleine Schrift unter dem Emoji */
.route-profile-btn.active .profile-label {
    color: #000000 !important;
}

/* ============================================================
   15. MODAL
   ============================================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: #ffffff;
    border-radius: 24px;
    padding: 32px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    color: #1a1a2e;
    transform: rotate(90deg);
}

.modal-content h2 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 20px;
    color: #1a1a2e;
}

.modal-content .form-group {
    margin-bottom: 16px;
}

.modal-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 20px 0;
}

.danger-zone {
    padding: 16px;
    background: #fef2f2;
    border-radius: 12px;
    border: 1px solid #fee2e2;
}

.danger-zone h4 {
    color: #dc2626;
    font-size: 14px;
    margin-bottom: 12px;
}

.danger-zone .btn-outline,
.danger-zone .btn-danger {
    width: 100%;
    margin-top: 6px;
}

.status-msg {
    margin-top: 12px;
    font-size: 14px;
    font-weight: 500;
    min-height: 20px;
}

/* ============================================================
   16. RESPONSIVE (MOBILE)
   ============================================================ */
@media (max-width: 768px) {
    #main-content {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: 50vh;
        border-left: none;
        border-top: 1px solid #e5e7eb;
        padding: 10px;
        gap: 8px;
    }

    #map-container {
        height: 50vh;
    }

    #app-header {
        padding: 6px 10px;
        min-height: 48px;
    }

    .header-logo {
        height: 26px;
    }

    .user-badge {
        font-size: 12px;
        padding: 2px 10px;
    }

    .header-right .btn-outline,
    .header-right .btn-danger {
        font-size: 11px;
        padding: 4px 10px;
    }

    .btn-live {
        font-size: 11px;
        padding: 4px 10px;
    }

    .panel {
        padding: 12px;
    }

    .panel h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .standort-item {
        padding: 6px 8px;
    }

    .standort-item .addr {
        font-size: 12px;
    }

    .modal-content {
        padding: 24px 20px;
        margin: 10px;
    }

    .strecken-legend {
        max-width: 95%;
        right: 10px;
        bottom: 10px;
    }
}

@media (max-width: 480px) {
    #sidebar {
        height: 55vh;
        padding: 6px;
    }

    #map-container {
        height: 45vh;
    }

    .header-right .btn-outline:not(#btn-live):not(#btn-my-location) {
        display: none;
    }

    .routing-inputs .form-row {
        flex-wrap: wrap;
    }

    .routing-inputs .form-row label {
        min-width: auto;
        width: 100%;
        font-size: 12px;
    }
}