/**
 * 3BOX Advertising - Platform Stylesheet
 * Project Brief, Quotations, Invoices, Client Portal & Admin Dashboard
 */

:root {
  --bg-dark: #080808;
  --bg-card: #121214;
  --bg-card-hover: #18181c;
  --bg-input: #1a1a1f;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #e50914;
  --primary: #e50914;
  --primary-hover: #b80710;
  --primary-glow: rgba(229, 9, 20, 0.25);
  --gold: #d4af37;
  --gold-glow: rgba(212, 175, 55, 0.2);
  --text-main: #f5f5f7;
  --text-muted: #9e9ea7;
  --text-dim: #6e6e78;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-card: 0 12px 36px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 30px rgba(229, 9, 20, 0.2);
  --font-arabic: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-english: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Base Platform Styles */
body.platform-body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-arabic);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  line-height: 1.6;
  direction: rtl;
}

body.platform-body.ltr {
  direction: ltr;
  font-family: var(--font-english);
}

/* Top Platform Navigation */
.platform-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 8, 8, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
  gap: 16px;
}

.platform-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.platform-logo img {
  height: 38px;
  width: auto;
}

.platform-nav-links {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.5vw, 20px);
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
}

.platform-nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  transition: color 0.2s, transform 0.2s;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  white-space: nowrap !important;
  flex-shrink: 0;
}

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

.platform-nav-btn {
  background: var(--primary);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: all 0.25s ease;
}

.platform-nav-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(229, 9, 20, 0.4);
}

/* Page Container */
.platform-container {
  max-width: 1140px;
  margin: 40px auto 80px;
  padding: 0 20px;
}

.platform-header {
  text-align: center;
  margin-bottom: 40px;
}

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(229, 9, 20, 0.12);
  color: var(--primary);
  border: 1px solid rgba(229, 9, 20, 0.25);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.platform-title {
  font-size: 2.25rem;
  font-weight: 900;
  margin: 0 0 12px;
  background: linear-gradient(135deg, #ffffff 30%, #a3a3a8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.platform-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 680px;
  margin: 0 auto;
}

/* Step Wizard Container */
.wizard-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: relative;
}

/* Wizard Stepper Header */
.stepper-header {
  background: rgba(18, 18, 20, 0.8);
  border-bottom: 1px solid var(--border-subtle);
  padding: 24px 28px;
}

.stepper-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  margin-bottom: 24px;
  overflow: hidden;
  position: relative;
}

.stepper-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #e50914, #ff3b47);
  border-radius: var(--radius-full);
  width: 16.66%;
  transition: width 0.35s ease-in-out;
}

.stepper-steps {
  display: flex;
  justify-content: space-between;
  position: relative;
}

.stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  text-align: center;
  cursor: pointer;
  position: relative;
  z-index: 2;
  transition: all 0.25s;
}

.stepper-step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 2px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.25s;
}

.stepper-step-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  transition: color 0.25s;
  white-space: nowrap;
}

.stepper-step.active .stepper-step-circle {
  background: var(--primary);
  border-color: #ff3b47;
  color: #fff;
  box-shadow: 0 0 16px var(--primary-glow);
}

.stepper-step.active .stepper-step-label {
  color: #fff;
  font-weight: 700;
}

.stepper-step.completed .stepper-step-circle {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--success);
  color: var(--success);
}

.stepper-step.completed .stepper-step-label {
  color: var(--text-muted);
}

/* Wizard Body */
.wizard-body {
  padding: 36px 40px;
}

.wizard-section {
  display: none;
  animation: fadeIn 0.3s ease forwards;
}

.wizard-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-head {
  margin-bottom: 28px;
}

.section-head h3 {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0 0 8px;
  color: #fff;
}

.section-head p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

/* Form Layout */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.form-grid.grid-full {
  grid-template-columns: 1fr;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group.col-span-2 {
  grid-column: span 2;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #e2e2e8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label .required {
  color: var(--primary);
  margin-right: 4px;
}

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 12px 16px;
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: #1e1e24;
}

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

