/* Ticket System Styles */

/* Ticket Description Styles */
.ticket-description {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
    color: #333;
}

.ticket-description p {
    margin-bottom: 1em;
}

.ticket-description a {
    color: #2e2e2e;
    text-decoration: underline;
}

.ticket-description a:hover {
    color: #1a1a1a;
}

.ticket-description ul, 
.ticket-description ol {
    margin-left: 20px;
    margin-bottom: 1em;
}

.ticket-description blockquote {
    border-left: 4px solid #dee2e6;
    padding-left: 1em;
    margin: 1em 0;
    color: #6c757d;
}

/* Customer Search Styles */
.customer-search-container {
    position: relative;
}

.customer-search-results {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    max-height: 350px;
    overflow-y: auto;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1050;
    display: none;
    margin-top: 2px;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

.search-result-item:hover {
    background-color: #f8f9fa;
    padding-left: 20px;
}

.search-result-item:last-child {
    border-bottom: none;
}

.customer-name {
    font-weight: 600;
    color: #212529;
    font-size: 1em;
}

.customer-meta {
    font-size: 0.875em;
    color: #6c757d;
    margin-top: 4px;
}

.search-loading {
    padding: 15px;
    text-align: center;
    color: #666;
}

.no-results {
    padding: 15px;
    text-align: center;
    color: #999;
}

.selected-customer-display {
    margin-top: 5px;
    display: none;
}

.selected-customer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(135deg, #2e2e2e 0%, #1a1a1a 100%);
    border-radius: 8px;
    color: white;
    box-shadow: 0 2px 6px rgba(46, 46, 46, 0.3);
}

.selected-customer span {
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
}

.selected-customer span::before {
    content: '✓';
    margin-right: 8px;
    font-weight: bold;
}

.selected-customer button {
    padding: 4px 8px;
    margin: 0;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: white;
    transition: all 0.2s;
}

.selected-customer button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal Improvements */
#createTicketModal .modal-header {
    background: linear-gradient(135deg, #2e2e2e 0%, #1a1a1a 100%) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

#createTicketModal .modal-title {
    color: white !important;
}

#createTicketModal .modal-body {
    padding: 25px 30px;
}

#createTicketModal .form-label {
    color: #495057;
    margin-bottom: 8px;
}

#createTicketModal .form-control,
#createTicketModal .form-select {
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 10px 14px;
    transition: all 0.3s;
}

#createTicketModal .form-control:focus,
#createTicketModal .form-select:focus {
    border-color: #2e2e2e;
    box-shadow: 0 0 0 0.2rem rgba(46, 46, 46, 0.25);
}

#createTicketModal .input-group-text {
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    color: #6c757d;
}

/* Dashboard Styles */
.ticket-dashboard {
    padding: 20px;
}

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

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-align: center;
}

.stat-card.alert {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    border: 1px solid #4b5563;
}

.stat-card.alert .stat-value,
.stat-card.alert .stat-label {
    color: white !important;
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: #2e2e2e;
    margin-bottom: 5px;
}

.stat-label {
    color: #4b5563;
    font-size: 1rem;
}

