/* ============================================
   Saviscon Partner Portal – CSS
   ============================================ */

/* --- Custom Properties --- */
:root {
  --color-primary: #B82520;
  --color-primary-dark: #961E1A;
  --color-primary-light: #D43830;
  --color-accent: #00F2EA;
  --color-accent-dark: #00C9C2;
  --color-text: #333333;
  --color-text-light: #666666;
  --color-text-muted: #999999;
  --color-bg: #FFFFFF;
  --color-bg-alt: #F8F8F8;
  --color-bg-dark: #1A1A2E;
  --color-border: #E0E0E0;
  --color-white: #FFFFFF;
  --color-success: #22c55e;
  --color-warning: #eab308;
  --color-danger: #ef4444;
  --color-grey: #9ca3af;
  --font-family: Arial, Helvetica, sans-serif;
  --font-size-base: 1rem;
  --font-size-sm: 0.875rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-h1: 2.5rem;
  --font-size-h2: 2rem;
  --font-size-h3: 1.5rem;
  --font-size-h4: 1.25rem;
  --line-height: 1.6;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
  --transition: 0.3s ease;
  --container-max: 1200px;
  --nav-height: 64px;
  --sidebar-width: 240px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  color: var(--color-text);
  background-color: var(--color-bg-alt);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-primary-dark);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-bg-dark) 0%, #2a2a4a 100%);
  padding: 2rem;
}

.login-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo .brand {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 2px;
}

.login-logo .subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.login-card h2 {
  font-size: var(--font-size-h4);
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--color-text);
}

.login-footer {
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  margin-top: 2rem;
}

/* ============================================
   NAVBAR
   ============================================ */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-brand .brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 1.5px;
}

.navbar-brand .brand-separator {
  color: var(--color-border);
  font-weight: 300;
  font-size: 1.5rem;
}

.navbar-brand .brand-portal {
  font-size: var(--font-size-base);
  color: var(--color-text-light);
  font-weight: 400;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: var(--font-size-sm);
}

.navbar-actions .partner-name {
  color: var(--color-text);
  font-weight: 600;
}

.navbar-actions a {
  color: var(--color-text-light);
  cursor: pointer;
  transition: color var(--transition);
}

.navbar-actions a:hover {
  color: var(--color-primary);
}

/* ============================================
   TAB NAVIGATION
   ============================================ */

.tab-nav {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  padding: 0 2rem;
  margin-top: var(--nav-height);
  display: flex;
  gap: 0;
  overflow-x: auto;
}

.tab-nav button {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 1rem 1.5rem;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--color-text-light);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-weight: 500;
}

.tab-nav button:hover {
  color: var(--color-primary);
  background: rgba(184, 37, 32, 0.04);
}

.tab-nav button.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
  padding: 2rem;
  max-width: var(--container-max);
  margin: 0 auto;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.section-title {
  font-size: var(--font-size-h3);
  color: var(--color-text);
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.section-subtitle {
  font-size: var(--font-size-lg);
  color: var(--color-text-light);
  margin-bottom: 1rem;
}

/* ============================================
   STAT CARDS
   ============================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: box-shadow var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-card .stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.stat-card .stat-value {
  font-size: var(--font-size-h2);
  font-weight: 700;
  color: var(--color-text);
}

.stat-card .stat-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

/* ============================================
   CARDS (generic, download, deal)
   ============================================ */

.card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Download cards */
.download-card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition);
}

.download-card:hover {
  box-shadow: var(--shadow-md);
}

.download-card .card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.download-card .card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.download-card .card-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  flex: 1;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.download-card .btn {
  align-self: flex-start;
}

/* Category heading for sales kit */
.category-heading {
  font-size: var(--font-size-h4);
  color: var(--color-text);
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-primary);
  display: inline-block;
}

.category-heading:first-child {
  margin-top: 0;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
  text-decoration: none;
  line-height: 1.4;
}

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

.btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: var(--color-white);
}

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

.btn-secondary:hover {
  background: var(--color-primary);
  color: var(--color-white);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-light);
  border-color: var(--color-border);
}

.btn-ghost:hover {
  border-color: var(--color-text-light);
  color: var(--color-text);
}

.btn-success {
  background: var(--color-success);
  color: var(--color-white);
  border-color: var(--color-success);
}

.btn-success:hover {
  background: #16a34a;
  border-color: #16a34a;
  color: var(--color-white);
}

.btn-danger {
  background: var(--color-danger);
  color: var(--color-white);
  border-color: var(--color-danger);
}

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

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: var(--font-size-base);
}

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

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ============================================
   FORMS
   ============================================ */

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

