/* ========================================
   Customer Ticket Intake - Mobile-First CSS
   ======================================== */

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --success: #388e3c;
  --error: #d32f2f;
  --warning: #f57c00;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text: #333333;
  --text-light: #666666;
  --border: #dde1e6;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* --- Layout --- */
.app-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  text-align: center;
  padding: 16px 20px;
}

.app-header h1 {
  font-size: 1.25rem;
  color: var(--primary);
  font-weight: 600;
}

.app-header .header-logo {
  width: 100%;
  max-width: 220px;
  height: auto;
}

.app-header .subtitle {
  font-size: 1.5rem;
  color: var(--text);
  font-weight: 600;
  margin-top: 8px;
}

/* --- Card Container --- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}

/* --- Progress Bar --- */
.progress-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 0 20px;
}

.progress-step {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--border);
  color: var(--text-light);
  transition: all 0.3s ease;
}

.progress-step.active {
  background: var(--primary);
  color: white;
  transform: scale(1.1);
}

.progress-step.completed {
  background: var(--success);
  color: white;
}

.progress-line {
  width: 24px;
  height: 2px;
  background: var(--border);
  transition: background 0.3s ease;
}

.progress-line.completed {
  background: var(--success);
}

/* --- Step Title --- */
.step-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.step-description {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 20px;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group label .required {
  color: var(--error);
}

input[type='text'],
input[type='email'],
input[type='tel'],
textarea,
select {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

input.error,
textarea.error {
  border-color: var(--error);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 4px;
}

.field-error {
  font-size: 0.8rem;
  color: var(--error);
  margin-top: 4px;
  display: none;
}

.field-error.visible {
  display: block;
}

/* --- Customer Match Feedback --- */
.customer-match {
  display: none;
  padding: 10px 12px;
  background: #e8f5e9;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--success);
  margin-top: 8px;
}

.customer-match.visible {
  display: flex;
  align-items: center;
  gap: 8px;
}

.customer-match .match-icon {
  font-weight: bold;
  font-size: 1.1rem;
}

/* --- Device Suggestions Dropdown --- */
.suggestions-wrapper {
  position: relative;
}

.suggestions-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1.5px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.suggestions-list.visible {
  display: block;
}

.suggestion-category {
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #f8f9fa;
}

.suggestion-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
  background: #e3f2fd;
}

/* CW Automate computer items in the device dropdown */
.suggestion-category--computers {
  background: #e8f5e9;
  color: var(--success);
  border-bottom: 1px solid #c8e6c9;
}

.suggestion-item--computer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-left: 3px solid var(--success);
}

.suggestion-computer-name {
  font-size: 0.9rem;
  font-weight: 500;
}

.suggestion-computer-detail {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* --- Radio Card Groups (Q4, Q5) --- */
.radio-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-card {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.radio-card:hover {
  border-color: var(--primary);
  background: #f0f7ff;
}

.radio-card.selected {
  border-color: var(--primary);
  background: #e3f2fd;
}

.radio-card input[type='radio'] {
  display: none;
}

.radio-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  margin-right: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.radio-card.selected .radio-indicator {
  border-color: var(--primary);
  background: var(--primary);
}

.radio-card.selected .radio-indicator::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
}

.radio-label {
  font-size: 0.95rem;
}

/* --- Photo Upload Section --- */
.photo-section {
  margin-bottom: 20px;
}

.photo-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.photo-btn {
  flex: 1;
  padding: 12px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: #fafbfc;
  cursor: pointer;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-light);
  transition: all 0.2s;
  touch-action: manipulation;
}

.photo-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f0f7ff;
}

.photo-btn .icon {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.photo-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

.photo-preview {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  line-height: 1;
}

.photo-count {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* --- Camera Viewfinder (desktop) --- */
.camera-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.camera-modal.visible {
  display: flex;
}

.camera-modal video {
  max-width: 100%;
  max-height: 70vh;
  border-radius: var(--radius);
}

.camera-controls {
  margin-top: 16px;
  display: flex;
  gap: 16px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:disabled {
  background: #94b8e0;
  cursor: not-allowed;
}

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  background: #f5f7fa;
}

.btn-success {
  background: var(--success);
  color: white;
  width: 100%;
}

.btn-danger {
  background: var(--error);
  color: white;
}

/* --- Navigation Buttons --- */
.nav-buttons {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.nav-buttons .btn {
  flex: 1;
}

/* --- Phone Login Flow --- */
/* Note: Using !important and specific selectors for mobile browser compatibility */
.login-step,
#screen-gate .login-step,
#screen-gate .card .login-step {
  display: none !important;
}

.login-step.active,
#screen-gate .login-step.active,
#screen-gate .card .login-step.active {
  display: block !important;
}

.login-error {
  display: none;
  padding: 12px 16px;
  background: #fdecea;
  border: 1px solid #f5c6cb;
  border-radius: var(--radius);
  color: var(--error);
  font-size: 0.875rem;
  margin-bottom: 16px;
  text-align: center;
}

.login-error.visible {
  display: block;
}

.masked-phone {
  font-weight: 600;
  color: var(--primary);
}

/* OTP Input - Large centered digits */
#login-otp-input {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.5rem;
  padding: 16px;
}

