/**
 * DuaForma Support Hub Stylesheet
 * Neo-Brutalist responsive layout, 3D tilts, neon glow borders, led lights, and radar animations.
 */

:root {
  --ink: #0e0d0b;
  --paper: #faf9f6;
  --rust: #c45c2a;
  --white: #ffffff;
  --shadow: 5px 5px 0 var(--ink);
  --border-thick: 2px dashed var(--ink);
  --border-solid: 2px solid var(--ink);
}

.df-support-portal-wrapper {
  max-width: 900px;
  margin: 2rem auto;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 8px 8px 0 var(--ink);
  overflow: hidden;
  font-family: 'Archivo', sans-serif;
  color: var(--ink);
  box-sizing: border-box;
}

/* ── HEADER ── */
.df-portal-header {
  background: var(--ink);
  color: var(--paper);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--ink);
  flex-wrap: wrap;
  gap: 15px;
}
.df-portal-title-area {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.df-portal-title {
  margin: 0;
  font-family: 'Space Mono', monospace;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 900;
}
.df-portal-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  text-transform: uppercase;
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  opacity: 0.85;
}

/* Tabs */
.df-portal-tabs {
  display: flex;
  gap: 10px;
}
.df-tab-btn {
  background: transparent;
  color: var(--paper);
  border: 2px solid var(--paper);
  border-radius: 6px;
  padding: 8px 16px;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}
.df-tab-btn:hover {
  background: rgba(250, 249, 246, 0.15);
}
.df-tab-btn.active {
  background: var(--rust);
  color: var(--paper);
  border-color: var(--rust);
  box-shadow: 2px 2px 0 var(--paper);
  transform: translate(-1px, -1px);
}

/* State LEDs */
.df-led-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px currentColor;
}
.df-led-dot.state-ready {
  background: #39ff14;
  color: #39ff14;
  animation: ledPulse 1.5s infinite alternate;
}
.df-led-dot.state-busy {
  background: #ffcc00;
  color: #ffcc00;
  animation: ledPulse 0.8s infinite alternate;
}
.df-led-dot.state-error {
  background: #ff073a;
  color: #ff073a;
  animation: ledPulse 0.5s infinite alternate;
}

@keyframes ledPulse {
  0% { opacity: 0.4; }
  100% { opacity: 1; box-shadow: 0 0 12px currentColor; }
}

.df-portal-step {
  padding: 2.5rem 2rem;
}
.df-step-instruction {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 2rem;
  font-family: 'Archivo', sans-serif;
}

/* ── GRID PROGETTI ── */
.df-project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}
.df-project-card {
  --accent-color: var(--rust);
  --accent-rgb: 196,92,42;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 1.8rem;
  text-align: left;
  cursor: pointer;
  position: relative;
  box-shadow: 4px 4px 0 var(--ink);
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  outline: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 180px;
}
.df-project-card:hover {
  transform: perspective(800px) rotateX(3deg) rotateY(-3deg) translateZ(5px) translate(-4px, -4px);
  box-shadow: 6px 6px 0 var(--ink), 0 15px 30px rgba(var(--accent-rgb), 0.25);
  border-color: var(--accent-color);
}
.df-project-badge {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
  align-self: flex-start;
  font-family: 'Space Mono', monospace;
}
.df-project-num {
  position: absolute;
  top: 1.2rem;
  right: 1.5rem;
  font-family: 'Space Mono', monospace;
  font-weight: 900;
  font-size: 20px;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--ink);
  opacity: 0.3;
  transition: opacity 0.3s;
}
.df-project-card:hover .df-project-num {
  opacity: 1;
  color: var(--accent-color);
  -webkit-text-stroke-color: var(--accent-color);
}
.df-project-name {
  font-size: 1.5rem;
  font-weight: 900;
  margin: 1.5rem 0 0.2rem 0;
  transition: color 0.3s;
}
.df-project-card:hover .df-project-name {
  color: var(--accent-color);
}
.df-project-desc {
  font-size: 12px;
  color: #555;
  margin: 0;
}

/* ── CHAT CONSOLE ── */
.df-chat-selected-project {
  background: var(--ink);
  color: var(--paper);
  padding: 10px 15px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-family: 'Space Mono', monospace;
  margin-bottom: 1.5rem;
}
.df-chat-selected-project strong {
  text-transform: uppercase;
  color: var(--rust);
}
.df-link-action {
  background: none;
  border: none;
  color: #ff9aa8;
  cursor: pointer;
  text-decoration: underline;
  font-weight: bold;
  padding: 0;
  font-family: inherit;
}
.df-link-action:hover {
  color: var(--white);
}

.df-chat-log {
  border: 2px solid var(--ink);
  background: var(--white);
  border-radius: 8px;
  padding: 1.5rem;
  height: 320px;
  overflow-y: auto;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 15px;
  box-shadow: inset 2px 2px 5px rgba(0,0,0,0.05);
}

