/* Tickets page-specific styles */

/* Tab bar */
.tab-bar { display: flex; gap: 6px; margin-bottom: 20px; background: #f3f4f6; border-radius: 10px; padding: 4px; }
.tab-bar-btn {
    padding: 10px 18px; border: 1.5px solid #d1d5db; border-radius: 8px; font-size: 13px; font-weight: 600;
    font-family: inherit; cursor: pointer; background: transparent; color: #6b7280; transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.tab-bar-btn:hover { color: #374151; }
.tab-bar-btn.active { background: #fff; color: #FF8C00; border-color: #FF8C00; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.tab-new-ticket { white-space: nowrap; background: #22c55e; color: #fff; border-color: #22c55e; margin-left: auto; }
.tab-new-ticket:hover { background: #16a34a; color: #fff; border-color: #16a34a; }

/* Filters (matching orders page) */
.history-filters {
    display: flex; gap: 8px; margin-bottom: 20px; align-items: center; flex-wrap: nowrap;
}
.hf-left {
    display: flex; align-items: center; gap: 8px;
}
.hf-left input[type="text"] {
    padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 13px; font-family: inherit; outline: none; background: #fff;
    box-sizing: border-box; height: 36px; transition: border-color 0.2s;
    width: 200px;
}
.hf-left input[type="text"]:focus {
    border-color: #FF8C00; box-shadow: 0 0 0 2px rgba(255,140,0,0.15);
}
.hf-left .btn-reset,
.hf-left .btn-filter {
    height: 36px; flex-shrink: 0; white-space: nowrap; padding: 0 14px;
}
.hf-right {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto;
}
.hf-right .date-range-sep { font-size: 12px; color: #9ca3af; flex-shrink: 0; }
.hf-right input[type="date"],
.hf-right select {
    padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 13px; font-family: inherit; outline: none; background: #fff;
    box-sizing: border-box; height: 36px; transition: border-color 0.2s;
}
.hf-right input[type="date"] { width: 130px; flex-shrink: 0; color: #374151; font-weight: 500; }
.hf-right select { width: 125px; flex-shrink: 0; }
.hf-right input:focus, .hf-right select:focus {
    border-color: #FF8C00; box-shadow: 0 0 0 2px rgba(255,140,0,0.15);
}

/* Ticket list header */
.ticket-list-header {
    display: flex;
    align-items: center;
    padding: 8px 20px;
    gap: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.tlh-id { width: 70px; flex-shrink: 0; }
.tlh-subject { flex: 2; min-width: 0; }
.tlh-order { width: 120px; flex-shrink: 0; }
.tlh-priority { width: 100px; flex-shrink: 0; }
.tlh-status { width: 110px; flex-shrink: 0; }
.tlh-updated { width: 100px; flex-shrink: 0; }
.tlh-actions { width: 100px; flex-shrink: 0; text-align: right; }

/* Ticket cards grid */
.ticket-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ticket-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    display: flex;
    align-items: center;
    padding: 14px 20px;
    gap: 20px;
    transition: box-shadow 0.2s, background 0.15s;
    cursor: pointer;
}
.ticket-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    background: #fafbfc;
}

/* Ticket card columns */
.tc-id {
    width: 70px; flex-shrink: 0;
    font-size: 13px; font-weight: 700; color: #111827;
}
.tc-id small { font-weight: 400; color: #9ca3af; font-size: 11px; }
.tc-subject {
    flex: 2; min-width: 0;
    font-size: 13px; font-weight: 600; color: #374151;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tc-order {
    width: 120px; flex-shrink: 0;
    font-size: 13px; color: #6b7280;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tc-priority {
    width: 100px; flex-shrink: 0;
}
.tc-status {
    width: 110px; flex-shrink: 0;
}
.tc-updated {
    width: 100px; flex-shrink: 0;
    font-size: 13px; color: #6b7280;
}
.tc-actions {
    width: 100px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: flex-end; gap: 6px;
}
.tc-actions .btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 8px;
    border: 1px solid #e5e7eb; background: #f9fafb; color: #6b7280;
    cursor: pointer; transition: all 0.15s;
}
.tc-actions .btn-icon:hover { background: #f3f4f6; color: #374151; border-color: #d1d5db; }
.tc-actions .btn-icon--danger:hover { background: #fef2f2; color: #ef4444; border-color: #fecaca; }

/* Badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fef2f2; color: #dc2626; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-orange { background: #FFF7ED; color: #FF8C00; }

/* Stat cards — styles moved to common.css */
.stat-card .value {
    font-size: 28px;
    font-weight: 700;
    margin-top: 4px;
}

/* Ticket detail modal */
.ticket-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    display: none; align-items: center; justify-content: center; z-index: 200;
}
.ticket-modal-overlay.open { display: flex !important; }
.ticket-modal {
    background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 100%; max-width: 800px; max-height: 90vh; overflow-y: auto; padding: 32px;
}
.ticket-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.ticket-modal-header h2 { margin: 0; }
.ticket-modal-header-actions { display: flex; align-items: center; gap: 8px; }
.btn-delete-ticket { background: none; border: 1px solid #fca5a5; border-radius: 6px; color: #ef4444; cursor: pointer; padding: 5px 8px; display: flex; align-items: center; transition: background .15s, color .15s; }
.btn-delete-ticket:hover { background: #fef2f2; color: #dc2626; }
.ticket-modal-close { background: none; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 18px; cursor: pointer; padding: 4px 10px; }
.ticket-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; font-size: 14px; }
.ticket-meta-grid strong { color: #374151; }
.ticket-messages-box { border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; margin-bottom: 16px; max-height: 350px; overflow-y: auto; background: #f9fafb; }
.ticket-msg { padding: 12px; border-radius: 8px; margin-bottom: 8px; }
.ticket-msg-client { background: #eff6ff; border-left: 3px solid #3b82f6; }
.ticket-msg-admin { background: #f0fdf4; border-left: 3px solid #22c55e; }
.ticket-msg-header { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 12px; color: #6b7280; }
.ticket-msg-text { font-size: 14px; color: #1a1a1a; white-space: pre-wrap; word-break: break-word; }
.ticket-messages-empty { text-align: center; color: #9ca3af; padding: 20px; }
.ticket-reply-textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 8px;
    font-size: 13px; color: #6b7280; font-family: inherit; resize: vertical; margin-bottom: 8px; outline: none;
}
.ticket-reply-textarea:focus { border-color: #FF8C00; box-shadow: 0 0 0 3px rgba(255,140,0,0.15); }
.ticket-reply-footer { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.ticket-status-info { font-size: 13px; color: #6b7280; padding: 12px 0; text-align: center; }
.ticket-priority-label { font-weight: 600; }
.ticket-priority-label[data-priority="low"] { color: #6b7280; }
.ticket-priority-label[data-priority="medium"] { color: #3b82f6; }
.ticket-priority-label[data-priority="high"] { color: #f59e0b; }
.ticket-priority-label[data-priority="urgent"] { color: #dc2626; }

/* Create ticket modal */
.modal-header {
    padding: 20px 24px; border-bottom: 1px solid #f3f4f6;
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 700; color: #111827; margin: 0; }
.modal-close {
    background: none; border: 1px solid #e5e7eb; border-radius: 8px;
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #9ca3af; cursor: pointer; transition: all 0.15s;
}
.modal-close:hover { color: #374151; background: #f9fafb; border-color: #d1d5db; }
.modal-body { padding: 24px; }
.modal-body .form-group { margin-bottom: 16px; }
.modal-body .form-group label { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; display: block; }
.modal-body .form-group input,
.modal-body .form-group textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 13px; color: #374151; font-family: inherit; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s; box-sizing: border-box;
}
.modal-body .form-group input:focus,
.modal-body .form-group textarea:focus {
    border-color: #FF8C00; box-shadow: 0 0 0 3px rgba(255,140,0,0.1);
}
.modal-body .form-group textarea { resize: vertical; min-height: 100px; }
.modal-footer {
    padding: 16px 24px; border-top: 1px solid #f3f4f6;
    display: flex; justify-content: flex-end; gap: 10px;
}
.btn-modal {
    display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px;
    border-radius: 8px; font-size: 13px; font-weight: 600; font-family: inherit;
    cursor: pointer; border: 1px solid #d1d5db; background: #fff; color: #374151;
    transition: all 0.15s;
}
.btn-modal:hover { background: #f9fafb; border-color: #9ca3af; }

/* Ticket create modal: selects row */
.ticket-selects-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    margin-bottom: 16px;
}
.ticket-selects-row select {
    padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 13px; font-family: inherit; outline: none; background: #fff;
    box-sizing: border-box; width: 100%; color: #374151;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.ticket-selects-row select:focus {
    border-color: #FF8C00; box-shadow: 0 0 0 3px rgba(255,140,0,0.1);
}
