/* NAS CRM - Brand Stylesheet
   North Appliance Service
   Colors: #29ABE2 (blue), #2D2926 (dark), #FFFFFF (white)
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --blue:       #29ABE2;
  --blue-dark:  #1a8bbf;
  --blue-light: #e8f6fd;
  --dark:       #2D2926;
  --dark2:      #3d3532;
  --dark3:      #4e4845;
  --gray:       #f4f5f7;
  --gray2:      #e8eaed;
  --gray3:      #a0aab4;
  --white:      #ffffff;
  --green:      #27ae60;
  --orange:     #f39c12;
  --purple:     #8e44ad;
  --red:        #e74c3c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray);
  color: var(--dark);
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; top: 0; left: 0;
  height: 100vh; width: 240px;
  background: var(--dark);
  display: flex; flex-direction: column;
  z-index: 100;
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
}

.sidebar-brand {
  padding: 20px 24px;
  border-bottom: 1px solid var(--dark2);
  display: flex; align-items: center; gap: 12px;
}

.sidebar-brand img {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--blue);
}

.sidebar-brand-text h1 {
  color: var(--white);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.3px;
}

.sidebar-brand-text p {
  color: var(--blue);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  color: var(--gray3);
  text-decoration: none;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar nav a:hover {
  color: var(--white);
  background: var(--dark2);
  border-left-color: var(--blue);
}

.sidebar nav a.active {
  color: var(--white);
  background: rgba(41, 171, 226, 0.12);
  border-left-color: var(--blue);
}

.sidebar nav a .nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--dark2);
}

.sidebar-footer .user-name {
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
}

.sidebar-footer .user-role {
  color: var(--blue);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.sidebar-footer .logout-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: #e57373;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-top: 10px;
  transition: color 0.15s;
}
.sidebar-footer .logout-btn:hover { color: var(--red); }

/* ── MAIN ── */
.main { margin-left: 240px; padding: 32px; min-height: 100vh; }

.page-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 28px; flex-wrap: wrap; gap: 12px;
}

.page-title {
  font-size: 22px; font-weight: 800;
  color: var(--dark); letter-spacing: -0.3px;
}

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: 14px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.07);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1.5px solid var(--gray2);
}

.card-header h2 {
  font-size: 15px; font-weight: 700; color: var(--dark);
}

/* ── STATS ── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.07);
  border-left: 4px solid var(--gray2);
  transition: transform 0.15s;
}

.stat-card:hover { transform: translateY(-2px); }
.stat-card.blue  { border-left-color: var(--blue); }
.stat-card.green { border-left-color: var(--green); }
.stat-card.orange { border-left-color: var(--orange); }
.stat-card.red   { border-left-color: var(--red); }

.stat-card .stat-label {
  font-size: 12px; font-weight: 600;
  color: var(--gray3); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 32px; font-weight: 800; color: var(--dark);
  line-height: 1;
}

.stat-card.blue .stat-value   { color: var(--blue); }
.stat-card.green .stat-value  { color: var(--green); }
.stat-card.orange .stat-value { color: var(--orange); }
.stat-card.red .stat-value    { color: var(--red); }

/* ── BUTTONS ── */
.btn-primary {
  background: var(--blue); color: var(--white);
  border: none; border-radius: 8px;
  padding: 10px 22px; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
}
.btn-primary:hover { background: var(--blue-dark); transform: translateY(-1px); }