.form-group label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.375rem;
}

.form-group label .required {
  color: var(--color-primary);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background: var(--color-white);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(184, 37, 32, 0.12);
}

.form-control::placeholder {
  color: var(--color-text-muted);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

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

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

.form-card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 2rem;
  max-width: 640px;
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

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

thead {
  background: var(--color-bg-alt);
}

th {
  text-align: left;
  padding: 0.875rem 1rem;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  border-bottom: 2px solid var(--color-border);
}

td {
  padding: 0.875rem 1rem;
  font-size: var(--font-size-sm);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

tbody tr:hover {
  background: rgba(184, 37, 32, 0.02);
}

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

.table-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
}

/* ============================================
   BADGES & STATUS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-primary {
  background: rgba(184, 37, 32, 0.1);
  color: var(--color-primary);
}

.badge-success {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.badge-warning {
  background: rgba(234, 179, 8, 0.1);
  color: #a16207;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.badge-grey {
  background: rgba(156, 163, 175, 0.15);
  color: #6b7280;
}

.badge-info {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

/* Partner tier badges */
.badge-tier {
  padding: 0.375rem 1rem;
  font-size: var(--font-size-sm);
}

.badge-tier-partner {
  background: rgba(184, 37, 32, 0.1);
  color: var(--color-primary);
  border: 1px solid rgba(184, 37, 32, 0.2);
}

.badge-tier-premium {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.1), rgba(234, 179, 8, 0.2));
  color: #92400e;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.badge-tier-enterprise {
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.08), rgba(26, 26, 46, 0.15));
  color: var(--color-bg-dark);
  border: 1px solid rgba(26, 26, 46, 0.2);
}

/* Status dots */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.status-green {
  background-color: #22c55e;
}

.status-yellow {
  background-color: #eab308;
}

.status-red {
  background-color: #ef4444;
}

.status-grey {
  background-color: #9ca3af;
}

.deal-company {
  display: flex;
  align-items: center;
}

/* Deal status badges */
.deal-status {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.deal-status-active {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

.deal-status-won {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.deal-status-lost {
  background: rgba(156, 163, 175, 0.1);
  color: #6b7280;
}

.deal-status-expired {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

/* ============================================
   MODALS
   ============================================ */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

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

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

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

.modal-header h3 {
  font-size: var(--font-size-h4);
  color: var(--color-text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color var(--transition);
}

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

.modal-body {
  padding: 2rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--color-border);
}

/* ============================================
   MESSAGES (Alert / Toast)
   ============================================ */

.message {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  margin-bottom: 1.25rem;
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.message.visible {
  display: flex;
}

.message-success {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.message-error {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.message-info {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ============================================
   WELCOME & QUICK ACTIONS
   ============================================ */

.welcome-section {
  margin-bottom: 2rem;
}

.welcome-section h2 {
  font-size: var(--font-size-h3);
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.welcome-section .tier-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.quick-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

/* ============================================
   FILTERS & TOOLBAR
   ============================================ */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.filters .form-control {
  width: auto;
  min-width: 160px;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.pagination button {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.875rem;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  cursor: pointer;
  transition: all var(--transition);
}

.pagination button:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.pagination button.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination .page-info {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  padding: 0 0.5rem;
}

/* ============================================
   LOADING / SPINNER
   ============================================ */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--color-text-muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 0.75rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   UTILITIES
   ============================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: var(--font-size-sm); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .navbar {
    padding: 0 1rem;
  }

  .navbar-actions .partner-name {
    display: none;
  }

  .tab-nav {
    padding: 0 1rem;
  }

  .tab-nav button {
    padding: 0.75rem 1rem;
    font-size: var(--font-size-sm);
  }

  .main-content {
    padding: 1rem;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

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

  .form-card {
    max-width: 100%;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .filters {
    flex-direction: column;
  }

  .filters .form-control {
    width: 100%;
  }

  .btn-group {
    flex-direction: column;
  }

  .modal {
    margin: 1rem;
    max-width: calc(100% - 2rem);
  }

  .login-card {
    padding: 2rem 1.5rem;
  }

  .quick-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .tab-nav button {
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
  }
}

/* ============================================
   LICENSE TAB
   ============================================ */

/* License summary */
.license-summary { margin-bottom: 20px; }

/* License status badge overrides (pill style) */
.badge-muted {
  background: rgba(156, 163, 175, 0.15);
  color: #6b7280;
}
