/* ==========================================================================
   DP PROTECT LTD - ADMIN DASHBOARD & INVOICE SYSTEM STYLESHEET
   ========================================================================== */

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

:root {
  --admin-bg-dark: #07080B;
  --admin-bg-main: #0B0D11;
  --admin-bg-surface: #121620;
  --admin-bg-card: #161C29;
  --admin-bg-hover: #1C2436;

  --gold-primary: #E5A93C;
  --gold-light: #F8C868;
  --gold-dark: #B87B1E;
  --gold-gradient: linear-gradient(135deg, #F8C868 0%, #E5A93C 50%, #AA7015 100%);
  --gold-glow: 0 8px 30px rgba(229, 169, 60, 0.25);

  --border-gold: rgba(229, 169, 60, 0.28);
  --border-glass: rgba(255, 255, 255, 0.08);

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-subtle: #64748B;

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

  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--admin-bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Login Overlay Screen */
.login-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(229, 169, 60, 0.12) 0%, transparent 70%),
              var(--admin-bg-dark);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: var(--admin-bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  padding: 2.8rem 2.2rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), var(--gold-glow);
  text-align: center;
}

.login-logo {
  height: 60px;
  margin-bottom: 1.2rem;
}

.login-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

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

/* Admin Layout Structure */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 270px;
  background: var(--admin-bg-surface);
  border-right: 1px solid var(--border-glass);
  padding: 1.8rem 1.2rem;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border-glass);
  text-decoration: none;
}

.sidebar-brand img {
  height: 42px;
}

.sidebar-brand-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: #FFF;
}

.sidebar-brand-tag {
  font-size: 0.6rem;
  color: var(--gold-primary);
  font-weight: 700;
  letter-spacing: 0.8px;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
}

.sidebar-link:hover, .sidebar-link.active {
  background: var(--admin-bg-card);
  color: var(--text-main);
  border-color: var(--border-gold);
}

.sidebar-link.active svg {
  color: var(--gold-primary);
}

.sidebar-user {
  border-top: 1px solid var(--border-glass);
  padding-top: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-user-info p {
  font-size: 0.85rem;
  font-weight: 700;
}

.sidebar-user-info span {
  font-size: 0.75rem;
  color: var(--gold-primary);
}

/* Admin Main Content Area */
.admin-main {
  flex-grow: 1;
  background: var(--admin-bg-main);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.admin-header {
  height: 70px;
  background: var(--admin-bg-surface);
  border-bottom: 1px solid var(--border-glass);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  sticky: top;
  z-index: 100;
}

.admin-header-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

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

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

/* Dashboard Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2.2rem;
}

.metric-card {
  background: var(--admin-bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  transition: var(--transition);
}

.metric-card:hover {
  border-color: var(--border-gold);
  transform: translateY(-3px);
}

.metric-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: rgba(229, 169, 60, 0.12);
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-primary);
  font-size: 1.3rem;
  flex-shrink: 0;
}

.metric-data h4 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gold-light);
}

.metric-data p {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
}

/* Standard Panels & Form Control */
.panel {
  background: var(--admin-bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-glass);
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}

.form-group {
  margin-bottom: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control {
  background: var(--admin-bg-dark);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px rgba(229, 169, 60, 0.15);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  outline: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--gold-gradient);
  color: #07080B;
  box-shadow: var(--gold-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-gold);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #FCA5A5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

/* Invoice Line Items Table */
.items-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.items-table th {
  background: var(--admin-bg-surface);
  color: var(--gold-light);
  font-family: var(--font-heading);
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-glass);
}

.items-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-glass);
}

/* Summary Calculations Box */
.summary-box {
  background: var(--admin-bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  width: 100%;
  max-width: 360px;
  margin-left: auto;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  font-size: 0.9rem;
}

.summary-row.total {
  border-top: 1px solid var(--border-gold);
  padding-top: 0.8rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gold-light);
}

/* History Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: var(--admin-bg-surface);
  color: var(--gold-light);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border-glass);
}

.data-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-glass);
  font-size: 0.88rem;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-paid { background: rgba(34, 197, 94, 0.18); color: #86EFAC; border: 1px solid rgba(34, 197, 94, 0.3); }
.status-unpaid { background: rgba(239, 68, 68, 0.18); color: #FCA5A5; border: 1px solid rgba(239, 68, 68, 0.3); }
.status-pending { background: rgba(245, 158, 11, 0.18); color: #FDE047; border: 1px solid rgba(245, 158, 11, 0.3); }

/* Modal Dialogs */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--admin-bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 850px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2.2rem;
  position: relative;
  box-shadow: 0 25px 60px rgba(0,0,0,0.9), var(--gold-glow);
}

/* Print & PDF Template Styling (Gold & Obsidian Branding) */
#pdfInvoiceTemplate {
  background: #FFFFFF;
  color: #1E293B;
  padding: 2.5rem;
  font-family: 'Inter', sans-serif;
  border-radius: 8px;
  box-shadow: 0 5px 25px rgba(0,0,0,0.15);
}

.pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #E5A93C;
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.pdf-logo {
  height: 60px;
}

.pdf-title-box {
  text-align: right;
}

.pdf-type {
  font-size: 2rem;
  font-weight: 800;
  color: #0F172A;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.pdf-number {
  font-size: 0.95rem;
  color: #E5A93C;
  font-weight: 700;
}

.pdf-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.pdf-box h5 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #64748B;
  letter-spacing: 0.8px;
  margin-bottom: 0.5rem;
}

.pdf-box p {
  font-size: 0.9rem;
  line-height: 1.4;
  color: #0F172A;
}

.pdf-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

.pdf-table th {
  background: #0F172A;
  color: #FFFFFF;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  text-align: left;
}

.pdf-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #E2E8F0;
  font-size: 0.88rem;
  color: #1E293B;
}

.pdf-totals {
  width: 300px;
  margin-left: auto;
  margin-bottom: 2rem;
}

.pdf-totals-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.9rem;
}

.pdf-totals-row.grand {
  border-top: 2px solid #E5A93C;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0F172A;
  padding-top: 0.6rem;
}

.pdf-watermark {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 5rem;
  font-weight: 900;
  color: rgba(34, 197, 94, 0.18);
  border: 8px solid rgba(34, 197, 94, 0.2);
  padding: 0.5rem 2rem;
  border-radius: 12px;
  pointer-events: none;
  text-transform: uppercase;
}

.admin-mobile-toggle {
  display: none !important;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
  touch-action: manipulation;
}

.admin-mobile-toggle * {
  pointer-events: none !important;
}

.admin-mobile-toggle:hover {
  background: var(--admin-bg-hover);
  color: var(--gold-primary);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 99990;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.sidebar-backdrop.active {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Responsive Overrides */
@media (max-width: 991px) {
  .admin-mobile-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
  }
  .admin-sidebar {
    position: fixed !important;
    left: -320px !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 99999 !important;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.9);
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .admin-sidebar.active {
    left: 0 !important;
    transform: none !important;
  }
  .admin-header-title {
    font-size: 0.92rem !important;
    line-height: 1.25 !important;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .admin-header {
    padding: 0 0.75rem !important;
    height: 60px !important;
  }
  .admin-header-title {
    font-size: 0.8rem !important;
    line-height: 1.2 !important;
  }
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr;
  }
  .admin-body {
    padding: 1rem 0.75rem !important;
  }
}
