/* ==========================================
   BF Portal — Base CSS: Variables & Typography
   ========================================== */

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

:root {
  /* Colors */
  --color-primary:       #4f6ef7;
  --color-primary-dark:  #3a57d9;
  --color-primary-light: #eef1fd;
  --color-secondary:     #6c757d;
  --color-success:       #28c76f;
  --color-warning:       #ff9f43;
  --color-danger:        #ea5455;
  --color-info:          #00cfe8;

  /* Sidebar */
  --sidebar-bg:          #1a1d2e;
  --sidebar-bg-light:    #232641;
  --sidebar-text:        #a8aabc;
  --sidebar-text-active: #ffffff;
  --sidebar-accent:      #4f6ef7;
  --sidebar-width:       260px;

  /* Layout */
  --body-bg:             #f5f6fa;
  --card-bg:             #ffffff;
  --input-bg:            #ffffff;
  --input-bg-disabled:   #f0f1f7;
  --surface-muted:       #f8f9ff;
  --surface-soft:        #fafbfe;
  --surface-subtle:      #f0f1f7;
  --surface-subtle-hover:#e4e5f0;
  --btn-primary-bg:      #4f6ef7;
  --btn-primary-bg-hover:#3a57d9;
  --btn-primary-text:    #ffffff;
  --btn-primary-border:  transparent;
  --btn-primary-shadow:  0 4px 12px rgba(79,110,247,.35);
  --border-color:        #e8eaf0;
  --border-radius:       12px;
  --border-radius-sm:    8px;
  --border-radius-lg:    16px;

  /* Typography */
  --font-body:           'Inter', sans-serif;
  --font-heading:        'Raleway', sans-serif;
  --text-primary:        #2d3154;
  --text-secondary:      #6e6b7b;
  --text-muted:          #9e9ea7;

  /* Shadows */
  --shadow-sm:   0 2px 8px rgba(0,0,0,.06);
  --shadow-md:   0 4px 20px rgba(0,0,0,.08);
  --shadow-lg:   0 8px 30px rgba(0,0,0,.12);
  --shadow-card: 0 2px 12px rgba(79,110,247,.08);

  /* Transitions */
  --transition: all .2s ease;
}

[data-theme='dark'] {
  --color-primary: #7f98ff;
  --color-primary-dark: #5d7fff;
  --color-primary-light: rgba(127, 152, 255, 0.16);
  --body-bg: #101522;
  --card-bg: #1a2133;
  --input-bg: #131b2c;
  --input-bg-disabled: #232d42;
  --surface-muted: #1f2738;
  --surface-soft: #182133;
  --surface-subtle: #263249;
  --surface-subtle-hover: #30405c;
  --btn-primary-bg: #5d73d0;
  --btn-primary-bg-hover: #4f64bb;
  --btn-primary-text: #eef3ff;
  --btn-primary-border: rgba(183, 199, 255, 0.28);
  --btn-primary-shadow: 0 6px 16px rgba(9, 13, 26, 0.45);
  --border-color: #2b344b;
  --text-primary: #ecf1ff;
  --text-secondary: #c8d1e8;
  --text-muted: #9faccc;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.32);
  --shadow-card: 0 4px 14px rgba(0, 0, 0, 0.26);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; }

body {
  font-family: var(--font-body);
  background: var(--body-bg);
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-primary);
}

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

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c8cad8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0a3bb; }

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

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .3s ease;
}

.page-content {
  flex: 1;
  padding: 28px 32px;
}

/* ---- Page Header ---- */
.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.page-header .breadcrumb {
  font-size: .8rem;
  color: var(--text-muted);
}

/* ---- Utility ---- */
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: 1rem; }

/* ---- Messages ---- */
.messages-container {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 9999;
  max-width: 360px;
}

.alert {
  border: none;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-md);
  font-size: .875rem;
}

/* ---- Auth Layout ---- */
.auth-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1d2e 0%, #2d3154 50%, #1a1d2e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: #fff;
  border-radius: var(--border-radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo .logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: 14px;
  margin-bottom: 16px;
}

.auth-logo .logo-mark svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

.auth-logo h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.auth-logo p {
  color: var(--text-muted);
  font-size: .875rem;
  margin: 0;
}

.auth-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: .875rem;
  margin-bottom: 28px;
}

/* ---- Form Controls ---- */
.form-label {
  font-weight: 500;
  font-size: .875rem;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  display: block;
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: .625rem 1rem;
  font-size: .9rem;
  background: var(--input-bg);
  color: var(--text-primary);
  caret-color: var(--text-primary);
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79,110,247,.12);
  outline: none;
}

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

.form-select {
  width: 100%;
  display: block;
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: .625rem 1rem;
  font-size: .9rem;
  background: var(--input-bg);
  color: var(--text-primary);
  transition: var(--transition);
}

.form-control:disabled,
.form-select:disabled {
  background: var(--input-bg-disabled);
  color: var(--text-muted);
}

.form-select option {
  background: var(--input-bg);
  color: var(--text-primary);
}

.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79,110,247,.12);
}

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

/* ---- Buttons ---- */
.btn {
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  font-size: .875rem;
  padding: .5rem 1.25rem;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: 1px solid var(--btn-primary-border);
}
.btn-primary:hover {
  background: var(--btn-primary-bg-hover);
  color: var(--btn-primary-text);
  transform: translateY(-1px);
  box-shadow: var(--btn-primary-shadow);
}

.btn-secondary {
  background: var(--surface-subtle);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--surface-subtle-hover);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}
.btn-ghost:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.btn-success {
  background: var(--color-success);
  color: #fff;
}
.btn-success:hover {
  background: #20a559;
  color: #fff;
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--color-warning);
  color: #fff;
}
.btn-warning:hover { background: #e8892a; color: #fff; }

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover { background: #d23b3b; color: #fff; }

.btn-sm {
  padding: .35rem .9rem;
  font-size: .8rem;
}

.btn-lg {
  padding: .75rem 1.75rem;
  font-size: 1rem;
}

.btn-block { width: 100%; justify-content: center; }

/* ---- Divider ---- */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: .8rem;
  margin: 20px 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .main-content { margin-left: 0; }
  .page-content { padding: 20px 16px; }
  .auth-card { padding: 32px 24px; }
}
