/* =============================================================================
   REUSABLE THEME SYSTEM
   This file mirrors the EasyHR theme so the apps share a consistent look.
   ============================================================================= */

/* CSS Custom Properties */
:root {
  /* Primary Colors */
  --color-primary-blue: #0b8793;
  --color-primary-purple: #360033;
  --color-primary-teal: #009DA0;
  
  /* Semantic Colors */
  --color-success: #10B981;
  --color-warning: #FF8D60;
  --color-danger: #FF586B;
  --color-info: #3B82F6;
  
  /* Neutral Colors */
  --color-neutral-white: #FFFFFF;
  --color-neutral-gray-50: #F9FAFB;
  --color-neutral-gray-100: #F3F4F6;
  --color-neutral-gray-200: #E5E7EB;
  --color-neutral-gray-300: #D1D5DB;
  --color-neutral-gray-400: #9CA3AF;
  --color-neutral-gray-500: #6B7280;
  --color-neutral-gray-600: #4B5563;
  --color-neutral-gray-700: #374151;
  --color-neutral-gray-800: #1F2937;
  --color-neutral-gray-900: #111827;
  --color-neutral-black: #000000;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* Typography */
  --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-sidebar: 4px 0 12px -2px rgba(0,0,0,0.15);
  
  /* Transitions */
  --transition-fast: 150ms;
  --transition-normal: 300ms;
  --transition-slow: 500ms;
  --transition-timing: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables */
.dark {
  --color-neutral-white: #0F172A;
  --color-neutral-gray-50: #1E293B;
  --color-neutral-gray-100: #334155;
  --color-neutral-gray-200: #475569;
  --color-neutral-gray-300: #64748B;
  --color-neutral-gray-400: #94A3B8;
  --color-neutral-gray-500: #CBD5E1;
  --color-neutral-gray-600: #E2E8F0;
  --color-neutral-gray-700: #F1F5F9;
  --color-neutral-gray-800: #F8FAFC;
  --color-neutral-gray-900: #FFFFFF;
  --color-neutral-black: #FFFFFF;
}

/* =============================================================================
   BASE STYLES
   ============================================================================= */

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  line-height: 1.5;
  color: var(--color-neutral-gray-900);
  background-color: var(--color-neutral-gray-100);
  margin: 0;
  padding: 0;
}

.dark body {
  color: var(--color-neutral-gray-200);
  background-color: var(--color-neutral-gray-50);
}

/* =============================================================================
   LAYOUT COMPONENTS
   ============================================================================= */

.theme-layout {
  display: flex;
  min-height: 100vh;
}

.theme-sidebar {
  width: 14rem;
  min-height: 100vh;
  background: linear-gradient(to bottom, var(--color-primary-blue), var(--color-primary-purple));
  box-shadow: var(--shadow-sidebar);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
}

.theme-sidebar-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  flex: 1;
}

.theme-sidebar-brand {
  padding: 1rem 0.75rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 0.5rem;
}

.theme-sidebar-brand-logo {
  margin-bottom: 0.5rem;
}

.theme-sidebar-logo-img {
  max-height: 48px;
  width: auto;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 6px;
}

.theme-brand-title {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.25;
  word-break: break-word;
}

.theme-brand-subtitle {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.8rem;
  margin: 0.2rem 0 0;
  font-weight: 500;
}

.theme-sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
}

.theme-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.theme-topbar {
  background-color: var(--color-neutral-white);
  border-bottom: 1px solid var(--color-neutral-gray-200);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.dark .theme-topbar {
  background-color: var(--color-neutral-gray-100);
  border-bottom-color: var(--color-neutral-gray-200);
}

.theme-topbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.theme-mobile-menu-btn {
  display: none;
  margin-right: 0.5rem;
}

.theme-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-neutral-gray-900);
  margin: 0;
}

.dark .theme-title {
  color: var(--color-neutral-gray-200);
}

.theme-topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-topbar-version {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-neutral-gray-600);
  white-space: nowrap;
  pointer-events: none;
}

.dark .theme-topbar-version {
  color: var(--color-neutral-gray-500);
}

.theme-content {
  flex: 1;
  padding: 1.5rem;
  background-color: var(--color-neutral-gray-50);
}

.dark .theme-content {
  background-color: var(--color-neutral-gray-50);
}

/* =============================================================================
   NAVIGATION COMPONENTS
   ============================================================================= */

.theme-nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
  text-decoration: none;
  width: 100%;
  padding: 0.5rem 0.75rem;
  transition: background-color var(--transition-fast) var(--transition-timing);
  border-radius: 0;
  position: relative;
  font-size: 0.875rem;
}

.theme-nav-item:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.theme-nav-item.active {
  background-color: rgba(255, 255, 255, 0.2);
  font-weight: 600;
}

