/* ============================================
   Resys – gemeinsamer Grundstil
   Wird von Leuchtenmanagement und Tankapp genutzt.
   Herkunft: das Stylesheet des Lagertools; hier stehen nur die Teile, die
   jede Anwendung braucht. App-Eigenes gehoert in die jeweilige app.css.
   ============================================ */


/* --- CSS Variables --- */
:root {
    --primary: #d10911;
    --primary-hover: #b0070e;
    --primary-light: #fde8e9;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --sidebar-width: 220px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.5;
    min-height: 100vh;
}

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

a:hover {
    text-decoration: underline;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    gap: 6px;
    font-family: var(--font);
}

.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-outline {
    background: #fff;
    border-color: var(--gray-300);
    color: var(--gray-700);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: #b91c1c; }

.btn-block { width: 100%; }

.btn-sm {
    padding: 5px 12px;
    font-size: 0.85rem;
}

.btn-entnahme {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
}
.btn-entnahme.active, .btn-entnahme:hover {
    background: var(--danger);
    color: #fff;
}

.btn-einlagerung {
    background: var(--success-light);
    color: var(--success);
    border-color: var(--success);
}
.btn-einlagerung.active, .btn-einlagerung:hover {
    background: var(--success);
    color: #fff;
}

.btn-inventur {
    background: var(--warning-light);
    color: #92400e;
    border-color: var(--warning);
}
.btn-inventur.active, .btn-inventur:hover {
    background: var(--warning);
    color: #fff;
}

.btn-book {
    font-size: 1.2rem;
    padding: 14px 20px;
    margin-top: 8px;
}

/* --- Form Elements --- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font);
    transition: border-color 0.15s;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-row {
    display: flex;
    gap: 12px;
}
.form-row .form-group { flex: 1; }

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-weight: 500;
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid var(--warning);
}



/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #8a060b 100%);
    padding: 20px;
}

.login-container {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-img {
    max-width: 180px;
    height: auto;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 1.5rem;
    color: var(--gray-800);
}



/* ============================================
   PAGE INFO ("i" hinter der Überschrift)
   ============================================ */
.page-info {
    display: inline-block;
    position: relative;
    vertical-align: middle;
    margin-left: 8px;
    /* Unabhängig von der Schriftgröße der Überschrift */
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1;
    text-align: left;
    color: var(--gray-700);
}

.page-info-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid var(--gray-300);
    border-radius: 50%;
    background: #fff;
    color: var(--gray-500);
    font-family: Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

/* Standard-Dreieck von <summary> entfernen */
.page-info-toggle::-webkit-details-marker { display: none; }
.page-info-toggle::marker { content: ''; }

.page-info-toggle:hover,
.page-info[open] .page-info-toggle {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.page-info-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.page-info-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 60;
    width: max-content;
    min-width: 260px;
    max-width: min(420px, calc(100vw - 32px));
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: normal;
    cursor: auto;
}

/* Für zentrierte Überschriften (Scan-Seiten) */
.page-info-center .page-info-panel {
    left: 50%;
    transform: translateX(-50%);
}

.page-info-section + .page-info-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-100);
}

.page-info-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-400);
    margin-bottom: 4px;
}

.page-info-panel p {
    color: var(--gray-700);
}

.page-info-panel ul {
    margin: 0;
    padding-left: 18px;
    list-style: disc;
}

.page-info-panel li {
    color: var(--gray-700);
    margin-bottom: 3px;
}

.page-info-panel li:last-child { margin-bottom: 0; }

/* Technische Details (nur Hauptadmin) optisch abgesetzt */
.page-info-tech {
    background: var(--gray-50);
    border-radius: var(--radius);
    margin-left: -6px;
    margin-right: -6px;
    padding: 10px 6px 8px;
}

.page-info-tech li {
    color: var(--gray-600);
    font-size: 0.8rem;
}

/* Mobil: als Sheet am unteren Bildschirmrand, damit nichts abgeschnitten wird */
@media (max-width: 600px) {
    .page-info-panel {
        position: fixed;
        top: auto;
        bottom: 16px;
        left: 16px;
        right: 16px;
        width: auto;
        min-width: 0;
        max-width: none;
        max-height: 60vh;
        overflow-y: auto;
        transform: none;
    }
    .page-info-center .page-info-panel {
        left: 16px;
        transform: none;
    }
}



/* ============================================
   BENUTZERMENÜ IN DER ROTEN KOPFZEILE
   Klick auf den Namen öffnet Passwortwechsel und Abmelden.
   ============================================ */
.user-menu {
    position: relative;
    display: inline-block;
}

.user-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: var(--radius);
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
    list-style: none;
    white-space: nowrap;
}

.user-menu-toggle::-webkit-details-marker { display: none; }
.user-menu-toggle::marker { content: ''; }

/* Kleines Dreieck als Hinweis, dass sich etwas öffnen lässt */
.user-menu-toggle::after {
    content: '\25BE';
    font-size: 0.7rem;
    opacity: 0.8;
}

.user-menu-toggle:hover,
.user-menu[open] .user-menu-toggle {
    background: rgba(255, 255, 255, 0.18);
}

.user-menu-toggle:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.user-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    min-width: 190px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.user-menu-panel a {
    display: block;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--gray-700);
    font-size: 0.95rem;
    text-decoration: none;
}

.user-menu-panel a:hover {
    background: var(--gray-50);
    color: var(--primary);
    text-decoration: none;
}


/* ============================================
   HILFSKLASSEN
   ============================================ */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-nowrap { white-space: nowrap; }
.text-muted  { color: var(--gray-400); }
.text-danger { color: var(--danger); }

/* ============================================
   KOPFZEILE DER ANWENDUNGEN
   ============================================ */
.app-header {
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.app-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
}
.app-header-brand:hover { text-decoration: none; }

.app-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px;
}

.app-page-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--gray-900);
}

.app-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.app-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}
