/**
 * Common styles for the internal forms platform.
 * Provides base layout, auth UI, navigation, and shared component styles.
 * Individual forms can extend/override via their own stylesheets.
 */

/* ===== CSS Variables ===== */
:root {
  --primary: #1a237e;
  --primary-light: #283593;
  --primary-bg: #e8eaf6;
  --success: #2e7d32;
  --success-bg: #e8f5e9;
  --error: #c62828;
  --error-bg: #ffebee;
  --warning: #f57c00;
  --warning-bg: #fff3e0;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #eeeeee;
  --gray-300: #e0e0e0;
  --gray-400: #bdbdbd;
  --gray-600: #757575;
  --gray-800: #424242;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
  --transition: 0.2s ease;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  direction: rtl;
  text-align: right;
  background: var(--gray-100);
  color: #333;
  line-height: 1.7;
  min-height: 100vh;
}

/* ===== Top Bar / Auth Header ===== */
.auth-bar {
  background: var(--primary);
  color: white;
  padding: 0.6rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.auth-bar__logo {
  height: 32px;
  margin-inline-end: 0.75rem;
}

.auth-bar__user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.auth-bar__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.auth-bar__name {
  font-weight: 500;
}

.auth-bar__btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  transition: background var(--transition);
}

.auth-bar__btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ===== Login Screen ===== */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 2rem;
  text-align: center;
}

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

.login-screen__title {
  color: var(--primary);
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
}

.login-screen__subtitle {
  color: var(--gray-600);
  font-size: 0.93rem;
  margin-bottom: 2rem;
}

.login-screen__btn {
  display: inline-block;
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.85rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  width: 100%;
}

.login-screen__btn:hover {
  background: var(--primary-light);
}

/* ===== Layout Container ===== */
.page-container {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ===== Loading Spinner ===== */
.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-300);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== Cards ===== */
.card {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.card__title {
  color: var(--primary);
  font-size: 1.2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-200);
}

/* ===== Buttons ===== */
.btn {
  display: block;
  width: 100%;
  padding: 0.9rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.btn--primary {
  background: var(--primary);
  color: white;
}
.btn--primary:hover:not(:disabled) { background: var(--primary-light); }

.btn--success {
  background: var(--success);
  color: white;
}
.btn--success:hover:not(:disabled) { background: #1b5e20; }

.btn:disabled {
  background: var(--gray-400);
  cursor: not-allowed;
}

.btn--outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn--outline:hover:not(:disabled) {
  background: var(--primary-bg);
}

/* ===== Forms / Inputs ===== */
.form-field {
  margin-bottom: 1.25rem;
}

.form-field__label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}

.form-field__input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--gray-400);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  direction: rtl;
  transition: border-color var(--transition);
}

.form-field__input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}

.form-field__error {
  color: var(--error);
  font-size: 0.83rem;
  margin-top: 0.3rem;
}

/* ===== Alerts ===== */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert--success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}

.alert--error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error);
}

.alert--warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-right: 3px solid var(--warning);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .page-container { padding: 1rem; }
  .card { padding: 1.25rem; }
  .auth-bar { padding: 0.5rem 1rem; font-size: 0.82rem; }
}
