﻿/* ===================================================================
   CLOVA PARTNER CONSOLE — ADMIN DASHBOARD STYLES
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --bg-sand: #e6ded3;
  --bg-admin-canvas: #f4efe7;
  --color-night: #141b2d;
  --color-night-dark: #0a0e19;
  --color-night-card: #1b243b;
  --color-blue: #4f6bff;
  --color-blue-hover: #3d57e8;
  --color-blue-light: #edf2fe;
  --color-text-main: #141b2d;
  --color-text-muted: #59657b;
  --color-border: rgba(20, 27, 45, 0.1);
  --color-white: #ffffff;
  --color-danger: #ef4444;
  --color-emerald: #10b981;
  --color-emerald-light: #ecfdf5;

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 10px rgba(20, 27, 45, 0.04);
  --shadow-md: 0 10px 30px rgba(20, 27, 45, 0.08);
  --shadow-lg: 0 20px 50px rgba(20, 27, 45, 0.15);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-admin-canvas);
  color: var(--color-text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===================================================================
   LOGIN VIEW
   =================================================================== */
.admin-login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(circle at top right, rgba(79, 107, 255, 0.1), transparent 50%),
              radial-gradient(circle at bottom left, rgba(20, 27, 45, 0.05), transparent 50%),
              var(--bg-sand);
}

.login-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 44px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
  text-align: center;
}

.login-brand-icon {
  width: 52px;
  height: 52px;
  background: var(--color-night);
  color: var(--color-white);
  border-radius: var(--radius-md);
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(20, 27, 45, 0.2);
}

.login-title {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  color: var(--color-night);
  margin-bottom: 6px;
}

.login-desc {
  font-size: 13.5px;
  color: var(--color-text-muted);
  margin-bottom: 28px;
}

.login-form .form-group {
  margin-bottom: 18px;
  text-align: left;
}

.login-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-night);
  margin-bottom: 6px;
}

.login-input {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  font-size: 14.5px;
  font-family: var(--font-body);
  background: #faf8f5;
  outline: none;
  transition: all 0.2s ease;
}

.login-input:focus {
  background: #ffffff;
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(79, 107, 255, 0.25);
}

.btn-login-submit {
  width: 100%;
  background: var(--color-night);
  color: var(--color-white);
  padding: 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  margin-top: 10px;
}

.btn-login-submit:hover {
  background: var(--color-blue);
  transform: translateY(-1px);
}

.login-credentials-hint {
  margin-top: 24px;
  background: #f7f3ed;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
  color: var(--color-text-muted);
  border: 1px dashed rgba(20, 27, 45, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-autofill {
  background: var(--color-blue-light);
  color: var(--color-blue);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  border: none;
  cursor: pointer;
}

.btn-autofill:hover {
  background: var(--color-blue);
  color: var(--color-white);
}

.login-back-link {
  display: inline-block;
  margin-top: 20px;
  font-size: 13px;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.login-back-link:hover {
  color: var(--color-night);
}

.login-error-msg {
  background: #fee2e2;
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
  display: none;
  text-align: left;
}

/* ===================================================================
   ADMIN DASHBOARD VIEW
   =================================================================== */
.admin-dashboard-wrapper {
  display: none;
  min-height: 100vh;
  flex-direction: column;
}

.admin-header {
  background: var(--color-night);
  color: var(--color-white);
  padding: 18px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-nav-symbol {
  width: 38px;
  height: 38px;
  background: var(--color-blue);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  font-family: var(--font-heading);
}

.admin-nav-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.admin-nav-badge {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.12);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  margin-left: 8px;
  font-weight: 500;
}

.admin-nav-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.85);
}

.user-avatar-mini {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.btn-admin-logout {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-white);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-admin-logout:hover {
  background: var(--color-danger);
  border-color: var(--color-danger);
}

.admin-content {
  flex-grow: 1;
  max-width: 1320px;
  width: 100%;
  margin: 36px auto;
  padding: 0 24px;
}

/* STATS ROW */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.stat-box {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-info h6 {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 34px;
  font-weight: 800;
  color: var(--color-night);
  line-height: 1;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--color-blue-light);
  color: var(--color-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* DATA CARD */
.data-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header-bar {
  padding: 22px 28px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.card-header-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-night);
}

.card-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  width: 280px;
}

.search-input-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
}

.search-field {
  width: 100%;
  padding: 9px 14px 9px 40px;
  background: #fbf9f6;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: 13.5px;
  outline: none;
  transition: all 0.2s ease;
}

.search-field:focus {
  background: #ffffff;
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(79, 107, 255, 0.2);
}

.btn-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-white);
  color: var(--color-night);
  transition: all 0.2s ease;
}

.btn-ctrl:hover {
  background: #f6f2ec;
}

.btn-ctrl-primary {
  background: var(--color-blue);
  border-color: var(--color-blue);
  color: var(--color-white);
}

.btn-ctrl-primary:hover {
  background: var(--color-blue-hover);
}

/* DATA TABLE */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.distributors-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.distributors-table th {
  background: #faf6f0;
  padding: 14px 24px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}

.distributors-table td {
  padding: 18px 24px;
  font-size: 14.5px;
  border-bottom: 1px solid rgba(20, 27, 45, 0.05);
  vertical-align: middle;
}

.distributors-table tbody tr {
  transition: background-color 0.15s ease;
}

.distributors-table tbody tr:hover {
  background-color: #fbf9f6;
}

.company-cell {
  font-weight: 700;
  color: var(--color-night);
  display: flex;
  align-items: center;
  gap: 12px;
}

.company-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(20, 27, 45, 0.06);
  color: var(--color-night);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.phone-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-phone-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #25D366;
  color: white;
  transition: transform 0.2s ease;
  text-decoration: none;
}

.btn-phone-action:hover {
  transform: scale(1.12);
}

.date-cell {
  font-size: 13.5px;
  color: var(--color-text-muted);
}

.badge-origin {
  background: var(--color-blue-light);
  color: var(--color-blue);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.actions-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-delete-row {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-delete-row:hover {
  background: #dc2626;
  color: #ffffff;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  color: #c4b8a5;
  margin-bottom: 14px;
}

/* NOTIFICATION TOAST */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--color-night);
  color: var(--color-white);
  padding: 14px 22px;
  border-radius: var(--radius-md);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideToast 0.3s ease;
}

@keyframes slideToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .card-header-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-input-wrap {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .admin-header {
    padding: 14px 18px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .admin-nav-title {
    font-size: 16px;
  }
  .admin-content {
    margin: 18px auto;
    padding: 0 14px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
  }
  .stat-box {
    padding: 16px;
  }
  .stat-number {
    font-size: 28px;
  }
  .card-header-bar {
    padding: 16px 18px;
    gap: 12px;
  }
  .card-header-title {
    font-size: 17px;
  }
  .search-input-wrap {
    width: 100%;
  }
  .card-controls {
    width: 100%;
    justify-content: flex-start;
  }
  .distributors-table th, 
  .distributors-table td {
    padding: 12px 14px;
    font-size: 13px;
  }
  .login-card {
    padding: 30px 20px;
  }
}
