﻿/* Globale Stile */
body {
    font-family: Arial, sans-serif;
    margin: 20px;
    background-color: #f4f4f4;
    color: #333;
}
h1 {
    color: #007bff;
    text-align: center;
    margin-bottom: 30px;
}

/* ------------------------------------------- */
/* I. TABELLEN LAYOUT & RESPONSIVITÄT */
/* ------------------------------------------- */

.table-responsive {
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch;
    /* Zentriert den gesamten Block */
    margin: 0 auto; 
    /* margin-left: auto; */
	/* 	margin-right: auto; */
	/* Begrenzt die maximale Breite auf breiten Bildschirmen */
    max-width: 1200px; 
    /* Stellt sicher, dass der Container auf kleinen Bildschirmen funktioniert */
    width: auto; 
    padding: 0 15px;
    display: flex;             /* Macht den Container zum Flex-Container */
    justify-content: center;   /* Zentriert das Kind-Element (die Tabelle) horizontal */
}

table {
    border-collapse: collapse;
    margin-top: 20px;
    margin-left: auto;
	margin-right: auto;
	background-color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;

    /* ✅ Korrektur: Passt die Breite an den Inhalt an */
    width: max-content; 
    /* Verhindert, dass die Tabelle den Container überragt */
    max-width: 100%; 
}

th, td {
    border: 1px solid #e0e0e0;
    padding: 6px 9px;
    text-align: left;
    vertical-align: middle !important;
}
th {
    background-color: #007bff;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
}

