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

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

:root {
  --orange: #F26522;
  --orange-hover: #d4561d;
  --gray-dark: #53565A;
  --gray-darker: #2a2a2a;
  --gray-sidebar: #333333;
  --cream: #f5f0eb;
  --white: #ffffff;
  --border-copper: #b8a089;
  --text-dark: #2a2a2a;
  --text-muted: #888;
  --font: 'Knockout', 'Oswald', 'Arial Narrow', sans-serif;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a1a;
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
}

h1, h2, h3, h4, h5, h6,
.nav-brand, .nav-link, .stat-label,
.btn, th, label,
.page-title, .section-title {
  font-family: var(--font);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Sidebar */
.sidebar {
  width: 200px;
  min-height: 100vh;
  background: var(--gray-darker);
  color: #fff;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  padding: 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: var(--orange);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

.brand-text {
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  line-height: 1.2;
}

.brand-tagline {
  font-family: -apple-system, sans-serif;
  font-size: 0.6rem;
  color: rgba(255,255,255,0.4);
  text-transform: none;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

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

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 1.5px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}

.nav-link.active {
  color: var(--orange);
  background: rgba(242, 101, 34, 0.08);
  border-left-color: var(--orange);
}

.nav-link svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  flex-shrink: 0;
}

.nav-link.active svg { opacity: 1; }

/* Main content */
.main-content {
  margin-left: 200px;
  flex: 1;
  background: var(--cream);
  min-height: 100vh;
  padding: 2rem 2.5rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 1.5rem;
  letter-spacing: 2px;
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border-copper);
  border-top: 3px solid var(--border-copper);
  padding: 1.25rem;
  border-radius: 2px;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.stat-value {
  font-family: var(--font);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-dark);
}

/* Section */
.section {
  background: var(--white);
  border: 1px solid var(--border-copper);
  border-top: 3px solid var(--border-copper);
  border-radius: 2px;
  margin-bottom: 1.5rem;
}

.section-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #eee;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dark);
  letter-spacing: 1.5px;
}

.section-body {
  padding: 1.25rem;
}

/* Tables */
.fax-table {
  width: 100%;
  border-collapse: collapse;
}

.fax-table th {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 2px solid #eee;
}

.fax-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9rem;
}

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

.empty-row {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 2rem !important;
}

/* Forms */
.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-dark);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid #ccc;
  border-radius: 2px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--white);
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--orange);
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.form-group small {
  color: var(--text-muted);
  font-size: 0.75rem;
  display: block;
  margin-top: 0.3rem;
}

.form-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin: 0.75rem 0;
  font-style: italic;
}

.upload-zone {
  border: 2px dashed #ccc;
  border-radius: 4px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
}

.upload-zone:hover { border-color: var(--orange); }

.upload-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.upload-text {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.upload-text a {
  color: var(--orange);
  text-decoration: underline;
  cursor: pointer;
}

.upload-meta {
  color: #bbb;
  font-size: 0.7rem;
  margin-top: 0.4rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border: none;
  border-radius: 2px;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--orange);
  color: #fff;
}

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

.btn-secondary {
  background: var(--gray-dark);
  color: #fff;
}

.btn-danger {
  background: #dc3545;
  color: #fff;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.7rem;
}

.btn-full { width: 100%; justify-content: center; }

/* Status badges */
.status {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.status-received, .status-delivered { background: #d4edda; color: #155724; }
.status-pending, .status-sending { background: #fff3cd; color: #856404; }
.status-failed { background: #f8d7da; color: #721c24; }

.error-detail { display: block; color: var(--text-muted); font-size: 0.75rem; margin-top: 0.2rem; }

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 2px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-success { background: #d4edda; color: #155724; }
.alert-error { background: #f8d7da; color: #721c24; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  justify-content: center;
}

.pagination a {
  text-decoration: none;
  color: var(--orange);
  font-family: var(--font);
  font-size: 0.8rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Contact form row */
.contact-add {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #eee;
}

.contact-add input {
  flex: 1;
  min-width: 120px;
  padding: 0.6rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: 2px;
  font-size: 0.85rem;
}

/* Settings */
.settings-form { max-width: 400px; }

/* Login page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: var(--gray-darker);
}

.login-container {
  width: 360px;
  padding: 2.5rem;
  background: var(--white);
  border-radius: 4px;
  border-top: 4px solid var(--orange);
  text-align: center;
}

.login-brand-icon {
  width: 56px;
  height: 56px;
  background: var(--orange);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 1rem;
}

.login-container h1 {
  font-size: 1.5rem;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
  letter-spacing: 3px;
}

.login-subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.8rem;
}

.login-container input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 2px;
  font-size: 1rem;
  text-align: center;
  margin-bottom: 1rem;
}

.login-container input:focus {
  outline: none;
  border-color: var(--orange);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .brand-text, .sidebar .brand-tagline, .sidebar .nav-link span { display: none; }
  .sidebar-brand { justify-content: center; padding: 1rem 0.5rem; }
  .nav-link { justify-content: center; padding: 0.65rem; border-left: none; }
  .main-content { margin-left: 60px; padding: 1.5rem 1rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