.theme-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: white;
  border-radius: 0 2px 2px 0;
}

.theme-nav-icon {
  width: 1.75rem;
  height: 1.75rem;
  padding-left: 0.75rem;
  flex-shrink: 0;
}

/* =============================================================================
   BUTTON COMPONENTS
   ============================================================================= */

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast) var(--transition-timing);
  gap: 0.5rem;
  min-height: 2.5rem;
}

.theme-btn-primary {
  background-color: var(--color-primary-teal);
  color: white;
}

.theme-btn-primary:hover {
  background-color: var(--color-primary-blue);
}

.theme-btn-secondary {
  background-color: var(--color-neutral-gray-200);
  color: var(--color-neutral-gray-800);
}

.dark .theme-btn-secondary {
  background-color: var(--color-neutral-gray-700);
  color: var(--color-neutral-gray-200);
}

.theme-btn-secondary:hover {
  background-color: var(--color-neutral-gray-300);
}

.dark .theme-btn-secondary:hover {
  background-color: var(--color-neutral-gray-600);
}

.theme-btn-danger {
  background-color: var(--color-danger);
  color: white;
}

.theme-btn-danger:hover {
  background-color: #DC2626;
}

/* =============================================================================
   CARD COMPONENTS
   ============================================================================= */

.theme-card {
  background-color: var(--color-neutral-white);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  border: 1px solid var(--color-neutral-gray-200);
}

.dark .theme-card {
  background-color: var(--color-neutral-gray-100);
  border-color: var(--color-neutral-gray-200);
}

.theme-card-header {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-neutral-gray-200);
}

.dark .theme-card-header {
  border-bottom-color: var(--color-neutral-gray-200);
}

.theme-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-neutral-gray-900);
  margin: 0;
}

.dark .theme-card-title {
  color: var(--color-neutral-gray-200);
}

.theme-card-subtitle {
  font-size: 0.875rem;
  color: var(--color-neutral-gray-500);
  margin: 0.25rem 0 0;
}

/* =============================================================================
   TABLE COMPONENTS
   ============================================================================= */

.theme-table {
  width: 100%;
  border-collapse: collapse;
}

.theme-table thead {
  background-color: var(--color-neutral-gray-50);
}

.dark .theme-table thead {
  background-color: var(--color-neutral-gray-50);
}

.theme-table th {
  color: var(--color-neutral-gray-700);
  font-weight: 600;
}

.dark .theme-table th {
  color: var(--color-neutral-gray-400);
}

.theme-table td {
  color: var(--color-neutral-gray-800);
}

.dark .theme-table td {
  color: var(--color-neutral-gray-300);
}

.theme-table tbody tr {
  border-bottom: 1px solid var(--color-neutral-gray-200);
  transition: background-color var(--transition-fast);
}

.dark .theme-table tbody tr {
  border-bottom-color: var(--color-neutral-gray-200);
}

.theme-table tbody tr:hover {
  background-color: var(--color-neutral-gray-50);
}

.dark .theme-table tbody tr:hover {
  background-color: var(--color-neutral-gray-50);
}

/* =============================================================================
   FORM COMPONENTS
   ============================================================================= */

.theme-form-group {
  margin-bottom: 1rem;
}

.theme-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.theme-form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--color-neutral-gray-700);
}

.dark .theme-form-label {
  color: var(--color-neutral-gray-400);
}

.theme-form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-neutral-gray-300);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: border-color var(--transition-fast) var(--transition-timing);
  background-color: var(--color-neutral-white);
  color: var(--color-neutral-gray-900);
}

.dark .theme-form-input {
  background-color: var(--color-neutral-gray-100);
  border-color: var(--color-neutral-gray-300);
  color: var(--color-neutral-gray-200);
}

.theme-form-input:focus {
  outline: none;
  border-color: var(--color-primary-blue);
  box-shadow: 0 0 0 3px rgba(11, 135, 147, 0.1);
}

/* Alias for consistency with templates that use theme-input */
.theme-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-neutral-gray-300);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: border-color var(--transition-fast) var(--transition-timing);
  background-color: var(--color-neutral-white);
  color: var(--color-neutral-gray-900);
}
.theme-input:focus {
  outline: none;
  border-color: var(--color-primary-blue);
  box-shadow: 0 0 0 3px rgba(11, 135, 147, 0.1);
}

/* Form actions: submit/cancel button row (EasyHR standard) */
.theme-form-actions {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-neutral-gray-200);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Hint text under form fields */
.theme-form-note {
  color: var(--color-neutral-gray-500);
  font-size: 0.75rem;
  display: block;
  margin-top: 0.25rem;
}

