/* CR-DevControl – app.css Part 2: Ticket detail, Upload, Timeline, Users, Responsive */

/* ── FORM PAGE LAYOUT ── */
.form-page { max-width: 1100px; }
.form-page-sm { max-width: 780px; margin: 0 auto; }
.form-page-header { margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.form-col-main { display: flex; flex-direction: column; gap: 0; }
.form-col-side { display: flex; flex-direction: column; gap: 0; }
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .85rem; }
.summary-row:last-child { border-bottom: none; }
.summary-label { color: var(--text3); font-size: .78rem; }

/* ── DROPZONE ── */
.dropzone { border: 2px dashed var(--border2); border-radius: var(--radius); padding: 32px 20px; text-align: center; cursor: pointer; transition: all var(--transition); position: relative; }
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: var(--primary-light); }
.dropzone-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dropzone-icon { font-size: 36px; color: var(--text3); display: block; margin-bottom: 8px; }
.dropzone p { font-size: .875rem; color: var(--text2); }
.dropzone-hint { font-size: .75rem; color: var(--text3); }
.preview-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.preview-item { position: relative; width: 90px; height: 90px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-remove { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.preview-name { display: none; }

/* ── TICKET DETAIL ── */
.ticket-detail { max-width: 1100px; }
.ticket-detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.ticket-detail-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ticket-detail-actions { display: flex; gap: 8px; }
.ticket-number-lg { font-family: 'Courier New', monospace; font-size: .9rem; background: var(--bg2); padding: 4px 10px; border-radius: 6px; font-weight: 700; color: var(--text2); }
.ticket-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.ticket-main { display: flex; flex-direction: column; }
.ticket-side { display: flex; flex-direction: column; }
.ticket-title-lg { font-size: 1.25rem; font-weight: 700; margin-bottom: 10px; line-height: 1.3; }
.ticket-url { font-size: .8rem; color: var(--primary); margin-bottom: 16px; display: flex; align-items: center; gap: 6px; }
.ticket-section { margin-top: 20px; }
.ticket-section h4 { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text3); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.ticket-text { font-size: .875rem; color: var(--text2); line-height: 1.7; white-space: pre-wrap; }
.ticket-solution { background: #F0FDF4; border-radius: var(--radius-sm); padding: 16px; border: 1px solid #A7F3D0; }
.ticket-solution h4 { color: var(--success); }
.card-validation { border-color: #FDE68A; background: #FFFBEB; }
.validation-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }

/* ── COMMENTS ── */
.comments-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.comment { display: flex; gap: 12px; }
.comment-internal { background: #FFFBEB; border-radius: var(--radius-sm); padding: 12px; border: 1px solid #FDE68A; }
.comment-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.comment-body { flex: 1; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.comment-header strong { font-size: .875rem; }
.comment-role { font-size: .72rem; background: var(--bg2); color: var(--text3); padding: 1px 6px; border-radius: 10px; }
.comment-time { font-size: .72rem; color: var(--text3); margin-left: auto; }
.comment-text { font-size: .875rem; color: var(--text2); line-height: 1.6; }
.comment-form { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 20px; }

/* ── DETAIL ROWS ── */
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .85rem; gap: 8px; }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text3); font-size: .78rem; font-weight: 600; flex-shrink: 0; }

/* ── TIMELINE ── */
.timeline { padding: 16px 20px; display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 14px; padding-bottom: 20px; position: relative; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:not(:last-child)::before { content: ''; position: absolute; left: 5px; top: 16px; bottom: 0; width: 2px; background: var(--border); }
.timeline-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 3px; position: relative; z-index: 1; }
.timeline-content { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.timeline-content strong { font-size: .8rem; color: var(--text); }
.timeline-change { font-size: .78rem; color: var(--text2); }
.timeline-change s { color: var(--text3); text-decoration: line-through; }
.timeline-comment { font-size: .75rem; color: var(--text3); font-style: italic; }
.timeline-meta { font-size: .72rem; color: var(--text3); }

/* ── ATTACHMENTS ── */
.attachments-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.attachment-thumb { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 110px; }
.attachment-thumb img { width: 110px; height: 80px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); transition: opacity var(--transition); }
.attachment-thumb:hover img { opacity: .85; }
.attachment-name { font-size: .7rem; color: var(--text3); text-align: center; word-break: break-all; }

/* ── USER TABLE ── */
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell-name { font-weight: 600; font-size: .875rem; }
.user-cell-email { font-size: .78rem; color: var(--text3); }
.role-badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.role-admin     { background: #FEF3C7; color: #92400E; }
.role-developer { background: #EDE9FE; color: #5B21B6; }
.role-client    { background: #DBEAFE; color: #1E40AF; }
.status-dot { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 500; }
.status-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-active::before   { background: var(--success); }
.dot-inactive::before { background: var(--text3); }

/* ── PROFILE ── */
.profile-header { display: flex; align-items: center; gap: 14px; }
.profile-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; }

/* ── CONFIRM MODALS via CSS ── */
.confirm-form button { cursor: pointer; }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(4,1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .bottom-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-md); }
  .sidebar-overlay.open { display: block; }
  .sidebar-toggle { display: flex; }
  .menu-toggle { display: flex; }
  .main-wrapper { margin-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .ticket-layout { grid-template-columns: 1fr; }
  .validation-actions { grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .auth-right { padding: 24px; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .form-row-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .filter-row { flex-direction: column; align-items: stretch; }
  .filter-search { min-width: auto; }
  .main-content { padding: 16px; }
  .ticket-detail-header { flex-direction: column; align-items: flex-start; }
}