.btn-secondary {
  background: var(--gray2); color: var(--dark);
  border: none; border-radius: 8px;
  padding: 10px 20px; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s;
  font-family: inherit;
}
.btn-secondary:hover { background: #d5d8dd; }

.btn-sm {
  padding: 4px 12px; border: none; border-radius: 6px;
  font-size: 12px; cursor: pointer; font-weight: 600;
  font-family: inherit;
}
.btn-danger  { background: #fdecea; color: var(--red); }
.btn-success { background: #eafaf1; color: var(--green); }

/* ── TABLE ── */
table { width: 100%; border-collapse: collapse; }

th {
  text-align: left; font-size: 11px; font-weight: 700;
  color: var(--gray3); text-transform: uppercase;
  letter-spacing: 0.5px; padding: 10px 14px;
  border-bottom: 2px solid var(--gray2);
}

td {
  padding: 13px 14px; border-bottom: 1px solid var(--gray);
  font-size: 14px; color: #444;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--blue-light); }

a.ticket-link {
  color: var(--blue); text-decoration: none; font-weight: 700;
}
a.ticket-link:hover { text-decoration: underline; }

/* ── BADGES ── */
.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 600; color: var(--white);
}

.badge-new         { background: var(--blue); }
.badge-assigned    { background: var(--orange); }
.badge-in_progress { background: var(--purple); }
.badge-completed   { background: var(--green); }
.badge-closed      { background: var(--gray3); }

.tag-urgent { background: #fdecea; color: var(--red); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.tag-web    { background: var(--blue-light); color: var(--blue); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.tag-phone  { background: #fef9e7; color: var(--orange); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }

.role-badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.role-admin      { background: #fdecea; color: var(--red); }
.role-dispatcher { background: #fef9e7; color: var(--orange); }
.role-technician { background: #eafaf1; color: var(--green); }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block; font-size: 13px; font-weight: 600;
  color: #555; margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--gray2);
  border-radius: 8px; font-size: 14px;
  outline: none; transition: border 0.2s;
  font-family: inherit; color: var(--dark);
  background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(41,171,226,0.12);
}

.form-group textarea { resize: vertical; min-height: 80px; }
.required { color: var(--red); }
.hint { font-size: 12px; color: var(--gray3); margin-top: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.section-title {
  font-size: 12px; font-weight: 700; color: var(--gray3);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 14px; margin-top: 22px;
  padding-bottom: 8px; border-bottom: 1.5px solid var(--gray2);
}

/* ── ALERTS ── */
.alert-success { background: #eafaf1; color: #1e8449; border-radius: 8px; padding: 12px 16px; font-size: 14px; margin-bottom: 18px; font-weight: 500; }
.alert-error   { background: #fdecea; color: #c0392b; border-radius: 8px; padding: 12px 16px; font-size: 14px; margin-bottom: 18px; font-weight: 500; }
.alert-error ul { margin-left: 18px; }

/* ── FILTERS ── */
.filters {
  display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;
}
.filters input[type=text] {
  padding: 9px 14px; border: 1.5px solid var(--gray2);
  border-radius: 8px; font-size: 14px; outline: none; min-width: 220px;
  font-family: inherit;
}
.filters input:focus { border-color: var(--blue); }
.filters select {
  padding: 9px 14px; border: 1.5px solid var(--gray2);
  border-radius: 8px; font-size: 14px; outline: none; font-family: inherit;
}
.filters button {
  padding: 9px 20px; background: var(--blue); color: var(--white);
  border: none; border-radius: 8px; font-size: 14px;
  cursor: pointer; font-weight: 600; font-family: inherit;
}
.filters a.clear {
  padding: 9px 16px; background: var(--gray2); color: #666;
  border-radius: 8px; font-size: 14px; text-decoration: none;
}

/* ── INFO GRID ── */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-item label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--gray3); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 3px;
}
.info-item p { font-size: 14px; color: #333; }

/* ── HISTORY ── */
.history-item {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--gray);
  font-size: 13px;
}
.history-item:last-child { border-bottom: none; }
.history-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--blue); margin-top: 4px; flex-shrink: 0;
}
.history-time { color: var(--gray3); font-size: 12px; }

/* ── LOGIN PAGE ── */
.login-wrap {
  background: var(--white); border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  padding: 48px 40px; width: 100%; max-width: 420px;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo img { width: 90px; height: 90px; }
.login-logo h1 { font-size: 22px; font-weight: 800; color: var(--dark); margin-top: 12px; }
.login-logo p { color: var(--gray3); font-size: 13px; margin-top: 3px; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%; height: auto;
    position: relative; flex-direction: row;
    flex-wrap: wrap;
  }
  .main { margin-left: 0; padding: 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
}
