/* ========================================
   ENHANCED TICKETS UI - List + shared
   ======================================== */

/* SIM disconnected warning pill */
.sim-warn-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.18);
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-radius: 999px;
    line-height: 1.2;
    vertical-align: middle;
    white-space: nowrap;
}
.sim-warn-pill i {
    font-size: 0.85rem;
}

/* === LIST CONTAINER === */
.tickets-container {
    background: var(--bg-secondary, #1e293b);
    border-radius: 14px;
    border: 1px solid var(--border-primary, rgba(148, 163, 184, 0.2));
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: none;
    overflow: visible;
}

.tickets-header {
    background: var(--bg-tertiary, #0f172a);
    border-bottom: 1px solid var(--border-primary, rgba(148, 163, 184, 0.2));
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.tickets-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

.tickets-header-title i {
    color: #10b981;
    font-size: 1.3rem;
}

.tickets-header-title .total-badge {
    background: rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 4px;
}

.tickets-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-add-ticket {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    color: #fff;
}

.btn-add-ticket:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    color: #fff;
}

.btn-export-tickets {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    color: #fff;
}

.btn-export-tickets:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    color: #fff;
}

.tickets-body {
    padding: 16px 20px 20px;
}

/* === TOOLBAR === */
.tickets-search-row {
    margin-bottom: 12px;
}

.tickets-search-wrap {
    position: relative;
    width: 100%;
}

.tickets-search-wrap i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(110, 231, 183, 0.9);
    pointer-events: none;
    z-index: 2;
}

.tickets-search-input {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border-radius: 14px;
    border: 1px solid rgba(16, 185, 129, 0.35);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(15, 23, 42, 0.95) 100%);
    color: #fff;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.tickets-search-input:focus {
    outline: none;
    border-color: rgba(16, 185, 129, 0.65);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.tickets-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.tickets-status-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tickets-status-chip {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(30, 41, 59, 0.65);
    color: #cbd5e1;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tickets-status-chip:hover {
    border-color: rgba(16, 185, 129, 0.45);
    color: #e2e8f0;
}

.tickets-status-chip.active {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.55);
    color: #6ee7b7;
}

.tickets-status-chip[data-status="nou"].active {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
    color: #93c5fd;
}

.tickets-status-chip[data-status="inlucru"].active {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.5);
    color: #fcd34d;
}

.tickets-status-chip[data-status="asteptare"].active {
    background: rgba(14, 165, 233, 0.2);
    border-color: rgba(14, 165, 233, 0.5);
    color: #7dd3fc;
}

.tickets-status-chip[data-status="finalizat"].active {
    background: rgba(16, 185, 129, 0.22);
    border-color: rgba(16, 185, 129, 0.55);
    color: #6ee7b7;
}

.tickets-toolbar-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.tickets-filter-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.tickets-filter-switch .form-check-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    margin-left: 4px;
}

.tickets-pagesize-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.22);
    border-radius: 10px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.tickets-pagesize-wrap select {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 6px;
    color: #6ee7b7;
    font-weight: 600;
    padding: 4px 8px;
    font-size: 0.85rem;
}

/* === CARDS GRID === */
.tickets-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

@media (min-width: 1600px) {
    .tickets-cards-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (min-width: 1300px) and (max-width: 1599px) {
    .tickets-cards-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 1024px) and (max-width: 1299px) {
    .tickets-cards-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* === CARD REDESIGN === */
.tickets-cards-grid .ticket-card {
    background: linear-gradient(160deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    border-left: 3px solid rgba(16, 185, 129, 0.55);
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.tickets-cards-grid .ticket-card:hover {
    border-color: rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.tickets-cards-grid .ticket-card.ticket-urgent {
    border-left-color: #f87171;
    border-color: rgba(248, 113, 113, 0.35);
    background: linear-gradient(160deg, rgba(239, 68, 68, 0.12), rgba(15, 23, 42, 0.98));
}

.tickets-cards-grid .ticket-card.ticket-waiting {
    border-left-color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.35);
    background: linear-gradient(160deg, rgba(14, 165, 233, 0.1), rgba(15, 23, 42, 0.98));
}

.tickets-cards-grid .ticket-card.ticket-busy {
    border-left-color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.35);
    background: linear-gradient(160deg, rgba(251, 191, 36, 0.08), rgba(15, 23, 42, 0.98));
}

.tickets-cards-grid .ticket-card::before {
    display: none;
}

.ticket-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.ticket-number-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.02em;
}

.ticket-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}

.ticket-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1.3;
}

.ticket-badge i {
    font-size: 0.8rem;
}

.badge-status.badge-nou {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.35);
}

.badge-status.badge-in-lucru {
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.35);
}

.badge-status.badge-asteptare {
    color: #7dd3fc;
    background: rgba(14, 165, 233, 0.15);
    border-color: rgba(14, 165, 233, 0.35);
}

.badge-status.badge-finalizat {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.35);
}

.badge-days {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.25);
}

.badge-urgent {
    color: #fecaca;
    background: rgba(248, 113, 113, 0.18);
    border-color: rgba(248, 113, 113, 0.4);
}

.badge-lock {
    color: #fde68a;
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.35);
}

.ticket-card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.ticket-card-client {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ticket-card-amef {
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.35;
}

.ticket-card-amef strong {
    color: #e2e8f0;
    font-weight: 600;
}

.ticket-card-motiv {
    font-size: 0.8rem;
    color: #cbd5e1;
    line-height: 1.35;
}

.ticket-card-motiv small {
    display: block;
    color: #94a3b8;
    margin-top: 2px;
}

.ticket-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    font-size: 0.72rem;
    color: #94a3b8;
}

