/* ==========================================================================
   easyDSG Shared Design Tokens & Component Styles
   See: docs/project_truth/frontend/customer/styling.md
   ========================================================================== */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

/* --- Design Tokens --- */
:root {
  /* easyDSG branding — see project_truth_general_design.md */
  --easydsg-red: #c0392b;
  --easydsg-red-dark: #a5281b;
  --easydsg-red-light: #fdf0ef;

  /* Neutrals */
  --swiss-gray: #6c757d;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;

  /* Backgrounds */
  --bg-light: #f8f9fa;
  --bg-white: #ffffff;
  --border-light: #dee2e6;

  /* Status colors */
  --success-green: #198754;
  --warning-yellow: #ffc107;
  --danger-red: #dc3545;
  --info-blue: #0dcaf0;

  /* Spacing */
  --spacing-xs: 0.25rem;   /* 4px */
  --spacing-sm: 0.5rem;    /* 8px */
  --spacing-md: 1rem;      /* 16px */
  --spacing-lg: 1.5rem;    /* 24px */
  --spacing-xl: 2rem;      /* 32px */

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Typography */
  --font-family: 'Montserrat', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
}

/* --- Base Typography --- */
body {
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

p, li, td, th {
  line-height: 1.6;
}

/* --- Focus Ring (brand-tinted, accessibility) --- */
*:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15);
}

/* --- Page Transition --- */
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.container-fluid,
.auth-container {
  animation: page-fade-in 0.2s ease-out;
}

/* ==========================================================================
   Component Classes
   ========================================================================== */

/* --- Module Cards --- */
.module-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  border: 1px solid var(--border-light);
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.module-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
  color: inherit;
  text-decoration: none;
}

.module-card .module-icon {
  font-size: 2rem;
  color: var(--easydsg-red);
  margin-bottom: var(--spacing-sm);
}

.module-card .module-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-xs);
}

.module-card .module-description {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
}

/* --- License Status Badges (tinted pill style) --- */
.license-badge {
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: var(--font-weight-medium);
  display: inline-flex;
  align-items: center;
}

.license-active {
  background: rgba(25, 135, 84, 0.1);
  color: #198754;
}

.license-expiring {
  background: rgba(255, 193, 7, 0.12);
  color: #8a6d00;
}

.license-expired {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

.license-inactive {
  background: var(--bg-light);
  color: var(--text-secondary);
}

/* --- Law Context Badges (Knowledge Base) --- */
.law-badge {
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: var(--font-weight-medium);
  display: inline-block;
}

.law-badge-dsg {
  background: #e8f4fd;
  color: #0d6efd;
}

.law-badge-dsgvo {
  background: #fdf4e8;
  color: #fd7e14;
}

/* --- easyDSG Primary Button --- */
.btn-easydsg {
  background-color: var(--easydsg-red);
  border-color: var(--easydsg-red);
  color: white;
}

.btn-easydsg:hover,
.btn-easydsg:focus {
  background-color: var(--easydsg-red-dark);
  border-color: var(--easydsg-red-dark);
  color: white;
}

.btn-easydsg:active {
  background-color: var(--easydsg-red-dark);
  border-color: var(--easydsg-red-dark);
}

.btn-outline-easydsg {
  color: var(--easydsg-red);
  border-color: var(--easydsg-red);
  background-color: transparent;
}

.btn-outline-easydsg:hover,
.btn-outline-easydsg:focus {
  background-color: var(--easydsg-red);
  border-color: var(--easydsg-red);
  color: white;
}

/* --- Company Accent Bar --- */
.company-accent-bar {
  height: 6px;
  width: 100%;
  background-color: var(--easydsg-red);
  transition: background-color 0.3s ease;
}

/* --- Company Color Dot --- */
.company-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: var(--spacing-xs);
  vertical-align: middle;
}

/* --- Settings Vertical Tabs --- */
.settings-nav {
  border-right: 1px solid var(--border-light);
  padding-right: var(--spacing-md);
}

.settings-nav .nav-link {
  color: var(--text-secondary);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-xs);
  font-weight: var(--font-weight-medium);
}

.settings-nav .nav-link:hover {
  background-color: var(--bg-light);
  color: var(--text-primary);
}

.settings-nav .nav-link.active {
  background-color: var(--easydsg-red-light);
  color: var(--easydsg-red);
  font-weight: var(--font-weight-semibold);
}

/* --- Subscription Status Widget --- */
.subscription-widget {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
}

.subscription-widget .widget-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-md);
}

.subscription-widget .license-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--border-light);
}

.subscription-widget .license-item:last-child {
  border-bottom: none;
}

/* --- Knowledge Base --- */
.kb-search-container {
  position: relative;
  margin-bottom: var(--spacing-lg);
}

.kb-search-container .form-control {
  padding-left: 2.5rem;
}

.kb-search-container .search-icon {
  position: absolute;
  left: var(--spacing-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.kb-category-tabs .nav-link {
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
}

.kb-category-tabs .nav-link.active {
  color: var(--easydsg-red);
  border-bottom-color: var(--easydsg-red);
}

.glossary-term {
  padding: var(--spacing-md);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-sm);
  background: var(--bg-white);
}

.glossary-term .term-title {
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-xs);
}

.glossary-term .term-definition {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* --- Toast Container (override for branding) --- */
.toast-container {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  z-index: 1090;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  max-width: 400px;
}

.toast-container .toast {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  animation: toast-slide-up 0.25s ease-out;
}

@keyframes toast-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Skeleton Loading --- */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--spacing-sm);
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-lg);
}

/* --- Coming Soon Badge --- */
.badge-coming-soon {
  background-color: var(--text-muted);
  color: white;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-medium);
}

/* --- Responsive Utilities --- */
@media (max-width: 991.98px) {
  .settings-nav {
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding-right: 0;
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    flex-direction: row !important;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .settings-nav .nav-link {
    white-space: nowrap;
  }
}