/* Resend Code Link */
.resend-link {
  text-align: center;
  margin-top: 16px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 8px;
}

.btn-link:hover {
  color: var(--primary-dark);
}

/* Practice Selection Cards */
.practice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.practice-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  background: white;
}

.practice-card:hover {
  border-color: var(--primary);
  background: #f0f7ff;
}

.practice-card:active {
  background: #e3f2fd;
  transform: scale(0.99);
}

.practice-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.practice-card-icon-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.practice-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.practice-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.practice-card-detail {
  font-size: 0.85rem;
  color: var(--text-light);
}

.practice-card-disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.practice-card-disabled-note {
  font-size: 0.8rem;
  color: var(--error, #d32f2f);
  margin-top: 2px;
}

/* --- Welcome Banner (after login) --- */
.welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius);
  margin-bottom: 16px;
  color: white;
  box-shadow: var(--shadow);
}

.welcome-banner-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.welcome-greeting {
  font-size: 1.1rem;
  font-weight: 600;
}

.welcome-practice {
  font-size: 0.85rem;
  opacity: 0.9;
}

.welcome-practice strong {
  font-weight: 600;
}

.welcome-logout {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.welcome-logout:hover {
  background: rgba(255, 255, 255, 0.3);
}

.welcome-practices-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.welcome-practices-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* --- Loading Spinner --- */
.spinner {
  display: none;
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}

.spinner.visible {
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Loading Overlay --- */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  z-index: 50;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.loading-overlay.visible {
  display: flex;
}

.loading-overlay .spinner {
  display: block;
}

.loading-text {
  margin-top: 16px;
  font-size: 1rem;
  color: var(--text-light);
}

/* --- Success Screen --- */
.success-screen {
  text-align: center;
  padding: 40px 20px;
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.success-icon-img {
  width: 120px;
  height: auto;
  margin: 0 auto 16px;
  display: block;
  border-radius: 12px;
}

.success-screen h2 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.success-screen .ticket-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin: 12px 0;
}

.success-screen p {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* --- Error Banner --- */
.error-banner {
  display: none;
  padding: 12px 16px;
  background: #fdecea;
  border: 1px solid #f5c6cb;
  border-radius: var(--radius);
  color: var(--error);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.error-banner.visible {
  display: block;
}

/* --- Practice Banner (phone-first lookup) --- */
.practice-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #e8f5e9;
  border: 1.5px solid #a5d6a7;
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.practice-banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.practice-banner-info {
  display: flex;
  flex-direction: column;
}

.practice-banner-info strong {
  font-size: 1rem;
  color: var(--text);
}

.practice-banner-info span {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* --- Lookup Not Found State --- */
.lookup-not-found {
  display: none;
  padding: 14px 16px;
  background: #fff3e0;
  border: 1.5px solid #ffe0b2;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.lookup-not-found.visible {
  display: block;
}

.lookup-not-found p {
  font-size: 0.9rem;
  color: var(--warning);
  margin-bottom: 4px;
}

.lookup-not-found p:last-child {
  margin-bottom: 0;
}

/* --- Steps (show/hide within form screen) --- */
/* Note: Using !important for mobile browser compatibility */
.step,
#screen-form .step {
  display: none !important;
}

.step.active,
#screen-form .step.active {
  display: block !important;
}

/* --- Screens (show/hide) --- */
/* Note: Using !important for mobile browser compatibility */
.screen {
  display: none !important;
}

.screen.active {
  display: block !important;
}

/* --- Contact Cards (Step 1b: Contact Selector) --- */
.contact-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  background: white;
}

.contact-card:hover {
  border-color: var(--primary);
  background: #f0f7ff;
}

.contact-card:active {
  background: #e3f2fd;
  transform: scale(0.99);
}

.contact-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.contact-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.contact-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-card-detail {
  font-size: 0.8rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* "Someone else" card - dashed border variant */
.contact-card--other {
  border-style: dashed;
}

.contact-card--other .contact-card-avatar {
  background: var(--border);
  color: var(--text-light);
  font-size: 1.2rem;
}

.contact-card--other:hover .contact-card-avatar {
  background: var(--primary);
  color: white;
}

/* --- Ticket Cards (Open Tickets Screen) --- */
.ticket-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ticket-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  background: white;
}

.ticket-card:hover {
  border-color: var(--primary);
  background: #f0f7ff;
}

.ticket-card:active {
  background: #e3f2fd;
  transform: scale(0.99);
}

.ticket-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.ticket-card-number {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
}

.ticket-card-subject {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket-card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.ticket-card-date {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* --- Ticket Status Badges --- */
.ticket-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.ticket-badge--new {
  background: #e3f2fd;
  color: var(--primary);
}

.ticket-badge--progress {
  background: #fff3e0;
  color: var(--warning);
}

.ticket-badge--reply {
  background: #e8f5e9;
  color: var(--success);
}

.ticket-badge--scheduled {
  background: #f3e5f5;
  color: #7b1fa2;
}

.ticket-badge--default {
  background: #f5f5f5;
  color: var(--text-light);
}

.ticket-badge--priority {
  background: #f5f5f5;
  color: var(--text-light);
}

/* --- Ticket Detail View --- */
.ticket-detail-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.ticket-detail-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}

.ticket-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.ticket-detail-date {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* --- Ticket Comment Section --- */
.ticket-comment-section {
  margin-top: 16px;
}

/* --- Tickets Empty State --- */
.tickets-empty {
  text-align: center;
  padding: 40px 20px;
}

.tickets-empty p {
  color: var(--text-light);
  font-size: 0.95rem;
}

/* --- Tickets Loading State (Step 1d) --- */
.tickets-loading {
  text-align: center;
  padding: 40px 20px;
}

.tickets-loading .spinner {
  margin: 0 auto;
}

.skip-link {
  color: var(--text-light);
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
  animation-delay: 3s;
}

.skip-link:hover {
  color: var(--primary);
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* --- Existing Ticket Cards (Step 1e) --- */
.existing-tickets-count {
  text-align: right;
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 12px;
  font-weight: 500;
}

.existing-tickets-count strong {
  color: var(--primary);
}

.existing-ticket-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Scroll when more than 3 tickets */
.existing-ticket-cards.scrollable {
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Hide scrollbar on mobile/touch devices */
@media (max-width: 768px), (pointer: coarse) {
  .existing-ticket-cards.scrollable {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    padding-right: 0;
  }

  .existing-ticket-cards.scrollable::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
  }
}

.existing-ticket-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  background: white;
}

.existing-ticket-card:hover {
  border-color: var(--primary);
  background: #f0f7ff;
}

.existing-ticket-card:active {
  background: #e3f2fd;
  transform: scale(0.99);
}

.existing-ticket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.existing-ticket-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}

.existing-ticket-subject {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.existing-ticket-assigned {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 4px;
}

.existing-ticket-assigned .assigned-label {
  font-weight: 600;
  color: var(--primary);
}

.existing-ticket-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.existing-ticket-date {
  font-size: 0.75rem;
  color: var(--text-light);
}

.existing-ticket-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.btn-resolve-ticket {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1.5px solid var(--success);
  border-radius: var(--radius);
  background: white;
  color: var(--success);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-resolve-ticket:hover {
  background: var(--success);
  color: white;
}

/* --- Confirmation Modal --- */
.confirm-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.confirm-modal.visible {
  display: flex;
}

.confirm-modal-content {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.confirm-modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.confirm-modal-text {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 20px;
}

.confirm-modal-buttons {
  display: flex;
  gap: 10px;
}

.confirm-modal-buttons .btn {
  flex: 1;
}

.confirm-modal-textarea {
  margin-bottom: 16px;
}

.confirm-modal-textarea label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.confirm-modal-textarea textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  min-height: 70px;
}

.confirm-modal-textarea textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* --- Update Ticket Banner (Step 2 in update mode) --- */
.update-ticket-banner {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  text-align: center;
}

.update-ticket-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin-bottom: 4px;
}

.update-ticket-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.update-ticket-subject {
  font-size: 0.95rem;
  color: var(--text);
  margin-top: 4px;
  line-height: 1.4;
}

/* --- Session Timeout Warning Modal --- */
.timeout-warning-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.timeout-warning-modal.visible {
  display: flex;
}

.timeout-warning-content {
  background: white;
  border-radius: var(--radius);
  padding: 32px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.timeout-warning-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.timeout-warning-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--warning);
  margin-bottom: 12px;
}

.timeout-warning-text {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 24px;
  line-height: 1.5;
}

#timeout-countdown {
  font-weight: 700;
  color: var(--error);
  font-size: 1.1rem;
}

.timeout-warning-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeout-warning-buttons .btn {
  width: 100%;
}

/* --- Tablet+ --- */
@media (min-width: 768px) {
  .app-container {
    padding: 24px;
  }

  .card {
    padding: 32px;
  }

  .keypad {
    max-width: 320px;
  }

  .photo-buttons {
    max-width: 400px;
  }
}

/* --- Desktop --- */
@media (min-width: 1024px) {
  .app-container {
    padding: 32px;
    min-height: auto;
    margin-top: 20px;
    margin-bottom: 20px;
  }

  .card {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  }
}
