/* =========================================
   ALFERA İNŞAAT — ADMIN PANEL
   ========================================= */

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

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

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e5e7eb;
  --border-2: #d1d5db;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #9ca3af;
  --accent: #d97706;
  --accent-bright: #f59e0b;
  --accent-soft: #fef3c7;
  --success: #10b981;
  --success-soft: #d1fae5;
  --warning: #f59e0b;
  --warning-soft: #fef3c7;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --info: #3b82f6;
  --info-soft: #dbeafe;
  --sidebar-bg: #0f1419;
  --sidebar-hover: #1a1f25;
  --sidebar-text: #9ca3af;
  --sidebar-text-active: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.06), 0 4px 10px rgba(0,0,0,0.04);
  --radius: 10px;
  --radius-sm: 6px;
}

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* =========================================
   LOGIN PAGE
   ========================================= */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
}

.login-side {
  background: linear-gradient(135deg, #0f1419 0%, #1a1f25 100%);
  color: white;
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(217, 119, 6, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(217, 119, 6, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
}

.login-side > * { position: relative; z-index: 1; }

.login-brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--accent-bright);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.login-logo {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 12px;
}

.login-logo span { color: var(--accent-bright); }

.login-tagline {
  color: #9ca3af;
  font-size: 15px;
  max-width: 380px;
  line-height: 1.6;
}

.login-side-footer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #6b7280;
  letter-spacing: 0.1em;
}

.login-form-side {
  padding: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-form-box {
  width: 100%;
  max-width: 400px;
}

.login-form-box h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.login-form-box .subtitle {
  color: var(--text-2);
  margin-bottom: 36px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

.field textarea {
  min-height: 110px;
  resize: vertical;
  font-family: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  background: var(--text);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.btn:hover { background: #000; }
.btn:active { transform: translateY(1px); }

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

.btn-block { width: 100%; padding: 13px 20px; }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 7px 12px; font-size: 13px; }

.login-hint {
  margin-top: 20px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-2);
  text-align: center;
}

.login-hint code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--accent);
}

.login-error {
  display: none;
  background: var(--danger-soft);
  color: #991b1b;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid #fecaca;
}

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

/* =========================================
   LAYOUT
   ========================================= */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 24px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 0 24px 28px;
  border-bottom: 1px solid #1f2937;
  margin-bottom: 20px;
}

.sidebar-brand .logo {
  color: white;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.sidebar-brand .logo span { color: var(--accent-bright); }

.sidebar-brand .small {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: #6b7280;
  margin-top: 4px;
  text-transform: uppercase;
}

.sidebar-section {
  padding: 0 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: #6b7280;
  text-transform: uppercase;
  margin: 24px 0 8px;
}

.sidebar-nav { list-style: none; }

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

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

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

.sidebar-nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 24px;
  border-top: 1px solid #1f2937;
  background: var(--sidebar-bg);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-name { color: white; font-size: 13px; font-weight: 600; }
.user-role { color: #6b7280; font-size: 11px; }

/* MAIN */
.main {
  padding: 32px 40px;
  background: var(--bg);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.topbar h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar .breadcrumb {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-box {
  position: relative;
}

.search-box input {
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  width: 260px;
}

.search-box svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-3);
}

/* =========================================
   STAT CARDS
   ========================================= */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.stat-card-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.stat-card-meta {
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-card-meta .up { color: var(--success); font-weight: 600; }
.stat-card-meta .down { color: var(--danger); font-weight: 600; }

.stat-card-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card-icon svg { width: 18px; height: 18px; }

/* =========================================
   CARD / SECTION
   ========================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-head h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-head .sub {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}

.card-body { padding: 22px; }
.card-body.flush { padding: 0; }

.two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

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

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data thead th {
  text-align: left;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--text-3);
  text-transform: uppercase;
  padding: 12px 22px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
}

table.data tbody td {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

table.data tbody tr:hover {
  background: var(--surface-2);
}

.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.amount { font-family: 'JetBrains Mono', monospace; font-weight: 500; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.completed { background: var(--success-soft); color: #065f46; }
.badge.ongoing { background: var(--warning-soft); color: #92400e; }
.badge.pending { background: var(--info-soft); color: #1e40af; }
.badge.draft { background: #f3f4f6; color: #4b5563; }
.badge.read { background: #f3f4f6; color: #4b5563; }
.badge.unread { background: var(--accent-soft); color: #92400e; }

.row-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-2);
  transition: all 0.15s;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-2);
}

.icon-btn.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #fecaca;
}

.icon-btn svg { width: 15px; height: 15px; }

/* =========================================
   ACTIVITY / TIMELINE
   ========================================= */
.activity-list { list-style: none; }

.activity-list li {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.activity-list li:last-child { border-bottom: none; }

.activity-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-dot svg { width: 16px; height: 16px; }

.activity-text { font-size: 13px; color: var(--text); }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: 11px; color: var(--text-3); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }

/* =========================================
   FORM
   ========================================= */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-grid .field.full { grid-column: 1 / -1; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  margin-top: 22px;
}

/* =========================================
   MODAL
   ========================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head h3 { font-size: 17px; font-weight: 600; }

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-2);
}

.modal-close:hover { background: var(--surface-2); color: var(--text); }

.modal-body { padding: 22px; }
.modal-foot {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* =========================================
   FILTERS / TOOLBAR
   ========================================= */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.filter-tab {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text-2);
  font-family: inherit;
}

.filter-tab:hover { color: var(--text); }
.filter-tab.active {
  background: var(--text);
  color: white;
}

/* =========================================
   TOAST
   ========================================= */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.25s;
  pointer-events: none;
  z-index: 200;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

.toast svg { width: 18px; height: 18px; }

/* =========================================
   MESSAGE DETAIL
   ========================================= */
.message-row {
  display: grid;
  grid-template-columns: 220px 1fr 120px 110px;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  cursor: pointer;
  transition: background 0.1s;
}

.message-row:hover { background: var(--surface-2); }
.message-row.unread { background: #fffbeb; }
.message-row.unread .message-from { font-weight: 700; }

.message-from { font-weight: 500; font-size: 13px; }
.message-from .email { color: var(--text-3); font-size: 12px; margin-top: 2px; font-weight: 400; }

.message-preview {
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-preview strong { color: var(--text); margin-right: 6px; }

.message-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-3);
  text-align: right;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-side { display: none; }
}

@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -100%;
    width: 240px;
    z-index: 50;
    transition: left 0.25s;
  }
  .sidebar.open { left: 0; }
  .main { padding: 20px; }
  .stat-grid { grid-template-columns: 1fr; }
  .search-box input { width: 100%; }
  .message-row { grid-template-columns: 1fr; gap: 4px; }
}
