/* ========================================
   Entry Portal — Eigenstaendiges CSS
   Verwendet dieselben CSS-Variablen und
   Designsprache wie das Hauptprojekt.
   ======================================== */

/* Light Theme (Standard) */
:root, [data-theme="light"] {
    --primcol: #563698;
    --seccol: #45413f;
    --accent: #006d7a;
    --thirdcol: #b0af41;
    --bgcol: #F5F5F5;
    --bgcoldark: #FFFFFF;
    --bgcolmid: #E0E0E0;
    --textcol: #212121;
    --white: #ffffff;
    --whitetrans: #00000015;
    --blacktrans: #ffffff20;
    --farbe5: #D81B60;
    --accent2: #D81B60;
}

/* Dark Theme */
[data-theme="dark"] {
    --primcol: #7a56c4;
    --seccol: #E7C29C;
    --accent: #5FC6BF;
    --thirdcol: #D55672;
    --bgcol: #636468;
    --bgcoldark: #131B28;
    --bgcolmid: #3B4048;
    --textcol: #f3f4f6;
    --white: #ffffff;
    --whitetrans: #ffffff30;
    --blacktrans: #00000030;
    --farbe5: #FE52B1;
    --accent2: #f6a2ff;
}

/* ========================================
   Basis
   ======================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bgcoldark);
    color: var(--textcol);
    font-family: 'Roboto', Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ========================================
   Layout
   ======================================== */

.entry-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.entry-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 10px;
    font-size: 0.8rem;
    color: var(--seccol);
    background-color: var(--bgcoldark);
    border-top: 1px solid var(--bgcolmid);
}

/* ========================================
   Login
   ======================================== */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.login-box {
    background-color: var(--bgcolmid);
    border: 1px solid var(--primcol);
    border-radius: 8px;
    padding: 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 20px var(--blacktrans);
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-header h1 {
    color: var(--primcol);
    font-size: 1.6rem;
    margin: 0 0 6px 0;
}

.login-subtitle {
    color: var(--seccol);
    font-size: 0.9rem;
    margin: 0;
}

.login-subsubtitle {
    color: var(--seccol);
    font-size: 0.75rem;
    opacity: 0.75;
    margin: 2px 0 0 0;
}

.login-message {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.login-message--error {
    background-color: rgba(213, 86, 114, 0.15);
    color: var(--thirdcol);
    border: 1px solid var(--thirdcol);
}

.login-message--info {
    background-color: rgba(95, 198, 191, 0.15);
    color: var(--accent);
    border: 1px solid var(--accent);
}

/* ========================================
   Formulare
   ======================================== */

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--seccol);
}

.form-group input {
    padding: 10px 12px;
    border: 1px solid var(--bgcol);
    border-radius: 4px;
    background-color: var(--bgcoldark);
    color: var(--textcol);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primcol);
    box-shadow: 0 0 0 2px rgba(122, 86, 196, 0.2);
}

.form-group input::placeholder {
    color: var(--seccol);
    opacity: 0.5;
}

.compare-number {
    text-align: center;
    padding: 8px;
    background-color: var(--bgcoldark);
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--seccol);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--primcol);
    color: var(--white);
    flex: 1;
}

.btn-primary:hover {
    filter: brightness(1.15);
}

.btn-secondary {
    background-color: var(--bgcol);
    color: var(--textcol);
}

.btn-secondary:hover {
    filter: brightness(0.9);
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.85rem;
}

/* ========================================
   Dashboard
   ======================================== */