/* Tabellenzeilen-Stile */
tr:nth-child(even) { background-color: #f9f9f9; }
tr:hover { background-color: #f0f0f0; }

.poi-row { background-color: #e7f3ff; }
.route-row { background-color: #ffffff; }
.start-end-row { font-weight: bold; background-color: #d1ecf1; }
.error-cell { color: #dc3545; font-weight: bold; }

/* ------------------------------------------- */
/* II. FORMULAR-ELEMENTE & STEUERUNGEN */
/* ------------------------------------------- */

.duration-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.hotel-container {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
}
.hotel-input {
    width: 40px !important;
    text-align: center;
    box-sizing: border-box;
}

.visit-checkbox {
    /* 1. Standard-Checkbox-Box entfernen */
    appearance: none;
    -webkit-appearance: none;
    
    /* 2. Styling für den "Text" (das Emoji) */
    cursor: pointer;
    font-size: 1.2em;
    border: none;       /* Keinen Rahmen */
    background: none;   /* Keinen Hintergrund */
    outline: none;      /* Entfernt den blauen Fokus-Rahmen beim Klicken */
    margin: 0;
    padding: 0;
    
    /* Damit es in der Zelle zentriert bleibt */
    display: inline-block; 
    vertical-align: middle;
}

/* Zustand: NICHT angehakt (unchecked) -> Zeige Kreuz */
.visit-checkbox::after {
    /*content: "❌";*/
    content: "\274C";
    opacity: 0.5; /* Optional: Etwas blasser, wenn nicht besucht */
}

/* Zustand: ANGEHAKT (checked) -> Zeige Haken */
.visit-checkbox:checked::after {
    /*content: "✅";*/
    content: "\2705";
    opacity: 1;
}

/* Optional: Hover-Effekt */
.visit-checkbox:hover::after {
    opacity: 1;
    transform: scale(1.1);
}

.poi-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.sort-buttons {
    display: flex;
    flex-direction: column; /* Stapelt die Elemente vertikal */
    align-items: center;    /* Zentriert sie horizontal */
    gap: 2px;               /* Kleiner Abstand zwischen den Pfeilen */

}

/* Allgemeine Button-Styles (button-42) */
.button-42 {
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    box-shadow: none;
    color: #444;
    cursor: pointer;
    font-family: Inter, sans-serif;
    font-size: 14px;
    height: 24px;
    width: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 4px;
    padding: 0;
    transition: background-color 0.2s, box-shadow 0.2s;
}
.button-42:hover {
    background-color: #ddd;
    box-shadow: rgba(253, 76, 0, 0.5) 0 3px 8px;
}
.button-42:active {
    background-color: #ccc;
    box-shadow: rgba(0, 0, 0, 0.1) 0 1px 2px inset;
}
.up-button { 
	border-top-right-radius: 0; 
	border-bottom-right-radius: 0;
}
.down-button { 
	border-top-left-radius: 0; 
	border-bottom-left-radius: 0; 
	margin-top: -1px;
}

/* Spezielle Save-Buttons */

/* Zusammenfassung der identischen Styles für weniger Code */
.save-hotel-button, 
.save-duration-button {
    display: none; /* Initial versteckt */
    background-image: linear-gradient(-45deg, #1E90FF, #0000FF);
    border-radius: 4px; 
    box-shadow: rgba(0, 0, 0, 0.2) 0 2px 4px; 
    color: #FFFF00; 
    cursor: pointer;
    font-size: 20px; /* Etwas kleiner für bessere Passform */
    height: 26px; 
    width: 26px; 
    line-height: 26px;
    padding: 0; 
    border: 0; 
    text-align: center; 
    transition: all .2s ease-in-out;
    margin-left: 5px;
    vertical-align: middle;
}

/* Hover-Effekt für beide */
.save-hotel-button:hover,
.save-duration-button:hover {
    transform: scale(1.2);
    box-shadow: rgba(30, 144, 255, 0.5) 0 0 10px;
}

/* Die Klasse, die per JS hinzugefügt wird */
.show-save-button {
    display: inline-flex !important; /* Nutzt Flex für perfekte Zentrierung des Inhalts */
    justify-content: center;
    align-items: center;
    animation: bounceIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Optional: Route 66 etwas größer machen, da Schilder oft mächtiger wirken sollen */
.save-hotel-button.is-route66 svg {
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3));
}

/* Hauptspeicher-Button unter der Tabelle */
.table-form-button-container { text-align: center; margin-top: 20px; }
.table-form-button-container button {
    background-color: #28a745; color: white; padding: 10px 20px; border: none;
    border-radius: 5px; cursor: pointer; font-size: 1em; transition: background-color 0.3s;
}
.table-form-button-container button:hover { background-color: #218838; }

/* ------------------------------------------- */
/* III. PAGINIERUNG & STEUERUNG */
/* ------------------------------------------- */

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap; 
    gap: 8px;
    margin-bottom: 20px;
}

/* Basis-Stil für die Buttons */
.pagination-container a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 90px;
    padding: 8px 12px;
    text-decoration: none;
    color: #495057;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Hover- & Focus-Effekte */
.pagination-container a:hover {
    border-color: #0d6efd;
    color: #0d6efd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.pagination-container a:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Aktiver Tag */
.pagination-container a.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

/* --- Wochenend-Spezialfarben --- */

/* Sonntag (is-sunday) */
.pagination-container a.is-sunday:not(.active) {
    border-color: #ffccd5;
    background-color: #FFF0F0;
}

.pagination-container a.is-sunday:not(.active) .tag-date {
    color: #d9534f; /* Sonntags-Datum in Rot */
}

/* Samstag (is-saturday) - Optional für bessere Übersicht */
.pagination-container a.is-saturday:not(.active) {
    border-color: #d1d9e6;
    background-color: #E5E5E5;
}
/*/
/* FEIERTAG-STIL */
.pagination-container a.is-holiday:not(.active) {
    border-color: #ffd700; /* Gold-Ton */
    background-color: #fffdf0; /* Sehr helles Gelb */
}

.pagination-container a.is-holiday:not(.active) .tag-date {
    color: #b8860b; /* Dunkles Gold/Braun */
}

/* Tooltip Styling (Browser-Standard) */
.pagination-container a[title] {
    cursor: pointer;
}
/* Nur für Elemente mit der Klasse .info-hint */
.info-hint {
    /* Wichtig: Falls a-Tags andere Cursor erzwingen, hier 'cursor' setzen */
    /*cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' style='font-size:28px;'><text y='30' x='0' fill='%23007bff' font-family='sans-serif' font-weight='bold'>ⓘ</text></svg>") 14 14, auto !important;*/
    /*cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><circle cx='16' cy='16' r='15' fill='%233a74b4'/><circle cx='16' cy='16' r='13' fill='white'/><circle cx='16' cy='16' r='11' fill='%2355a6ff'/><rect x='14' y='14' width='4' height='9' fill='white'/><rect x='14' y='9' width='4' height='3' fill='white'/></svg>") 16 16, auto !important;*/
	cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><circle cx='16' cy='16' r='14' fill='%236787D3' stroke='%233057A7' stroke-width='2'/><g fill='white'><rect x='14' y='12' width='4' height='12'/><circle cx='16' y='8' r='2'/></g></svg>") 16 16, auto !important;
	position: relative;
	}

/* Das Label erscheint jetzt UNTER dem Button */
.info-hint:hover::before {
    /* Holt den Text aus dem HTML-Attribut 'data-label' */
    content: attr(data-label); 
    /* Rest bleibt gleich */
    position: absolute;
    top: 100%;
    margin-top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(58, 116, 180, 0.95);
    color: white;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 9999;
}

/* Der kleine Pfeil muss jetzt nach oben zeigen */
.info-hint:hover::after {
    content: "";
    position: absolute;
    top: 100%;
    margin-top: 0px; 
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px;
    border-style: solid;
    /* Pfeil zeigt nach oben (Farbe unten) */
    border-color: transparent transparent rgba(58, 116, 180, 0.95) transparent;
    z-index: 9999;
}
/**/

/* --- Text-Elemente innerhalb der Buttons --- */

.tag-label {
    font-size: 0.85rem;
    font-weight: bold;
    opacity: 0.8;
    margin-bottom: 1px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-date {
    font-size: 1.0rem;
    color: #6c757d;
    font-weight: 700;
    white-space: nowrap;
    margin-top: 1px;
}

/* Korrektur: Wenn Tag aktiv ist, Text hell machen */
.pagination-container a.active .tag-label,
.pagination-container a.active .tag-date {
    color: #ffffff;
    opacity: 1;
}

/* Platzhalter (Pünktchen) */
.pagination-dots {
    padding: 10px;
    color: #adb5bd;
    font-weight: bold;
    font-size: 1.2rem;
}

/* index Schalter */
/* Der äußere Rahmen des Schalters */
.switch-container {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    vertical-align: middle;
    margin: 0 10px;
}

/* Die echte Checkbox unsichtbar machen */
.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Der Hintergrund des Schalters */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #2196F3; /* Blau für Westen */
    transition: .4s;
    border-radius: 34px;
}

/* Der weiße bewegliche Kreis */
.slider:before {
    position: absolute;
    content: "";
    height: 26px; width: 26px;
    left: 4px; bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

/* Farbe ändern wenn aktiv (Osten) */
input:checked + .slider {
    background-color: #ff9800;
}

/* Kreis nach rechts schieben */
input:checked + .slider:before {
    transform: translateX(26px);
}

/* Layout für die Zeile */
.direction-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    font-family: sans-serif;
}
/**/

/* Handy-Optimierung */
/* Handy-Optimierung für die Pagination */
@media (max-width: 600px) {
    .pagination-container {
        display: flex;
        justify-content: flex-start; /* Links ausrichten für Scroll */
        flex-wrap: nowrap;          /* Umbruch zwingend verhindern */
        overflow-x: auto;           /* Seitliches Scrollen erlauben */
        -webkit-overflow-scrolling: touch; /* Sanftes Scrollen auf iOS */
        gap: 5px;
        padding: 10px 0;
        scrollbar-width: none;      /* Scrollbar verstecken (Firefox) */
    }

    .pagination-container::-webkit-scrollbar {
        display: none;              /* Scrollbar verstecken (Chrome/Safari) */
    }

    .pagination-container a {
        flex: 0 0 auto;             /* Buttons dürfen nicht schrumpfen */
        min-width: 65px;            /* Etwas schmaler als Desktop */
        padding: 5px 8px;
    }

    .tag-label {
        font-size: 0.6rem;          /* Text noch etwas kleiner */
    }
    
    .tag-date {
        font-size: 0.75rem;         /* Datum kompakter */
    }

    .pagination-dots {
        padding: 0 5px;             /* Weniger Platz verschwenden */
        display: flex;
        align-items: center;
    }
    td {
        padding: 8px 5px; /* Etwas mehr "Tipp-Fläche" für Finger */
    }
    .hotel-input {
        width: 35px !important; /* Noch kompakter auf kleinen Screens */
    }
}

/**/

p.info {
    background-color: #e9f7ef; border-left: 5px solid #28a745; padding: 15px;
    margin-top: 25px; border-radius: 4px; color: #218838; font-size: 0.9em;
}
p.warning {
    background-color: #fff3cd; border-left: 5px solid #ffc107; padding: 15px;
    margin-top: 25px; border-radius: 4px; color: #856404; font-size: 0.9em;
}
/* abgerissen poi = grau */
.poi-removed {
	background-color: #CCCCCC !important; /* Grauer Hintergrund */
	color: #6c757d !important;           /* Graue Schrift */
	opacity: 0.6;                        /* Leicht transparent */
}
.poi-removed td {
	text-decoration: line-through;       /* Text durchgestrichen */
}
.poi-removed img {
	filter: grayscale(100%);             /* Bilder grau färben */
}
/* Controls in entfernten Reihen ausblenden oder schwächen */
.poi-removed .poi-controls, .poi-removed .duration-controls {
	display: none; 
}
/**/
/* Container für die Buttons */
.direction-toggle-group {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Das Info-Icon links vor den Buttons */
.info-icon-before {
    cursor: pointer;
    margin-right: 10px; /* Abstand zu den Buttons */
    width: 20px;
    height: 20px;
    transition: transform 0.2s;
}

.info-icon-before:hover {
    transform: scale(1.2);
}

/* Tooltip Styling */
.tooltip-text {
    display: none;
    position: absolute;
    bottom: 130%; 
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 0.9em;
    width: 220px;
    text-align: center;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

/* ------------------------------------------- */
/* IV. MODAL (POPUP) & DETAILS */
/* ------------------------------------------- */

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000;
    background-color: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center;
}
.modal-content {
    background-color: white; padding: 20px; border-radius: 8px; max-width: 90%;
    max-height: 90%; overflow-y: auto;
}
@media (max-width: 600px) {
    .modal-content { max-width: 100%; max-height: 100%; border-radius: 0; }
}

.poi-name-link { color: #007bff; text-decoration: underline; cursor: pointer; }
.poi-name-link:hover { text-decoration: none; }

.status-label {
    display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #ddd; padding: 10px 0;
}
.status-label:last-child { border-bottom: none; }

/* CSS Grid für Details im Popup */
.main-page-grid {
    display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: auto; gap: 20px;
}
.header-container, .name-container, .buttons-container { grid-column: 1 / span 6; }
.desc-cmt-container { grid-column: 1 / span 6; display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px; }
.description-container { grid-column: 1 / span 3; }
.comment-container { grid-column: 4 / span 3; }
.main-content-grid { grid-column: 1 / span 6; display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px; }
.photo-container { grid-column: 1 / span 2; }
.opening-container { grid-column: 3 / span 2; }
.address-fee-container { grid-column: 5 / span 2; display: grid; grid-template-columns: 1fr; gap: 20px; }
.address-container, .fee-container { grid-column: 1; }
.photo-container img { width: 100%; height: auto; display: block; }

/* Mobile Anpassungen für Grid */
@media (max-width: 768px) {
    .main-page-grid, .main-content-grid, .desc-cmt-container { grid-template-columns: 1fr; }
    .description-container, .comment-container, .photo-container, .opening-container, .address-fee-container { grid-column: 1 / -1; }
}
/* Footer und Speichern-Button */
.footer-container {
    /* Grid-Einstellungen beibehalten, falls das Parent ein Grid ist */
    grid-column: 1 / -1;
    
    /* WICHTIG: Sticky entfernen, damit er nicht schwebt */
    position: static; 
    bottom: auto;
    
    background: #ccf;
    border: 2px solid #0000FF;
    border-radius: 4px;
    padding: 15px; /* Etwas mehr Luft für mobile Klicks */
    margin-top: 30px; /* Abstand zur Tabelle/Paginierung */
    text-align: center;
    clear: both; /* Sicherstellen, dass keine Floats stören */
}

/* Optional: Falls du ein Flex-Layout für den Body nutzt, 
   hilft das, den Footer bei wenig Inhalt trotzdem unten zu halten */
#main-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#route-table-container {
    flex: 1; /* Drückt den Footer nach unten */
}
/*
#poi-photo {
    display: block;
    width: 100%;           /* Nutzt die volle Breite des Modals *
    max-width: 100%;       /* Verhindert Überlaufen *
    height: auto;          /* Behält das Seitenverhältnis bei *
    max-height: 50vh;      /* WICHTIG: Das Bild nimmt maximal 50% der Displayhöhe ein *
    object-fit: cover;     /* Sorgt dafür, dass das Bild den Bereich schön ausfüllt *
    border-radius: 8px;    /* Abgerundete Ecken für moderne Optik *
    margin: 10px auto;     /* Zentriert das Bild mit etwas Abstand *
    box-shadow: 0 4px 8px rgba(0,0,0,0.2); /* Leichter Schatten für Tiefe *
}
*/
	.big-arrow {
		display: inline-block;
		font-size: 1.8em; /* Macht den Pfeil ca. 40% größer als den Text */
		font-weight: bold;
		margin: 0 5px;
		vertical-align: middle;
		/*line-height: 1; /* Verhindert, dass der Pfeil die Zeilenhöhe des Buttons sprengt */
	}

td.status-image {
    white-space: nowrap !important; /* Verhindert den Zeilenumbruch */
    vertical-align: middle;         /* Richtet die Icons mittig aus */
    min-width: 55px;                /* Optional: Reserviert Platz für 2 Icons */
}

.print-only {
    display: none;
}

@media print {
    /* 1. Alles Unsichtbare */
    .sort-buttons, .visit-checkbox, .hotel-input, .save-hotel-button, 
    .stay-duration-input, .save-duration-button, .map-link-container,
    header, footer, .noprint, #pagination-top, #pagination-bottom, .pagination-container {
        display: none !important;
    }

    /* 2. Filter: Nur relevante Zeilen */
    tr.not-visited, tr.is-waypoint, .poi-removed {
        display: none !important;
    }

    /* 3. Spalten-Bereinigung */
    #route-table th:nth-child(2),
    #route-table td:nth-child(2) {
        display: none !important;
    }

    /* 3.1. Tabellen-Struktur & Linien */
    #route-table { 
        width: 100% !important; 
        border-collapse: collapse; 
        border: none !important;
    }

    #route-table td {
        border-top: 0.5pt solid #bbb !important; /* Feine Trennung */
        border-bottom: 0.5pt solid #bbb !important;
        border-left: none !important;
        border-right: none !important;
        padding: 8px 4px !important; /* Vertikaler Platz ohne Gitter */
        vertical-align: middle;
    }

    /* 4. Layout-Feinschliff */
    th {
        background-color: #007bff !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        padding: 6px 4px !important;
        border: none !important;
    }

    h1.print-only {
        display: block !important;
        color: #007bff !important;
        text-align: center !important;
        width: 100%;
        margin-bottom: 20px;
        -webkit-print-color-adjust: exact;
    }

    body { 
        background: white !important; 
        color: black !important; 
        font-size: 10pt; 
        margin: 0; 
    }

    img { max-height: 40px; filter: grayscale(100%); }
    tr { page-break-inside: avoid; }
    td.status-image img {
        display: inline-block !important;
        margin-right: 2px; /* Kleiner Abstand zwischen den Icons */
    }
    .status-open, .status-closed { color: black !important; }
    .print-only { display: inline !important; }
}
