/* ═══════════════════════════════════════════
   itstube.de – Support System Stylesheet
   ═══════════════════════════════════════════ */

:root {
  --navy:        #1b2d45;
  --navy-mid:    #243550;
  --navy-light:  #2e4468;
  --accent-blue: #3b7dd8;
  --accent-glow: rgba(59, 125, 216, 0.10);
  --white:       #ffffff;
  --off-white:   #f4f6f9;
  --gray-light:  #eef1f6;
  --gray-mid:    #c8d0dc;
  --text:        #1b2d45;
  --text-muted:  #5a6f88;
  --border:      #dde3ed;
  --shadow-sm:   0 2px 8px rgba(27, 45, 69, 0.08);
  --shadow-md:   0 6px 24px rgba(27, 45, 69, 0.12);
  --shadow-lg:   0 16px 48px rgba(27, 45, 69, 0.16);
  --radius:      10px;
  --radius-lg:   16px;
  --sidebar-w:   260px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--off-white);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 0.95rem;
  line-height: 1.7;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ════════════════════════════════════════
   AUTH PAGES (Login)
════════════════════════════════════════ */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  padding: 2rem;
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.8rem 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.auth-logo img {
  height: 40px;
  width: auto;
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--navy);
  text-align: center;
  margin-bottom: 0.3rem;
}

.auth-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 2rem;
}

/* ════════════════════════════════════════
   LAYOUT
════════════════════════════════════════ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.6rem 1.5rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo img {
  height: 34px;
  width: auto;
  filter: brightness(0) invert(1);
}

.sidebar-nav {
  padding: 1.2rem 0;
  flex: 1;
}

.sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  padding: 0.8rem 1.5rem 0.4rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.5rem;
  color: rgba(255,255,255,0.65);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.18s;
  text-decoration: none;
}

.sidebar-link:hover,
.sidebar-link.active {
  color: #fff;
  background: rgba(255,255,255,0.07);
  text-decoration: none;
}

.sidebar-link.active {
  border-right: 3px solid var(--accent-blue);
}

.sidebar-link .icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  background: var(--accent-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-username {
  color: rgba(255,255,255,0.8);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
}

.sidebar-role {
  color: rgba(255,255,255,0.4);
  font-size: 0.72rem;
}

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-body {
  padding: 2rem;
  flex: 1;
}

/* ════════════════════════════════════════
   COMPONENTS
════════════════════════════════════════ */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: all 0.18s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--navy);
  color: #fff;
}
.btn-primary:hover {
  background: var(--navy-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: #fff;
}

.btn-accent {
  background: var(--accent-blue);
  color: #fff;
}
.btn-accent:hover {
  background: #2d6bc4;
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--border);
}
.btn-outline:hover {
  border-color: var(--navy);
  text-decoration: none;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}
.btn-danger:hover {
  background: #b91c1c;
  text-decoration: none;
  color: #fff;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.78rem;
}

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.1rem;
}

.form-group label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.form-group input,
.form-group textarea,
.form-group select {
  background: var(--off-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.93rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: vertical;
  width: 100%;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59,125,216,0.12);
  background: var(--white);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--gray-mid); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-offen         { background: #fef3c7; color: #d97706; }
.badge-progress      { background: #dbeafe; color: #2563eb; }
.badge-closed        { background: #dcfce7; color: #16a34a; }
.badge-stoerung      { background: #fee2e2; color: #dc2626; }
.badge-anfrage       { background: #ede9fe; color: #7c3aed; }

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 1rem;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.3rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Table */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--gray-light);
  vertical-align: middle;
  font-size: 0.88rem;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: var(--off-white); }

/* Ticket Thread */
.thread { display: flex; flex-direction: column; gap: 1.2rem; }

.comment-bubble {
  display: flex;
  gap: 1rem;
}

.comment-bubble.customer { flex-direction: row; }
.comment-bubble.staff    { flex-direction: row-reverse; }

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  color: #fff;
  flex-shrink: 0;
}

.comment-avatar.av-customer { background: var(--accent-blue); }
.comment-avatar.av-staff    { background: var(--navy); }

.comment-body {
  max-width: 75%;
}

.comment-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.comment-bubble.staff .comment-meta { text-align: right; }

.comment-text {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-bubble.staff .comment-text {
  background: var(--navy);
  color: rgba(255,255,255,0.9);
  border-color: var(--navy);
}

/* Ticket Info Grid */
.ticket-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ticket-info-item label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.2rem;
}

.ticket-info-item span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.8rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
}

.page-header p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.2rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { color: var(--navy); font-size: 1.1rem; margin-bottom: 0.5rem; }

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