.dashboard-container {
    width: 100%;
    max-width: 900px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.dashboard-header h1 {
    color: var(--primcol);
    font-size: 1.4rem;
    margin: 0;
}

.dashboard-intro {
    color: var(--seccol);
    margin: 0 0 20px 0;
    font-size: 0.95rem;
}

/* ========================================
   App-Karten
   ======================================== */

.app-section {
    margin-bottom: 24px;
}

.app-section-title {
    color: var(--seccol);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--bgcolmid);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

/* Feste Spaltenzahl pro Section (override auto-fill).
   .app-section--cols-N forciert N Spalten, bricht im Mobile-View runter. */
.app-section--cols-4 .app-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.app-section--cols-3 .app-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.app-section--cols-2 .app-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 900px) {
    .app-section--cols-4 .app-grid,
    .app-section--cols-3 .app-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .app-section--cols-4 .app-grid,
    .app-section--cols-3 .app-grid,
    .app-section--cols-2 .app-grid {
        grid-template-columns: 1fr;
    }
}

.app-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background-color: var(--bgcolmid);
    border: 1px solid var(--bgcol);
    border-radius: 8px;
    text-decoration: none;
    color: var(--textcol);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    cursor: pointer;
    /* Cards nicht auf Row-Hoehe der hoechsten Card stretchen — jede Card
       nimmt ihre eigene Content-Hoehe; in der Live-Sektion entsteht so
       die saubere visuelle Progression portal > portal2 > portal3 > portal4 */
    align-self: center;
}

.app-card:hover {
    border-color: var(--primcol);
    box-shadow: 0 4px 12px var(--blacktrans);
    transform: translateY(-2px);
    text-decoration: none;
}

.app-icon {
    font-size: 2rem;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bgcoldark);
    border-radius: 8px;
}

.app-info {
    flex: 1;
    min-width: 0;
}

.app-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 2px 0;
    color: var(--textcol);
}

.app-desc {
    font-size: 0.8rem;
    color: var(--seccol);
    margin: 0;
    line-height: 1.3;
}

.app-version {
    font-size: 0.7rem;
    color: var(--seccol);
    opacity: 0.7;
    margin: 4px 0 0 0;
    line-height: 1.2;
}

.app-version span {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    color: var(--textcol);
}

.no-apps {
    text-align: center;
    padding: 40px;
    color: var(--seccol);
}

/* Kompakte Darstellung: entweder ganze Abschnitte (.app-section--compact)
   oder einzelne Cards (.app-card--compact) */
.app-section--compact {
    opacity: 0.75;
}

.app-section--compact:hover {
    opacity: 1;
}

.app-section--compact .app-section-title {
    font-size: 0.7rem;
}

.app-section--compact .app-grid {
    /* Feste Spaltenbreite + auto-fit, damit weniger Kacheln (< Container-Breite)
       symmetrisch zentriert dargestellt werden statt linksbuendig zu hocken. */
    grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
    gap: 10px;
    justify-content: center;
}

.app-card--compact {
    opacity: 0.75;
}

.app-card--compact:hover {
    opacity: 1;
}

.app-section--compact .app-card,
.app-card--compact {
    gap: 10px;
    padding: 10px 12px;
}

