/**
 * App-weites Theme – einheitlich, modern, gut lesbar
 * Milde#Rock Produktionsplanungs-PWA
 * Übersichten und Tabellen bleiben strukturell unverändert.
 */

:root {
    /* Brand */
    --primary-color: #2d9d64;
    --primary-hover: #248f57;
    --secondary-color: #3d8b99;
    --secondary-light: #e8f4f6;
    --secondary-dark: #1a4d56;
    --accent-dark: #1a1a1a;
    --accent-light: #e2e8ec;

    /* Hintergründe – ruhig, augenschonend */
    --bg-page: #f5f7fa;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-header: #ffffff;

    /* Text – hohe Lesbarkeit */
    --text-primary: #1a1a1a;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-on-primary: #ffffff;
    --text-on-secondary: #ffffff;

    /* UI */
    --border-color: #e2e8f0;
    --border-focus: var(--secondary-color);
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --shadow-sm: 0 1px 3px rgba(26, 26, 26, 0.06);
    --shadow: 0 4px 12px rgba(26, 26, 26, 0.08);
    --shadow-md: 0 8px 24px rgba(26, 26, 26, 0.1);
    --transition: 0.2s ease;
}

/* Typografie – Basis */
body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text-primary);
    background: var(--bg-page);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

@media (min-width: 768px) {
    body {
        font-size: 1.0625rem;
    }
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9375rem; }

@media (min-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.625rem; }
    h3 { font-size: 1.35rem; }
}

p {
    margin-bottom: 0.75em;
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Navbar – klar, modern */
.navbar {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-dark) 100%) !important;
    box-shadow: var(--shadow);
    font-size: 0.9375rem;
}

.navbar-brand {
    font-size: 1.0625rem;
    font-weight: 600;
    padding: 0.25rem 0;
}