/* Choice Cards (Services & Options) */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.choice-card {
  background: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  cursor: pointer;
  transition: all 0.22s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-card:hover {
  background: #202026;
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.choice-card.selected {
  background: rgba(229, 9, 20, 0.08);
  border-color: var(--primary);
  box-shadow: 0 0 18px var(--primary-glow);
}

.choice-card input[type="checkbox"],
.choice-card input[type="radio"] {
  position: absolute;
  top: 16px;
  left: 16px;
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
}

body.ltr .choice-card input[type="checkbox"],
body.ltr .choice-card input[type="radio"] {
  left: auto;
  right: 16px;
}

.choice-icon {
  font-size: 1.8rem;
  color: var(--primary);
}

.choice-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.choice-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* File Dropzone */
.dropzone-box {
  background: rgba(26, 26, 31, 0.5);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.dropzone-box:hover,
.dropzone-box.dragover {
  border-color: var(--primary);
  background: rgba(229, 9, 20, 0.05);
}

.dropzone-icon {
  font-size: 2.4rem;
  color: var(--primary);
  margin-bottom: 12px;
}

.dropzone-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

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

.file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.file-item {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

.file-item-name {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.file-item-remove {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.file-item-remove:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* Review Summary Card */
.review-card {
  background: #16161b;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
}

.review-section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--gold);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.review-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.92rem;
}

.review-label {
  color: var(--text-muted);
  font-weight: 600;
}

.review-value {
  color: #fff;
  font-weight: 700;
  text-align: left;
}

body.ltr .review-value {
  text-align: right;
}

/* Wizard Footer Buttons */
.wizard-footer {
  background: rgba(18, 18, 20, 0.9);
  border-top: 1px solid var(--border-subtle);
  padding: 20px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--border-subtle);
  padding: 12px 26px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 32px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 18px var(--primary-glow);
  transition: all 0.25s ease;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(229, 9, 20, 0.45);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Success Modal & Tracking Box */
.success-box {
  background: #141418;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
}

.success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin: 0 auto 20px;
  border: 2px solid var(--success);
}

.ref-token-badge {
  background: #1c1c24;
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
}

.ref-token-number {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--gold);
}

.copy-btn {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: var(--gold);
  color: #000;
}

/* Document View Styles (Quotes & Invoices) */
.doc-page {
  background: #fff;
  color: #1a1a1a;
  border-radius: var(--radius-md);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  padding: 50px 60px;
  max-width: 900px;
  margin: 30px auto;
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Tajawal', sans-serif;
}

.doc-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin: 20px auto 0;
  padding: 16px 20px;
  background: #18181c;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #e50914;
  padding-bottom: 24px;
  margin-bottom: 30px;
}

.doc-logo-box img {
  height: 52px;
}

.doc-meta {
  text-align: left;
}

body.platform-body:not(.ltr) .doc-meta {
  text-align: right;
}

.doc-badge-status {
  display: inline-block;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.status-draft { background: #f3f4f6; color: #4b5563; }
.status-issued { background: #e0f2fe; color: #0369a1; }
.status-accepted { background: #dcfce7; color: #15803d; }
.status-paid { background: #dcfce7; color: #15803d; }
.status-partially_paid { background: #fef3c7; color: #b45309; }
.status-overdue { background: #fee2e2; color: #b91c1c; }
.status-revision_requested { background: #fef3c7; color: #b45309; }
.status-rejected { background: #fee2e2; color: #b91c1c; }

.doc-grid-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
}

.doc-table th {
  background: #f8f9fa;
  color: #1f2937;
  font-weight: 800;
  padding: 12px 16px;
  text-align: right;
  border-bottom: 2px solid #e5e7eb;
  font-size: 0.9rem;
}

body.ltr .doc-table th {
  text-align: left;
}

.doc-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.92rem;
  color: #374151;
}

.doc-totals {
  width: 320px;
  margin-right: auto;
  margin-left: 0;
}

body.ltr .doc-totals {
  margin-left: auto;
  margin-right: 0;
}

.doc-total-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.95rem;
  color: #4b5563;
}

.doc-total-row.grand-total {
  font-size: 1.25rem;
  font-weight: 900;
  color: #e50914;
  border-top: 2px solid #e50914;
  padding-top: 12px;
  margin-top: 8px;
}

.doc-terms {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
  font-size: 0.86rem;
  color: #6b7280;
  line-height: 1.6;
}

/* Admin Dashboard Elements */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 260px;
  background: #0d0d10;
  border-left: 1px solid var(--border-subtle);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  box-sizing: border-box;
}

body.ltr .admin-sidebar {
  border-left: none;
  border-right: 1px solid var(--border-subtle);
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
  cursor: pointer;
  margin-bottom: 4px;
}

.admin-nav-item:hover,
.admin-nav-item.active {
  background: rgba(229, 9, 20, 0.12);
  color: #fff;
  border-right: 3px solid var(--primary);
}

body.ltr .admin-nav-item.active {
  border-right: none;
  border-left: 3px solid var(--primary);
}

.admin-main {
  flex: 1;
  padding: 30px 40px;
  background: var(--bg-dark);
  overflow-y: auto;
}

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

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kpi-title {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 900;
  color: #fff;
}

.kpi-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Data Tables */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.table-header-bar {
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 14px 20px;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
}

body.ltr .data-table th {
  text-align: left;
}

.data-table td {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.92rem;
  color: #e5e5eb;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-window {
  background: #141418;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
}

.modal-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 28px;
}

.modal-footer {
  padding: 18px 28px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Print Optimization */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .platform-nav,
  .doc-actions-bar,
  .btn-primary,
  .btn-secondary,
  .admin-sidebar {
    display: none !important;
  }
  .doc-page {
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }
}

/* Responsive */
@media (max-width: 900px) {
  .form-grid,
  .form-grid.grid-3 {
    grid-template-columns: 1fr;
  }
  .form-group.col-span-2 {
    grid-column: span 1;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .admin-layout {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: static;
  }
  .stepper-steps {
    overflow-x: auto;
    padding-bottom: 10px;
  }
  .stepper-step-label {
    display: none;
  }
}