/* Collapsible help section (EasyHR style) */
.theme-help-card .theme-card-header {
  user-select: none;
}
.theme-help-card .theme-help-card-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}
.theme-help-card .theme-help-card-title svg {
  flex-shrink: 0;
}
.theme-help-card-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-primary, #0b8793);
}
.theme-help-card-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}
.theme-help-card-content ul {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}
.theme-help-card-content li {
  margin-bottom: 0.5rem;
}
.theme-help-card-tip {
  padding: 1rem;
  background: rgba(11, 135, 147, 0.08);
  border-radius: 0.375rem;
  border-left: 4px solid var(--color-primary, #0b8793);
  margin-top: 1rem;
}
.theme-help-card-tip p:last-child { margin-bottom: 0; }
.theme-help-card-tip p:first-child { margin-top: 0; font-weight: 600; margin-bottom: 0.5rem; }

/* Deal documents: truncate long file names so action buttons stay on one line */
.deal-doc-filename {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* =============================================================================
   DASHBOARD LAYOUT HELPERS
   ============================================================================= */

.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* =============================================================================
   ALERT COMPONENTS
   ============================================================================= */

.theme-alert {
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  border: 1px solid;
  font-size: 0.875rem;
}

.theme-alert-success {
  background-color: rgba(16, 185, 129, 0.1);
  border-color: var(--color-success);
  color: var(--color-success);
}

/* Notifications bell – no border, just the icon */
#notifications-btn.theme-toggle-btn,
.theme-notifications .theme-toggle-btn {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0.25rem;
  min-height: auto;
  color: inherit;
}
#notifications-btn.theme-toggle-btn:hover,
.theme-notifications .theme-toggle-btn:hover {
  background: var(--color-neutral-gray-100);
  border-radius: 0.375rem;
}

/* Notifications dropdown */
.theme-notifications {
  position: relative;
}
.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  font-size: 0.7rem;
  line-height: 1.25rem;
  text-align: center;
  background: var(--color-danger);
  color: var(--color-neutral-white);
  border-radius: 9999px;
}
.theme-notifications-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  min-width: 320px;
  max-width: 400px;
  max-height: 400px;
  overflow: hidden;
  background: var(--color-neutral-white);
  border: 1px solid var(--color-neutral-gray-200);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}
.theme-notifications-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-neutral-gray-200);
  font-weight: 600;
  font-size: 0.875rem;
}
#notifications-list {
  max-height: 320px;
  overflow-y: auto;
}
.theme-notification-item {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-neutral-gray-100);
  color: var(--color-neutral-gray-800);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 0.15s;
}
.theme-notification-item:hover {
  background: var(--color-neutral-gray-50);
}
.theme-notification-body {
  font-size: 0.8rem;
  color: var(--color-neutral-gray-600);
}
.theme-notification-time {
  font-size: 0.75rem;
  color: var(--color-neutral-gray-500);
}
.theme-notification-empty {
  padding: 1rem;
  text-align: center;
  color: var(--color-neutral-gray-500);
  font-size: 0.875rem;
}

/* User menu dropdown */
.theme-user-menu .theme-user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.25rem;
  min-width: 160px;
  background: var(--color-neutral-white);
  border: 1px solid var(--color-neutral-gray-200);
  border-radius: 0.375rem;
  box-shadow: var(--shadow-md);
  z-index: 1001;
  padding: 0.25rem 0;
}
.theme-user-dropdown-item {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--color-neutral-gray-800);
  text-decoration: none;
}
.theme-user-dropdown-item:hover {
  background: var(--color-neutral-gray-50);
}
.theme-user-menu-btn:hover {
  opacity: 0.9;
}

/* =============================================================================
   MOBILE / PORTRAIT RESPONSIVENESS
   ============================================================================= */
@media (max-width: 768px) {
  .theme-mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .theme-content {
    padding: 1rem;
    min-width: 0;
    overflow-x: hidden;
  }

  .theme-topbar-content {
    gap: 0.5rem;
  }

  .theme-topbar-version {
    display: none;
  }

  .theme-title {
    font-size: 1.15rem;
    line-height: 1.3;
  }

  .theme-topbar-actions {
    gap: 0.5rem;
  }

  .dashboard-stats-grid {
    grid-template-columns: 1fr;
  }

  .theme-form {
    gap: 0.5rem !important;
  }

  .theme-form-group {
    min-width: 0;
    width: 100%;
  }

  .theme-form-input,
  .theme-btn {
    min-height: 42px;
  }

  .theme-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  .theme-notifications-dropdown {
    right: 0;
    left: auto;
    min-width: min(92vw, 360px);
    max-width: min(92vw, 360px);
  }

  .theme-user-name {
    display: none;
  }
}