.navbar-brand .logo-img {
    height: 40px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

@media (max-width: 991px) {
    .navbar-brand .logo-img {
        height: 36px;
        max-width: 160px;
    }
}

.nav-link {
    margin: 0 0.2rem;
    padding: 0.5rem 0.75rem !important;
    border-radius: var(--radius);
    transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

.nav-button {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    min-width: 68px;
    padding: 0.4rem 0.5rem !important;
    line-height: 1.2;
}

.nav-button i {
    font-size: 1.15rem;
    margin-bottom: 0.15rem;
    display: block;
}

.nav-button span {
    font-size: 0.75rem;
    font-weight: 500;
    display: block;
    white-space: nowrap;
}

@media (max-width: 991px) {
    .nav-button {
        flex-direction: row !important;
        min-width: auto;
        padding: 0.5rem 0.75rem !important;
    }
    .nav-button i {
        margin-bottom: 0;
        margin-right: 0.5rem;
        font-size: 1rem;
    }
    .nav-button span {
        font-size: 0.875rem;
    }
}

.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-top: 0.35rem;
    padding: 0.25rem;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    transition: background var(--transition);
}

.dropdown-item:hover {
    background: var(--secondary-light);
    color: var(--text-primary);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.navbar .dropdown:hover .dropdown-menu {
    display: block;
    animation: fadeIn 0.2s ease;
}

.navbar .dropdown .dropdown-menu {
    margin-top: 0;
    border-top: none;
}

.navbar .dropdown-menu:hover {
    display: block;
}

/* Mobile Nav */
@media (max-width: 991px) {
    .navbar .dropdown:hover .dropdown-menu {
        display: none;
    }
    .navbar-collapse .dropdown-menu {
        position: static !important;
        float: none !important;
        width: 100% !important;
        margin-top: 0.5rem !important;
        margin-bottom: 0.5rem !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        border-radius: var(--radius) !important;
    }
    .navbar-collapse .dropdown.show > .dropdown-menu {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    .navbar-collapse .dropdown-item {
        color: rgba(255, 255, 255, 0.95) !important;
        padding: 0.65rem 1rem !important;
    }
    .navbar-collapse .dropdown-item:hover {
        background: rgba(255, 255, 255, 0.15) !important;
        color: #fff !important;
    }
    .navbar-collapse .dropdown-header {
        color: rgba(255, 255, 255, 0.75) !important;
        font-size: 0.8125rem !important;
    }
    .navbar-collapse .dropdown-divider {
        border-color: rgba(255, 255, 255, 0.2) !important;
    }
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    background: var(--secondary-color) !important;
    color: var(--text-on-secondary) !important;
    border: none !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0.75rem 1rem;
}

.card-header .card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1rem 1.25rem;
}

@media (min-width: 768px) {
    .card-body {
        padding: 1.25rem 1.5rem;
    }
}

/* Buttons */
.btn {
    border-radius: var(--radius);
    font-weight: 500;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
    border: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

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

.btn-primary {
    background: var(--primary-color);
    color: var(--text-on-primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: var(--text-on-primary);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-on-secondary);
}

.btn-secondary:hover {
    background: var(--secondary-dark);
    color: var(--text-on-secondary);
}

.btn-success {
    background: #198754;
    color: #fff;
}

.btn-success:hover {
    background: #157347;
    color: #fff;
}

.btn-warning {
    background: #e9a23b;
    color: #1a1a1a;
}

.btn-warning:hover {
    background: #d8942e;
    color: #1a1a1a;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background: #bb2d3b;
    color: #fff;
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: var(--text-on-primary);
}

.btn-outline-secondary {
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--secondary-color);
    color: var(--text-on-secondary);
}

.btn-sm {
    padding: 0.35rem 0.85rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.6rem 1.5rem;
    font-size: 1.0625rem;
}

/* Tabellen – übersichtlich, nicht zerstören */
.table {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.table thead th {
    background: var(--secondary-color);
    color: var(--text-on-secondary);
    border: none;
    font-weight: 600;
    font-size: 0.8125rem;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.65rem 1rem;
    vertical-align: middle;
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: var(--secondary-light);
}

.table-striped > tbody > tr:nth-of-type(odd) > td {
    background: rgba(0, 0, 0, 0.02);
}

.table-striped > tbody > tr:nth-of-type(odd):hover > td {
    background: var(--secondary-light);
}

.table-borderless td,
.table-borderless th {
    border: none;
    padding: 0.4rem 0.5rem;
}

/* Responsive Tables */
.table-responsive {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 767px) {
    .table thead th,
    .table tbody td {
        padding: 0.5rem 0.75rem;
        font-size: 0.9375rem;
    }
}

/* Formulare */
.form-control,
.form-select {
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
    padding: 0.5rem 0.75rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(61, 139, 153, 0.15);
    outline: none;
}

.form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

/* Alerts */
.alert {
    border-radius: var(--radius-lg);
    border: none;
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.25rem;
}

.alert-info {
    background: var(--secondary-light);
    color: var(--secondary-dark);
    border-left: 4px solid var(--secondary-color);
}

.alert-success {
    background: #ecfdf3;
    color: #166534;
    border-left: 4px solid #22c55e;
}

.alert-warning {
    background: #fffbeb;
    color: #b45309;
    border-left: 4px solid #e9a23b;
}

.alert-danger {
    background: #fef2f2;
    color: #b91c1c;
    border-left: 4px solid #dc3545;
}

/* Badges */
.badge {
    border-radius: var(--radius-sm);
    font-weight: 500;
    padding: 0.35em 0.65em;
    font-size: 0.8125rem;
}

/* Modals */
.modal-content {
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.modal-header {
    background: var(--secondary-color);
    color: var(--text-on-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border-bottom: none;
    padding: 1rem 1.25rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1.125rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

/* Footer */
.footer {
    background: var(--accent-light) !important;
    box-shadow: 0 -2px 8px rgba(26, 26, 26, 0.06);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Navbar-Spezial (PWA, User) */
.pwa-install-btn {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.pwa-install-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
}

#clear-cache-btn {
    transition: all var(--transition);
    border-radius: var(--radius);
}

#clear-cache-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

#clear-cache-btn:disabled {
    opacity: 0.6;
}

/* Loading */
#loading-spinner {
    z-index: 1050;
}

/* List Groups */
.list-group-item {
    border-color: var(--border-color);
    padding: 0.65rem 1rem;
    color: var(--text-primary);
}

.list-group-item:hover {
    background: var(--secondary-light);
}

/* Pagination */
.pagination .page-link {
    border-radius: var(--radius-sm);
    border-color: var(--border-color);
}

.pagination .page-item.active .page-link {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Main Content Area */
main {
    padding-bottom: 80px;
    min-height: calc(100vh - 155px);
}

/* Seiten-Überschriften (z. B. Dashboard, Admin) */
main .container-fluid h1,
main .container h1 {
    margin-bottom: 0.35em;
    font-weight: 600;
}

main .container-fluid .text-muted,
main .container .text-muted {
    margin-bottom: 1.25rem;
}

/* Dashboard-Welcome-Card (z. B. bg-primary) */
.card.bg-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%) !important;
    color: var(--text-on-primary) !important;
    border: none !important;
}

/* Navigationsglocke: sanftes Laeuten bei offenen Problemfaellen / ungelesenen News */
@keyframes navBellRing {
    0%   { transform: scale(1)    rotate(0deg);   filter: drop-shadow(0 0 0 transparent); }
    8%   { transform: scale(1.12) rotate(12deg);  filter: drop-shadow(0 0 4px rgba(220, 53, 69, 0.35)); }
    16%  { transform: scale(1.14) rotate(-10deg); filter: drop-shadow(0 0 6px rgba(220, 53, 69, 0.50)); }
    24%  { transform: scale(1.10) rotate(8deg);   filter: drop-shadow(0 0 5px rgba(220, 53, 69, 0.40)); }
    32%  { transform: scale(1.06) rotate(-5deg);  filter: drop-shadow(0 0 3px rgba(220, 53, 69, 0.25)); }
    40%  { transform: scale(1.02) rotate(2deg);   filter: drop-shadow(0 0 1px rgba(220, 53, 69, 0.10)); }
    50%  { transform: scale(1)    rotate(0deg);   filter: drop-shadow(0 0 0 transparent); }
    100% { transform: scale(1)    rotate(0deg);   filter: drop-shadow(0 0 0 transparent); }
}
.nav-bell-icon {
    transform-origin: 50% 10%;
    transition: color 0.3s ease;
}
.nav-bell-icon.nav-bell-pulse {
    animation: navBellRing 3.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) infinite;
    color: #c0392b;
}

/* Mute-Buttons im Glocken-Dropdown */
.bell-mute-btn {
    line-height: 1;
    font-size: 0.82rem;
    transition: opacity 0.2s ease;
}
.bell-mute-btn:hover {
    opacity: 0.7;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .btn:hover,
    .nav-link:hover {
        transform: none;
    }
}

/* Modals app-weit breiter: mehr Platz für Inhalt (z. B. Job-Details, Dokumentation) */
.modal-dialog {
    max-width: min(90vw, 960px);
    width: 90%;
    margin-left: auto;
    margin-right: auto;
}
.modal-dialog.modal-lg {
    max-width: min(95vw, 1200px);
    width: 95%;
}
.modal-dialog.modal-xl {
    max-width: min(98vw, 1400px);
    width: 98%;
}
@media (min-width: 992px) {
    .modal-dialog { width: 90%; max-width: 960px; }
    .modal-dialog.modal-lg { width: 95%; max-width: 1200px; }
    .modal-dialog.modal-xl { width: 98%; max-width: 1400px; }
}

/* Nav-Menü: Seite „in Bearbeitung“ (Banner unter Seitentitel, page_header_standard) */
.nav-under-construction-banner {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 0.35rem;
    margin-bottom: 0.15rem;
    padding: 6px 8px;
    box-sizing: border-box;
    border-top: 2px solid #171717;
    border-bottom: 2px solid #171717;
    background: repeating-linear-gradient(
        -45deg,
        #facc15,
        #facc15 8px,
        #171717 8px,
        #171717 16px
    );
}
.nav-under-construction-banner__label {
    display: inline-block;
    background: #facc15;
    color: #111;
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    padding: 3px 14px;
    border: 2px solid #171717;
    text-transform: uppercase;
}