.dashboard-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.dashboard-section {
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.dashboard-section h3 {
    margin-bottom: 15px;
    font-size: 1.2em;
    color: #2e2e2e;
}

/* Ticket List Styles */
.ticket-list-container {
    padding: 20px;
}

.ticket-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.ticket-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.ticket-filters select {
    max-width: 200px;
}

.ticket-list {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.ticket-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background 0.2s;
}

.ticket-list-item:hover {
    background: rgba(46, 46, 46, 0.03);
}

.ticket-list-item.compact {
    display: block;
    padding: 10px 0;
}

/* ticketui-v1: Grundgeruest der zweizeiligen Vorgangszeile. Der v2-Block
   in index_v2.html verfeinert das, greift aber nur innerhalb von
   .v2-layout - ohne diese Regeln braeche die Ticketnummer ausserhalb
   wieder ueber drei Zeilen um. */
.tk-zeile-kopf {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tk-marken {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.ticket-list-item .ticket-number {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.tk-alter {
    font-size: 0.75rem;
    color: #8a97a8;
    white-space: nowrap;
}

.ticket-main {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.ticket-number {
    font-weight: bold;
    color: #4a5568;
    font-size: 0.9em;
}

.ticket-info {
    flex: 1;
}

.ticket-subject {
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 2px;
}

.ticket-customer {
    color: #718096;
    font-size: 0.9em;
}

.ticket-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ======================================================== Abzeichen
   ticketui-v1 (14.09.2026). Jede Stufe hat einen eigenen Farbton auf
   hellem Grund; der Text ist dunkel genug, dass die 10px-Schrift auf dem
   getoenten Grund noch klar lesbar bleibt.
   Die Symbole kommen aus prioAbzeichen()/statusAbzeichen() im Modul -
   Hausregel: Symbol UND Wort, nie Farbe allein. */

.priority-badge,
.status-badge,
.tk-marke-frist {
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.8em;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* --- Prioritaet: von ruhig nach laut ------------------------------- */
.priority-low      { background: #eef1f4; color: #5e6d7f; }
.priority-normal   { background: #e8edf2; color: #46566a; }
.priority-high     { background: #fdf0e3; color: #8a4f0f; }
.priority-critical { background: #fdeaec; color: #a32b38; }
/* Altbestand aus der Aufgaben-Skala: liest sich wie 'kritisch'. */
.priority-urgent   { background: #fdeaec; color: #a32b38; }

/* --- Status: vier Bedeutungsgruppen statt sechs Buntfarben ---------
   blau = laeuft, violett = wartet auf jemanden, gruen = erledigt,
   grau = zu. Innerhalb der blauen Gruppe trennen Symbol und Wort. */
.status-new         { background: #dceaf4; color: #1e4a61; }
.status-open        { background: #eef4f8; color: #3a6980; }
.status-in_progress { background: #eaf2f9; color: #2e6b94; }
.status-pending     { background: #eeecf7; color: #574b86; }
.status-resolved    { background: #e6f5ef; color: #1f7457; }
.status-closed      { background: #eef1f4; color: #6b7787; }

/* --- Fristmarke ---------------------------------------------------- */
.tk-marke-frist    { background: #fdeaec; color: #a32b38; }

/* Ticket Detail Styles */
.ticket-detail {
    padding: 20px;
    background: white;
    max-width: 1200px;
    margin: 0 auto;
}

.ticket-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.ticket-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.info-section {
    background: #f7fafc;
    padding: 20px;
    border-radius: 8px;
}

.info-section h3 {
    margin-bottom: 15px;
    font-size: 1.1em;
    color: #2d3748;
}

.info-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.info-row label {
    font-weight: 500;
    color: #718096;
    width: 120px;
    margin-right: 10px;
}

.info-row span {
    color: #2d3748;
}

.ticket-description {
    background: #f7fafc;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.ticket-description h3 {
    margin-bottom: 15px;
    font-size: 1.1em;
    color: #2d3748;
}

/* Timeline Styles */
.ticket-timeline {
    margin-bottom: 30px;
}

.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
    border-left: 2px solid #e2e8f0;
    margin-left: 10px;
}

.timeline-item.internal {
    background: #fef3c7;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.timeline-icon {
    position: absolute;
    left: -11px;
    top: 0;
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid #4299e1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #4299e1;
}

.timeline-content {
    padding-left: 20px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.timeline-author {
    font-weight: 500;
    color: #2d3748;
}

.timeline-date {
    color: #718096;
    font-size: 0.9em;
}

.timeline-body {
    color: #4a5568;
}

/* Add Comment Section */
.add-comment-section {
    background: #f7fafc;
    padding: 20px;
    border-radius: 8px;
}

.add-comment-section h3 {
    margin-bottom: 15px;
    font-size: 1.1em;
    color: #2d3748;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    font-size: 1.2em;
    color: #4299e1;
}

/* Ticket Navigation */
.ticket-nav {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-bottom: 2px solid #e0e0e0;
}

.ticket-nav-item {
    padding: 8px 16px;
    color: #6b7280;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
}

.ticket-nav-item:hover {
    background: rgba(46, 46, 46, 0.05);
    color: #2e2e2e;
}

.ticket-nav-item.active {
    background: #2e2e2e;
    color: white;
}

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

.modal-header {
    background: linear-gradient(135deg, #2e2e2e 0%, #1a1a1a 100%);
    border-radius: 8px 8px 0 0;
}

.modal-title {
    color: white !important;
}

.modal-header .btn-close {
    filter: invert(1) !important;
    opacity: 0.8 !important;
}

.modal-header .btn-close:hover {
    opacity: 1 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .dashboard-sections {
        grid-template-columns: 1fr;
    }
    
    .ticket-info-grid {
        grid-template-columns: 1fr;
    }
    
    .ticket-filters {
        flex-direction: column;
    }
    
    .ticket-filters select {
        max-width: 100%;
    }
    
    .ticket-main {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ticket-meta {
        flex-wrap: wrap;
    }
}