/* ============================================= */
/* Master-Stylesheet für den gesamten Admin-Bereich */
/* Stand: 31. August 2025                       */
/* ============================================= */

/* --- 1. GRUNDLAGEN & LAYOUT --- */
:root {
    --primary-color: #0c456a;
    --hover-color: #ff6347;
    --light-gray: #f4f7f6;
    --white: #ffffff;
    --text-dark: #2c3e50;
    --text-light: #555;
    --border-color: #eaecee;
    --success-bg: #d1fae5;
    --success-text: #065f46;
    --error-bg: #fee2e2;
    --error-text: #991b1b;
    --green: #28a745;
    --red: #dc3545;
    --gray: #6c757d;
    --blue: #0593ff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--light-gray);
    color: #333;
    margin: 0;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5em;
}

/* --- 2. HEADER & NAVIGATION --- */
.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--primary-color);
    padding: 0 1.5em;
    border-radius: 12px;
    margin-bottom: 2em;
    position: relative;
}

.nav-links {
    border-radius: 12px;

    display: flex;
    list-style-type: none;
    margin: 0;
    padding: 0;
    flex-grow: 1; /* <-- DAS IST DIE ENTSCHEIDENDE ZEILE */
}

.nav-links li a {
    color: var(--white);
    text-decoration: none;
    padding: 16px 14px;
    font-size: 0.9em;
    border-radius: 12px;
    display: block;
    transition: background-color 0.2s;
}
.nav-links li a:hover {
    background-color: var(--hover-color);
}

.nav-links li a[href*="logout.php"] {
    background-color: var(--gray);
}
.nav-links li a[href*="logout.php"]:hover {
    background-color: #5a6268;
}

.menu-icon {
    display: none;
    font-size: 28px;
    color: var(--white);
    background: none;
    border: none;
    cursor: pointer;
    padding: 7px;
}

/* --- 3. ÜBERSCHRIFTEN & INHALTSELEMENTE --- */
h1, h2, h3 {
    color: var(--text-dark);
    margin-top: 0;
}
h1 { font-size: 1.6em; margin-bottom: 1em; }
h2 { font-size: 1.4em; margin: 1.5em 0 1em; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5em; }
h3 { font-size: 1.1em; margin-bottom: 0.5em; margin-top: 1.5em; }

.form-container, .user-list {
    background: var(--white);
    padding: 2em;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 2em;
    border: 1px solid #eef;
}

/* --- 4. FORMULARE --- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5em;
}
.form-grid .full-width { grid-column: 1 / -1; }

.form-group {
    margin-bottom: 1em;
    position: relative;
}

.form-group label, .form-grid label {
    display: block;
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 0.7em;
    color: var(--text-light);
}

input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="number"], select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: var(--white);
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(12, 69, 106, 0.1);
}

input[type="color" i] {
    appearance: auto;
    inline-size: 60px;
    block-size: 40px;
    cursor: default;
    box-sizing: border-box;
    background-color: buttonface;
    color: buttontext;
    border-width: 0px;
    border-style: solid;
    border-color: buttonborder;
    border-image: none;
    padding: 1px 2px;
}

/* --- 5. BUTTONS --- */
.button {
    padding: 12px 20px;
    color: var(--white);
    background-color: var(--primary-color);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
    text-align: center;
}
.button:hover {
    background-color: var(--hover-color);
}
form .button {
    width: 100%;
}

/* --- 6. TABELLEN --- */
.table-wrapper {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}
thead th {
    background-color: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    padding: 12px;
 /*   text-align: left;   */
    font-weight: 600;
    color: #374151;
}
tbody td {
    padding: 5px 5px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}