.ticket-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ticket-card-meta i {
    font-size: 0.85rem;
    opacity: 0.85;
}

.ticket-card-footer {
    display: flex;
    gap: 8px;
    padding: 10px 12px 12px;
}

.ticket-card-footer .btn {
    flex: 1;
    font-size: 0.78rem !important;
    font-weight: 600;
    padding: 7px 10px !important;
    border-radius: 8px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.tickets-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
}

.tickets-empty-state i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* === LIST VIEW === */
.tickets-list-filters .form-select,
.tickets-list-filters .form-control {
    background: #1a1d2e;
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #fff;
}

.tickets-list-filters .form-select option {
    background: #1a1d2e;
    color: #fff;
}

.tickets-list-filters .form-select:focus,
.tickets-list-filters .form-control:focus {
    background: #242736;
    border-color: rgba(16, 185, 129, 0.6);
    color: #fff;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

#ticketsTable {
    font-size: 0.85rem;
    --bs-table-bg: transparent;
}

#ticketsTable thead th {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 10px 8px;
}

#ticketsTable tbody tr {
    transition: background 0.15s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
}

#ticketsTable tbody tr:hover {
    background: rgba(16, 185, 129, 0.08);
}

#ticketsTable tbody td {
    vertical-align: middle;
    border-color: rgba(255, 255, 255, 0.06);
    padding: 8px;
    color: #e2e8f0;
}

#ticketsTable tbody tr.row-urgent {
    border-left-color: #f87171;
    background: rgba(248, 113, 113, 0.06);
}

#ticketsTable tbody tr.row-busy {
    border-left-color: #fbbf24;
}

#ticketsTable tbody tr .ticket-actions {
    cursor: default;
}

#ticketsTable .ticket-id-cell {
    font-weight: 700;
    color: #94a3b8;
}

#ticketsTable .days-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
}

#ticketsTable .days-pill.is-urgent {
    background: rgba(248, 113, 113, 0.2);
    color: #fecaca;
}

/* Pagination */
.tickets-pagination-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.tickets-pagination-info {
    color: #94a3b8;
    font-size: 0.85rem;
}

.pagination-advanced {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    margin-top: 12px;
}

.pagination-info {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.pagination-jump {
    background: rgba(16, 185, 129, 0.08);
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.pagination-jump span {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

#pageNumberInput,
.page-input {
    width: 60px;
    padding: 2px 8px;
    text-align: center;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 6px;
    color: #6ee7b7;
    font-size: 0.85rem;
    font-weight: 600;
}

#pageNumberInput:focus,
.page-input:focus {
    outline: none;
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Quick view */
.quick-view-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.quick-view-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.quick-view-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #10b981;
    margin-bottom: 0.5rem;
}

.quick-view-value {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    color: #e2e8f0;
}

#ticketQuickViewModal .modal-content {
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #e2e8f0;
}

#ticketQuickViewModal .modal-header,
#ticketQuickViewModal .modal-footer {
    border-color: rgba(148, 163, 184, 0.2);
    background: rgba(30, 41, 59, 0.6);
}

/* === INFO PAGE leftovers (shared) === */
.ticket-profile-panel,
aside.ticket-profile-panel {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-primary) !important;
    border-radius: var(--radius-lg) !important;
}

.ticket-profile-head {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary)) !important;
    border-bottom: 1px solid var(--border-primary) !important;
}

.ticket-hero-card,
.ticket-details-feature,
.ticket-details-panel {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-primary) !important;
}

.obs-card {
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-primary) !important;
    border-radius: var(--radius-md) !important;
}

.obs-card-header {
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-primary) !important;
}

.obs-item {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-primary) !important;
    border-radius: var(--radius-md) !important;
}

.ticket-document-row,
.documents-list-item {
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-primary) !important;
    border-radius: var(--radius-md) !important;
}

/* === MOBILE === */
@media (max-width: 768px) {
    .tickets-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
        margin: 0 -0.35rem;
        box-shadow: none;
    }

    .tickets-header {
        padding: 16px 14px;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .tickets-header-title {
        font-size: 1.2rem;
        justify-content: center;
    }

    .tickets-header-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .tickets-header-actions .btn {
        font-size: 0.95rem !important;
        padding: 12px 10px !important;
        border-radius: 12px !important;
        font-weight: 600 !important;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .tickets-body {
        padding: 12px 8px;
    }

    .tickets-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .tickets-status-chips {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .tickets-status-chip {
        flex: 0 0 auto;
        font-size: 0.85rem;
        padding: 8px 14px;
    }

    .tickets-toolbar-right {
        flex-direction: column;
        width: 100%;
    }

    .tickets-filter-switch,
    .tickets-pagesize-wrap {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 1rem;
    }

    .tickets-search-input {
        min-height: 52px;
        font-size: 1.05rem;
        padding: 14px 14px 14px 48px;
    }

    .tickets-cards-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .ticket-card-footer .btn {
        min-height: 42px;
        font-size: 0.9rem !important;
    }

    .pagination-advanced {
        flex-direction: column;
        gap: 1rem;
    }

    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination-jump {
        order: -1;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 992px) {
    .tickets-cards-grid {
        grid-template-columns: 1fr;
    }
}