.df-chat-message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: messageFadeIn 0.3s ease forwards;
}
.df-chat-message.message-ai {
  align-self: flex-start;
}
.df-chat-message.message-user {
  align-self: flex-end;
}
.df-message-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid var(--ink);
  font-size: 14px;
  line-height: 1.5;
}
.df-chat-message.message-ai .df-message-bubble {
  background: #f1ebd9;
  border-bottom-left-radius: 2px;
  box-shadow: 3px 3px 0 var(--ink);
}
.df-chat-message.message-user .df-message-bubble {
  background: var(--ink);
  color: var(--paper);
  border-bottom-right-radius: 2px;
  box-shadow: -3px 3px 0 var(--ink);
}
.df-message-bubble p {
  margin: 0 0 10px 0;
}
.df-message-bubble p:last-child {
  margin-bottom: 0;
}

@keyframes messageFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── RADAR SCANNER ANIMATION ── */
.df-radar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 2rem;
  background: #fbfbfb;
  border: 2px dashed var(--ink);
  border-radius: 8px;
  margin-bottom: 1.5rem;
}
.df-radar-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  position: relative;
  background: #000;
  overflow: hidden;
}
.df-radar-sweep {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0; left: 0;
  background: conic-gradient(from 0deg, rgba(196,92,42, 0.15) 0deg, rgba(196,92,42, 0) 270deg, rgba(196,92,42, 0.8) 360deg);
  border-radius: 50%;
  animation: radarRotate 2.2s linear infinite;
}
.df-radar-dot {
  width: 6px;
  height: 6px;
  background: #39ff14;
  border-radius: 50%;
  position: absolute;
  top: 40%; left: 35%;
  box-shadow: 0 0 8px #39ff14;
  animation: dotFlash 0.6s infinite alternate;
}
.df-radar-text {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@keyframes radarRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes dotFlash {
  0% { opacity: 0.2; }
  100% { opacity: 1; }
}

/* ── INPUT AREA & BUTTONS ── */
.df-chat-input-area {
  display: flex;
  gap: 12px;
}
.df-chat-input-area textarea {
  flex-grow: 1;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  background: var(--white);
  outline: none;
  transition: box-shadow 0.2s;
}
.df-chat-input-area textarea:focus {
  box-shadow: 3px 3px 0 var(--ink);
}

.df-btn-brutal {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 24px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.df-btn-brutal:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink);
  background: var(--ink);
  color: var(--paper);
}
.df-btn-brutal:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

/* Special Button variations */
.success-btn {
  background: #ecf7ed;
  color: #1e7e34;
  border-color: #1e7e34;
}
.success-btn:hover {
  background: #1e7e34;
  color: var(--white);
}
.error-btn {
  background: #fbe3db;
  color: #d54e21;
  border-color: #d54e21;
}
.error-btn:hover {
  background: #d54e21;
  color: var(--white);
}

/* ── FEEDBACK AREA ── */
.df-feedback-section {
  background: #faf9f6;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
  box-shadow: 4px 4px 0 var(--ink);
  animation: messageFadeIn 0.4s ease forwards;
}
.df-feedback-question {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 1rem 0;
}
.df-feedback-actions {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

/* ── ESCALATION FORM ── */
.df-escalation-form {
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 4px 4px 0 var(--ink);
  margin-bottom: 1.5rem;
  animation: messageFadeIn 0.4s ease forwards;
}
.df-escalation-notice {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 1rem 0;
  color: #d54e21;
}
.df-input-group {
  display: flex;
  gap: 10px;
}
.df-input-group input[type="email"] {
  flex-grow: 1;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 10px 15px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.df-input-group input[type="email"]:focus {
  box-shadow: 3px 3px 0 var(--ink);
}

/* ── SUCCESS SCREEN ── */
.df-success-screen {
  text-align: center;
  padding: 2.5rem;
  background: #ecf7ed;
  border: 2px solid #1e7e34;
  border-radius: 12px;
  box-shadow: 4px 4px 0 #1e7e34;
  animation: messageFadeIn 0.4s ease forwards;
}
.df-success-icon {
  font-size: 40px;
  color: #1e7e34;
  margin-bottom: 1rem;
}
.df-success-title {
  font-size: 1.5rem;
  font-weight: 900;
  margin: 0 0 0.5rem 0;
  color: #1e7e34;
}
#df-success-message {
  font-size: 14px;
  margin: 0 0 1.5rem 0;
  color: #155724;
}

/* ── CHECK STATUS PANEL ── */
.df-check-search-panel {
  background: var(--white);
  border: 2px solid var(--ink);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.df-form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.df-form-label {
  font-size: 13px;
  font-weight: 700;
  font-family: 'Space Mono', monospace;
}
.df-input-field {
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  background: var(--white);
  outline: none;
  transition: box-shadow 0.2s;
}
.df-input-field:focus {
  box-shadow: 3px 3px 0 var(--ink);
}

.df-ticket-status-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  background: #f1ebd9;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 12px 15px;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 13px;
  font-family: 'Space Mono', monospace;
}
.df-summary-item {
  font-weight: 700;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .df-project-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
  .df-project-card {
    min-height: 150px;
    padding: 1.5rem;
  }
  .df-input-group {
    flex-direction: column;
  }
  .df-btn-brutal {
    width: 100%;
  }
  .df-chat-input-area {
    flex-direction: column;
  }
  .df-feedback-actions {
    flex-direction: column;
    gap: 10px;
  }
  .df-portal-header {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }
  .df-portal-tabs {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }
  .df-tab-btn {
    width: 100%;
    text-align: center;
  }
  .df-ticket-status-summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