.app-section--compact .app-icon,
.app-card--compact .app-icon {
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.app-section--compact .app-name,
.app-card--compact .app-name {
    font-size: 0.85rem;
    margin: 0;
}

.app-section--compact .app-desc,
.app-card--compact .app-desc {
    font-size: 0.7rem;
}

.app-section--compact .app-version,
.app-card--compact .app-version {
    font-size: 0.65rem;
    margin-top: 2px;
}

/* Wenn .app-card--compact als EINZELNE Card in einer normalen Section
   sitzt (z.B. portal2 in der Live-Sektion), soll sie nicht auf die Row-
   Hoehe der normalen Cards gestreckt werden. In Sektionen, die selbst
   compact sind (devel/other), bleibt der Default-Stretch erhalten. */
.app-section:not(.app-section--compact) .app-card--compact {
    align-self: center;
    width: 97%;
    margin-left: auto;
    margin-right: auto;
}

/* Progressive Compact-Stufen 2/3:
   Cards selbst werden schrittweise kleiner (width + margin auto),
   zusaetzlich werden Inhalte (Icon/Text) weiter geschrumpft und die
   Opacity reduziert. Hover hebt die Opacity zurueck auf 1. */
.app-card--compact-2 {
    opacity: 0.6;
    gap: 8px;
    padding: 6px 10px;
    width: 92%;
    margin-left: auto;
    margin-right: auto;
    /* nicht auf Row-Hoehe strecken — Card nur so hoch wie ihr Inhalt */
    align-self: center;
}
.app-card--compact-2:hover {
    opacity: 1;
}
.app-card--compact-2 .app-icon {
    font-size: 1rem;
    width: 26px;
    height: 26px;
    border-radius: 5px;
}
.app-card--compact-2 .app-name {
    font-size: 0.78rem;
    margin: 0;
    line-height: 1.15;
}
.app-card--compact-2 .app-desc {
    font-size: 0.65rem;
    line-height: 1.15;
}
.app-card--compact-2 .app-version {
    font-size: 0.6rem;
    line-height: 1.15;
    margin-top: 1px;
}

.app-card--compact-3 {
    opacity: 0.5;
    gap: 6px;
    padding: 4px 8px;
    width: 82%;
    margin-left: auto;
    margin-right: auto;
    align-self: center;
}
.app-card--compact-3:hover {
    opacity: 1;
}
.app-card--compact-3 .app-icon {
    font-size: 0.85rem;
    width: 22px;
    height: 22px;
    border-radius: 4px;
}
.app-card--compact-3 .app-name {
    font-size: 0.7rem;
    margin: 0;
    line-height: 1.1;
}
.app-card--compact-3 .app-desc {
    font-size: 0.58rem;
    line-height: 1.1;
}
.app-card--compact-3 .app-version {
    font-size: 0.55rem;
    line-height: 1.1;
    margin-top: 0;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 480px) {
    .login-box {
        padding: 20px;
    }

    .app-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* =========================================================
   Schnellhilfe-Button + Overlay
   ========================================================= */
.dashboard-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.entry-help-btn {
    background-color: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.entry-help-btn:hover {
    background-color: var(--accent);
    color: var(--bgcoldark);
}

.entry-help-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.entry-help-overlay[hidden] {
    display: none;
}

.entry-help-modal {
    background-color: var(--bgcolmid);
    border: 1px solid var(--primcol);
    border-radius: 8px;
    box-shadow: 0 8px 32px var(--blacktrans);
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.entry-help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--bgcol);
}

.entry-help-header h3 {
    margin: 0;
    color: var(--primcol);
    font-size: 1.1rem;
}

.entry-help-close {
    background: transparent;
    border: none;
    color: var(--seccol);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.entry-help-close:hover {
    color: var(--primcol);
}

.entry-help-body {
    padding: 16px 18px 20px;
    overflow-y: auto;
    color: var(--textcol);
    font-size: 0.9rem;
    line-height: 1.5;
}

.entry-help-body h4 {
    color: var(--accent);
    font-size: 0.95rem;
    margin: 16px 0 6px 0;
}

.entry-help-body h4:first-of-type {
    margin-top: 8px;
}

.entry-help-body p {
    margin: 0 0 8px 0;
}

.entry-help-body ul {
    margin: 0 0 10px 0;
    padding-left: 22px;
}

.entry-help-body li {
    margin-bottom: 4px;
}

.entry-help-body code {
    background-color: var(--bgcoldark);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.85em;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    color: var(--accent);
}

/* =========================================================
   Passwort-Sichtbarkeits-Toggle (Auge-Button)
   ========================================================= */
.pw-toggle-wrap {
    position: relative;
    display: block;
    width: 100%;
}
.pw-toggle-wrap > input {
    width: 100%;
    padding-right: 38px;
    box-sizing: border-box;
}
.pw-toggle-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 4px 8px;
    color: var(--textcol, inherit);
    opacity: 0.6;
}
.pw-toggle-btn:hover,
.pw-toggle-btn:focus {
    opacity: 1;
    outline: none;
}
