/* SALWeb Custom Styles */

html {
    font-size: 14px;
}

html {
    overflow-x: hidden;
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
    overflow-x: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Dark SAL navbar */
.bg-sal-dark {
    background-color: #32373c !important;
}

.navbar-sal .nav-link,
.navbar-sal .navbar-brand,
.navbar-sal .dropdown-toggle {
    color: #ffffff !important;
}

.navbar-sal .nav-link:hover,
.navbar-sal .dropdown-toggle:hover {
    color: #b8d4f0 !important;
}

.navbar-sal .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.3);
}

.navbar-sal .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-sal .dropdown-menu {
    background-color: #32373c;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.navbar-sal .dropdown-item {
    color: #ffffff;
}

.navbar-sal .dropdown-item:hover,
.navbar-sal .dropdown-item:focus {
    background-color: #4a5058;
    color: #ffffff;
}

.navbar-sal .dropdown-divider {
    border-top-color: rgba(255, 255, 255, 0.15);
}

/* Status row colors for table */
tr.status-beauftragt > td {
    background-color: #ffffff;
}

tr.status-uebergabe > td {
    background-color: #ffeb3b;
}

tr.status-in-arbeit > td {
    background-color: #ff9800;
}

tr.status-fertiggestellt > td {
    background-color: #4caf50;
    color: #fff;
}

tr.status-in-verzug > td {
    background-color: #f44336;
    color: #fff;
}

tr.status-storniert > td {
    background-color: #9e9e9e;
    color: #fff;
}

/* Bootstrap overrides for colored rows */
.table-warning-orange {
    --bs-table-bg: #ff9800 !important;
    background-color: #ff9800 !important;
}

tr.table-warning-orange > td {
    background-color: #ff9800 !important;
}

tr.table-success > td {
    background-color: #4caf50 !important;
    color: #fff;
}

tr.table-danger > td {
    background-color: #f44336 !important;
    color: #fff;
}

tr.table-warning > td {
    background-color: #ffeb3b !important;
}

tr.table-secondary > td {
    background-color: #9e9e9e !important;
    color: #fff;
}

/* Compact table */
.table-auftraege {
    font-size: 0.85rem;
}

.table-auftraege th {
    white-space: nowrap;
    font-size: 0.8rem;
    vertical-align: middle;
    background-color: #32373c;
    color: #ffffff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-auftraege td {
    vertical-align: middle;
    white-space: nowrap;
}

.table-auftraege-scroll {
    flex: 1;
    overflow: auto;
    width: 100%;
}

.desktop-table {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Login page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #32373c 0%, #4a5058 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.login-card .card-header {
    background-color: #32373c;
    color: white;
    text-align: center;
    border-radius: 12px 12px 0 0 !important;
    padding: 1.5rem;
}

/* Active filter badges */
.filter-badge {
    font-size: 0.8rem;
    margin: 2px;
}

/* Status legend */
.status-legend {
    font-size: 0.8rem;
}

.status-legend .badge {
    font-size: 0.75rem;
    margin-right: 4px;
}

/* Mobile order cards */
.order-card {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    border-left-width: 4px !important;
}

.order-card .card-header {
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.85rem;
}

.order-card .card-body {
    padding: 0.5rem 0.75rem;
}

.order-card .label-col {
    font-weight: 600;
    color: #6c757d;
    font-size: 0.8rem;
}

/* Status bar at bottom */
/* Statusbar immer sichtbar unten */
.status-bar {
    background-color: #e9ecef;
    padding: 0.3rem 1rem;
    font-size: 0.95rem;
    border-top: 1px solid #dee2e6;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

/* User info in navbar */
.user-info-text {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.2;
}

/* Modal */
.modal-content {
    border-radius: 8px;
}

/* Responsive: hide table on mobile, show cards */
@media (max-width: 767.98px) {
    .desktop-table {
        display: none !important;
    }
    .mobile-cards {
        display: flex !important;
        flex-direction: column;
        flex: 1;
        overflow-y: auto;
    }
    .mobile-card {
        -webkit-user-select: none;
        user-select: none;
    }
}

@media (min-width: 768px) {
    .mobile-cards {
        display: none !important;
    }
}

/* Tag-Input fuer Erweiterte Suche */
.tag-input-wrap {
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 4px 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    background: #fff;
    min-height: 34px;
    cursor: text;
}
.tag-input-wrap:focus-within {
    border-color: #0693e3;
    box-shadow: 0 0 0 2px rgba(6,147,227,0.15);
}
.tag-input-wrap .tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.tag-input-wrap .tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #0693e3;
    color: #fff;
    font-size: 0.78em;
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
}
.tag-input-wrap .tag-chip .tag-remove {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
    margin-left: 2px;
}
.tag-input-wrap .tag-chip .tag-remove:hover {
    opacity: 1;
}
.tag-input-wrap .tag-input {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    min-width: 80px;
    flex: 1;
    font-size: 0.85em;
    background: transparent;
}