tbody tr:nth-child(even) { background-color: #f9fafb; }
tbody tr:last-child td { border-bottom: none; }

.category-row td {
    background-color: #e9ecef;
    font-weight: bold;
    border-top: 2px solid #ccc;
}
.category-row h3 {
    margin: 0;
    font-size: 1.1em;
}

/* --- 7. SPEZIFISCHE KOMPONENTEN --- */
/* Action-Buttons in Tabellen */
.action-button {
    padding: 6px 12px;
    width: 80px;
    margin-bottom: 5px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    color: white !important; /* Wichtig, um Link-Farben zu überschreiben */
    font-weight: bold;
    transition: opacity 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}


.button, .button.button1 {
    width: auto; /* Buttons nicht mehr standardmäßig volle Breite */
    padding: 12px 20px;
    background-color: #0c456a; /* Deine Hauptfarbe */
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
}

.button.button2 {
    margin-left: 1em;
    width: auto; /* Buttons nicht mehr standardmäßig volle Breite */
    background-color: #cf0000; 
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
}

.button:hover, .button.button1:hover {
    background-color: #ff6347;
}


.edit-button { background-color: var(--green); }
.delete-button { background-color: var(--red); }

.alnright { text-align: right; }
.alncenter { text-align: center; }
.alnleft { text-align: left; }


.alnlefticon { 
text-align: left;
width: 10%; 
}
.alnleftdes { 
text-align: left;
width: 30%; 
}

.alnleftlink { 
text-align: left;
width: 30%; 
}

.alnleftrei { 
text-align: right;
width: 10%; 
}

.alnleftedit { 
text-align: right;
width: 20%; 
}

.nav-links .nav-logout {
    margin-left: auto;
}

.nav-links .nav-user {
        float: right; /* Bild rechts positionieren */
        margin-left: 15px; /* Optional: Abstand zum Text */
}


/* Plattform-Icons in Tabellen */
.platform-cell {
 /*    display: flex; */
    align-items: left;
  /*       gap: 8px; */
}
.platform-icon {
    width: 34px;
    height: 34px;
}

/* Erfolgs- & Fehlermeldungen */
.message {
    padding: 1em;
    border-radius: 6px;
    margin-bottom: 1.5em;
    border: 1px solid transparent;
}
.success { background-color: var(--success-bg); color: var(--success-text); }
.error { background-color: var(--error-bg); color: var(--error-text); }

/* Hilfe-Icons & Popups */
.label-wrapper { display: flex; align-items: center; }
.form-group .label-wrapper label { margin-bottom: 10; }
.help-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    background-color: var(--blue);
    color: white;
    font-weight: bold;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8em;
    margin-left: 8px;
}
.tippy-box[data-theme~='custom'] {
    background-color: #343a40;
    color: #f8f9fa;
}
.tippy-box[data-theme~='custom'][data-placement^='right'] > .tippy-arrow::before {
    border-right-color: #343a40;
}
/* ... (andere Tippy-Pfeilrichtungen bei Bedarf) ... */

/* Drag-and-Drop Stile */
.sortable-ghost { opacity: 0.4; background-color: #cce5ff; }
#sortable-links tr { cursor: grab; }


/* ============================================= */
/* --- 8. RESPONSIVE ANPASSUNGEN --- */
/* ============================================= */
@media (max-width: 900px) {
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        border-radius: 0;
        margin-bottom: 0;
        z-index: 1000;
        padding: 10px 1.5em;
        box-sizing: border-box;
    }
    .container {
 /*       padding-top: 80px; / Platz für den fixierten Header */
    }
    .menu-icon {
        display: block;
    }
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #343a40;
        box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    }
    .nav-links.active {
        display: flex;
    }
    .nav-links li {
        width: 100%;
        text-align: center;
    }
    .nav-links li a {
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
.nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%; /* Direkt unter dem Header */
    left: 0;
    right: 0;
    
    /* KORREKTUR: Eine feste, deckende Hintergrundfarbe */
    background-color: var(--primary-color); /* Nutzt die Hauptfarbe des Headers */

    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-radius: 0 0 12px 12px; /* Optional: Unten abrunden */
    z-index: 1000;
}
}

    /* Zwingt die Tabelle, sich an die Bildschirmbreite zu halten */
    table {
        table-layout: fixed;
        width: 100%;
    }

    /* Erlaubt das Umbrechen von langen Wörtern und Links in den Zellen */
    table th,
    table td {
        word-wrap: break-word; /* Ältere Browser */
        overflow-wrap: break-word; /* Moderner Standard */
        hyphens: auto; /* Fügt bei Bedarf Trennstriche hinzu */
    }

}

    .nav-links .nav-logout {
        margin-left: 0; /* Hebt den Auto-Abstand für die mobile Ansicht auf */
        margin-top: auto; /* Schiebt den Punkt im aufklappenden Menü nach unten */
    }

@media (max-width: 768px) {

    /* Zwingt die Tabelle, sich an die Bildschirmbreite zu halten */
    table {
        table-layout: fixed;
        width: 100%;
    }

    /* Erlaubt das Umbrechen von langen Wörtern und Links in den Zellen */
    table th,
    table td {
        word-wrap: break-word; /* Ältere Browser */
        overflow-wrap: break-word; /* Moderner Standard */
        hyphens: auto; /* Fügt bei Bedarf Trennstriche hinzu */
    }

    /* Optional, aber empfohlen: Spaltenbreiten gezielt steuern */
    /* Passt die Spaltenbreiten für die Link-Tabelle an */
    #links-table th:nth-of-type(1) { width: 15%; } /* Icon */
    #links-table th:nth-of-type(2) { width: 30%; } /* Beschriftung */
    #links-table th:nth-of-type(3) { width: 15%; } /* Platz */
    #links-table th:nth-of-type(4) { width: 15%; } /* Klicks */
    #links-table th:nth-of-type(5) { width: 25%; } /* Aktionen */

    /* Passt die Spaltenbreiten für die Benutzer-Tabelle an */
    #users-table th:nth-of-type(1) { width: 30%; } /* Nachname */
    #users-table th:nth-of-type(2) { width: 30%; } /* Vorname */
    #users-table th:nth-of-type(3) { width: 40%; } /* Aktionen */
    
    /* Du kannst hier weitere Regeln für andere Tabellen hinzufügen */

    .nav-links .nav-logout {
        margin-left: 0; /* Hebt den Auto-Abstand für die mobile Ansicht auf */
        margin-top: auto; /* Schiebt den Punkt im aufklappenden Menü nach unten */
    }
}