/* ===== TICKETS PAGE - Stili specifici ===== */
/* Dark theme coerente con styles.css */

/* Textarea globale per questa pagina */
.main-content textarea {
    width: 100%;
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: 10px;
    color: #fff;
    padding: 0.8rem 1rem;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.2s ease;
}
.main-content textarea:focus {
    outline: none;
    border-color: #FFC107;
}
.main-content textarea::placeholder { color: #555; }

/* ===== LISTA TICKET ===== */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.ticket-row {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem 1.5rem;
    align-items: start;
}
.ticket-row:hover {
    background: rgba(255, 193, 7, 0.04);
    border-color: rgba(255, 193, 7, 0.2);
}

.ticket-row-left { min-width: 0; }
.ticket-row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.4rem; flex-shrink: 0; }

.ticket-row-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.4rem; }

.ticket-contratto {
    font-size: 0.78rem;
    color: #888;
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ticket-descrizione {
    font-size: 0.85rem;
    color: #ccc;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.ticket-data { font-size: 0.72rem; color: #666; white-space: nowrap; }

/* ===== BADGE ===== */
.tk-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Categoria */
.tk-badge-categoria-consegna   { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.tk-badge-categoria-documenti  { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.tk-badge-categoria-pagamento  { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.tk-badge-categoria-contratto  { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; }
.tk-badge-categoria-tecnico    { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.tk-badge-categoria-altro      { background: rgba(156, 163, 175, 0.15); color: #9ca3af; }

/* Priorità */
.tk-badge-prio-urgente { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.tk-badge-prio-alta    { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.tk-badge-prio-media   { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.tk-badge-prio-bassa   { background: rgba(156, 163, 175, 0.12); color: #9ca3af; }

/* Stato */
.tk-badge-stato-aperto            { background: rgba(156, 163, 175, 0.15); color: #9ca3af; }
.tk-badge-stato-in_lavorazione_hos { background: rgba(138, 43, 226, 0.2); color: #a78bfa; }
.tk-badge-stato-in_lavorazione_cs  { background: rgba(245, 158, 11, 0.2); color: #fb923c; }
.tk-badge-stato-risolto            { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.tk-badge-stato-chiuso             { background: rgba(75, 85, 99, 0.3); color: #6b7280; }

/* ===== MODALE NUOVO TICKET ===== */
.tk-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.tk-modal {
    background: #141414;
    border: 1px solid rgba(255, 193, 7, 0.25);
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.tk-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 193, 7, 0.15);
    flex-shrink: 0;
}
.tk-modal-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #FFC107, #FFD54F);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.tk-modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.2s;
    flex-shrink: 0;
}
.tk-modal-close:hover { color: #fff; }
.tk-modal-body { padding: 1.5rem; }

/* ===== DROPZONE ===== */
.tk-dropzone {
    border: 2px dashed rgba(255, 193, 7, 0.25);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 193, 7, 0.02);
}
.tk-dropzone:hover, .tk-dropzone.dragover {
    border-color: #FFC107;
    background: rgba(255, 193, 7, 0.06);
}
.tk-dropzone-icon { font-size: 2rem; margin-bottom: 0.4rem; }
.tk-dropzone-text { font-size: 0.82rem; color: #888; }

.tk-file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.7rem;
}
.tk-file-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    color: #ccc;
    position: relative;
    max-width: 200px;
}
.tk-file-item img {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.tk-file-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.tk-file-remove {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}
.tk-file-remove:hover { color: #fca5a5; }

/* ===== DRAWER DETTAGLIO ===== */
.tk-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
}
.tk-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 480px;
    max-width: 100vw;
    background: #111;
    border-left: 1px solid rgba(255, 193, 7, 0.2);
    z-index: 1600;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.5);
}
.tk-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    gap: 1rem;
}
.tk-drawer-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    word-break: break-word;
}
.tk-drawer-meta { margin-top: 0.4rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tk-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.tk-drawer-info {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    font-size: 0.8rem;
    color: #aaa;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.4rem 1rem;
}
.tk-drawer-info-label { color: #666; }
.tk-drawer-info-value { color: #ccc; }

/* Thread messaggi */
.tk-thread-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #555;
    padding: 0 0 0.3rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.tk-thread {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    flex: 1;
    min-height: 80px;
}

.tk-msg {
    max-width: 88%;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    font-size: 0.83rem;
    line-height: 1.5;
}
.tk-msg-me {
    align-self: flex-end;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.2);
}
.tk-msg-hos {
    align-self: flex-start;
    background: rgba(138, 43, 226, 0.1);
    border: 1px solid rgba(138, 43, 226, 0.2);
}
.tk-msg-cs {
    align-self: flex-start;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.tk-msg-name {
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #aaa;
}
.tk-msg-hos .tk-msg-name { color: #a78bfa; }
.tk-msg-cs .tk-msg-name  { color: #fb923c; }
.tk-msg-me .tk-msg-name  { color: #60a5fa; }
.tk-msg-text { color: #ddd; word-break: break-word; }
.tk-msg-time { font-size: 0.68rem; color: #555; margin-top: 0.3rem; text-align: right; }
.tk-msg-allegati {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.tk-msg-allegati a {
    color: #60a5fa;
    text-decoration: none;
    font-size: 0.75rem;
}
.tk-msg-allegati a:hover { text-decoration: underline; }
.tk-msg-allegati img {
    max-width: 160px;
    max-height: 120px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    display: block;
}

/* Composer */
.tk-composer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.8rem 1.2rem 1rem;
    flex-shrink: 0;
}
.tk-composer-row {
    display: flex;
    gap: 0.6rem;
    align-items: flex-end;
}
.tk-composer-row textarea {
    flex: 1;
    min-height: 60px;
    max-height: 150px;
    resize: vertical;
    border-radius: 10px;
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid rgba(255, 193, 7, 0.2);
    color: #fff;
    padding: 0.6rem 0.8rem;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
}
.tk-composer-row textarea:focus {
    outline: none;
    border-color: #FFC107;
}
.tk-composer-row textarea::placeholder { color: #555; }
.tk-composer-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.tk-attach-btn {
    background: rgba(255, 193, 7, 0.08);
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: 8px;
    color: #FFC107;
    padding: 0.5rem 0.6rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}
.tk-attach-btn:hover { background: rgba(255, 193, 7, 0.18); }
.tk-send-btn { padding: 0.5rem 1rem; font-size: 0.82rem; }

/* Chiuso — composer disabilitato */
.tk-composer.disabled textarea { opacity: 0.4; pointer-events: none; }
.tk-composer.disabled .tk-send-btn,
.tk-composer.disabled .tk-attach-btn { opacity: 0.4; pointer-events: none; }
.tk-composer-closed-msg {
    font-size: 0.78rem;
    color: #666;
    text-align: center;
    padding: 0.5rem 0;
    font-style: italic;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .tk-drawer { width: 100vw; }
    .ticket-row { grid-template-columns: 1fr; }
    .ticket-row-right { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
}