/* Inline Modal Message (Toast im Dialog) */
.modal-msg {
    font-size: 0.85em;
    padding: 8px 14px;
    border-radius: 6px;
    margin-bottom: 10px;
    animation: msgFadeIn 0.2s;
}
.modal-msg.msg-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.modal-msg.msg-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
@keyframes msgFadeIn { from { opacity:0; transform:translateY(-5px); } to { opacity:1; transform:translateY(0); } }

/* Desktop Spalten Drag & Drop */
.desktop-sort-item {
    transition: box-shadow 0.15s;
    font-size: 0.88em;
}
.desktop-sort-item:hover {
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.desktop-sort-item[draggable]:active {
    cursor: grabbing;
}

/* Zeilen-Aktions-Buttons */
.row-actions button {
    opacity: 0.6;
    transition: opacity 0.15s;
    margin: 0 1px;
    line-height: 1;
}
tr:hover .row-actions button {
    opacity: 0.9;
}
.row-actions button:hover {
    opacity: 1 !important;
}

/* Sticky Table Headers in scrollbaren Containern */
.table-responsive th,
.modal .table-responsive th {
    position: sticky !important;
    top: 0 !important;
    z-index: 2 !important;
    background: #f5f6fa !important;
    box-shadow: 0 1px 0 #dee2e6;
}

.modal .form-label {
    font-weight: 500;
    font-size: 0.9rem;
}

/* Main content - margin-bottom fuer fixed Statusbar */
.main-content {
    flex: 1;
    overflow: hidden;
    margin-bottom: 36px;
    display: flex;
    flex-direction: column;
}

/* SAL Primary Button */
.btn-sal {
    background: #0693e3;
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
}
.btn-sal:hover {
    background: #d39f75;
    color: white;
}
.btn-sal:disabled {
    background: #7bc4f0;
    color: white;
}

/* Alle Modal-Buttons einheitlich */
.modal-footer .btn {
    border-radius: 10px;
    padding: 6px 20px;
    font-size: 0.9em;
}

/* SAL Modal Header */
.modal-header-sal {
    background: #0693e3;
    color: white;
}

/* Alert X-Button vertikal zentriert */
.alert-dismissible .btn-close {
    top: 50%;
    transform: translateY(-50%);
}

/* Side Menu Items */
#sideMenu a.d-block:hover,
#sideMenu button.d-block:hover {
    background-color: #f0ece8;
}

/* Loading Overlay */
.spinner-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,90,154,0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.spinner-overlay.active { display: flex; }
.spinner-overlay .spinner-border { width: 3rem; height: 3rem; color: #fff; }
.spinner-overlay p { margin-top: 12px; color: #fff; font-size: 0.95em; }

/* Table borderless clean look */
.table-auftraege {
    border-collapse: separate;
    border-spacing: 0;
}

.table-auftraege thead th:hover {
    background: #f0ece8;
}

.table-auftraege thead th {
    background: #faf8f5;
    color: #333;
    font-weight: 700;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid #ddd;
    padding: 10px;
}

.table-auftraege tbody td {
    padding: 10px;
    border-bottom: 1px solid #f0ece8;
    font-size: 0.95em;
    color: #222;
}

.table-auftraege tbody tr:hover td {
    background-color: #f9f6f2;
}

/* Auftrag row */
.auftrag-row td {
    background: white;
}

.auftrag-row.selected td,
.table tr.row-selected td {
    background: #e3f0fc !important;
    font-weight: 600;
}
