/* ============================================================
   Talentport Team Portal — Styles
   Brand: Golden Yellow #F5C800 | Black #000000 | White #FFFFFF
   ============================================================ */

:root {
  --yellow: #F5C800;
  --yellow-dark: #D9B000;
  --black: #000000;
  --white: #FFFFFF;
  --grey-50: #FAFAFA;
  --grey-100: #F1F1F1;
  --grey-200: #E4E4E4;
  --grey-400: #9A9A9A;
  --grey-600: #555555;
  --grey-900: #1A1A1A;
  --success: #22C55E;
  --warning: #F97316;
  --error: #EF4444;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  color: var(--black);
  background: var(--white);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.hidden { display: none !important; }

.view { display: none; }
.view.active { display: block; }

/* ============================================================
   LOGO
   ============================================================ */
.logo,
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-dot {
  width: 10px;
  height: 10px;
  background: var(--yellow);
  border-radius: 2px;
  display: inline-block;
}

.logo-dot.small {
  width: 6px;
  height: 6px;
}

.logo {
  justify-content: center;
  margin-bottom: 8px;
}

.logo-text,
.brand-text {
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.02em;
  margin-left: 4px;
}

.brand-text { font-size: 18px; }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
#view-login {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--grey-50);
  padding: 24px;
}

#view-login.active {
  display: flex;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.tagline {
  color: var(--grey-600);
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 32px;
}

.login-blurb {
  color: var(--grey-600);
  margin-bottom: 24px;
  font-size: 15px;
}

#g_id_signin {
  display: flex;
  justify-content: center;
  margin: 24px 0 8px;
}

.error-text {
  color: var(--error);
  font-size: 14px;
  margin-top: 16px;
  min-height: 20px;
}

/* ============================================================
   APP SHELL
   ============================================================ */
#app-shell:not(.hidden) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-nav {
  display: flex;
  gap: 4px;
}

.nav-item {
  padding: 8px 16px;
  border-radius: var(--radius);
  color: var(--grey-600);
  font-weight: 500;
  font-size: 14px;
  transition: all 0.15s;
}

.nav-item:hover {
  background: var(--grey-100);
  color: var(--black);
}

.nav-item.active {
  background: var(--black);
  color: var(--white);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
}

.btn-ghost {
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--grey-600);
  transition: all 0.15s;
}

.btn-ghost:hover {
  background: var(--grey-100);
  color: var(--black);
}

.app-main {
  flex: 1;
  padding: 40px 32px;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}

/* ============================================================
   HOME VIEW
   ============================================================ */
.greeting {
  margin-bottom: 32px;
}

.greeting h2 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.greeting-date {
  color: var(--grey-600);
  margin-top: 4px;
}

.clock-panel {
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.clock-panel::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 200px;
  height: 200px;
  background: var(--yellow);
  border-radius: 50%;
  opacity: 0.15;
}

.clock-status {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--grey-400);
  flex-shrink: 0;
}

.status-dot.working { background: var(--success); animation: pulse 2s infinite; }
.status-dot.break { background: var(--warning); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-label {
  font-size: 12px;
  color: var(--grey-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-value {
  font-size: 20px;
  font-weight: 600;
  margin-top: 2px;
}

.clock-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--yellow);
  color: var(--black);
  padding: 14px 28px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 15px;
  transition: all 0.15s;
  letter-spacing: -0.01em;
}

.btn-primary:hover {
  background: var(--yellow-dark);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--white);
  color: var(--black);
  padding: 14px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  transition: all 0.15s;
}

.btn-secondary:hover { background: var(--grey-100); transform: translateY(-1px); }

.btn-warning {
  background: rgba(255,255,255,0.1);
  color: var(--white);
  padding: 14px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 15px;
  border: 1px solid rgba(255,255,255,0.2);
  transition: all 0.15s;
}

.btn-warning:hover { background: rgba(255,255,255,0.2); }

.clock-message {
  margin-top: 16px;
  font-size: 14px;
  color: var(--grey-400);
  min-height: 20px;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.panel {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.panel h3 {
  font-size: 13px;
  color: var(--grey-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  font-weight: 600;
}

.big-number {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ============================================================
   FORMS
   ============================================================ */
h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.subtle {
  color: var(--grey-600);
  font-size: 14px;
  margin-bottom: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 720px;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.form-section {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--grey-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-top: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--grey-200);
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-grid label.full-width {
  grid-column: 1 / -1;
}

.form-grid label span {
  font-size: 13px;
  font-weight: 600;
  color: var(--grey-600);
}

.form-grid input,
.form-grid select {
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--white);
  transition: border-color 0.15s;
}

.form-grid input:focus,
.form-grid select:focus {
  outline: none;
  border-color: var(--black);
}

.form-grid input:disabled {
  background: var(--grey-100);
  color: var(--grey-600);
  cursor: not-allowed;
}

.form-grid button[type="submit"] {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 8px;
}

.form-grid button.full-width {
  justify-self: stretch;
}

.form-message {
  grid-column: 1 / -1;
  font-size: 14px;
  min-height: 20px;
}

.form-message.success { color: var(--success); }
.form-message.error { color: var(--error); }

/* ============================================================
   HISTORY TABLE
   ============================================================ */
.history-table {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border-collapse: collapse;
  margin-top: 16px;
}

.history-table th,
.history-table td {
  padding: 12px 20px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid var(--grey-100);
}

.history-table th {
  background: var(--grey-50);
  font-weight: 600;
  color: var(--grey-600);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-table tr:last-child td { border-bottom: none; }

.history-table .event-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--grey-100);
}

.history-table .event-pill.clock_in { background: rgba(34,197,94,0.15); color: #15803D; }
.history-table .event-pill.clock_out { background: rgba(239,68,68,0.15); color: #B91C1C; }
.history-table .event-pill.break_start,
.history-table .event-pill.break_end { background: rgba(249,115,22,0.15); color: #C2410C; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}

.toast.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { background: var(--error); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* ============================================================
   DATA TABLES & SHARED COMPONENTS (Week 2+)
   ============================================================ */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.table-wrap {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin-bottom: 24px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--grey-100);
  vertical-align: top;
}

.data-table th {
  background: var(--grey-50);
  font-weight: 600;
  color: var(--grey-600);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table .truncate {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table a.link {
  color: var(--black);
  font-weight: 600;
  border-bottom: 1px dashed var(--grey-400);
}

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--grey-100);
  color: var(--grey-600);
}

.pill.status-active,
.pill.status-approved,
.pill.status-paid,
.pill.status-done { background: rgba(34,197,94,0.15); color: #15803D; }

.pill.status-pending,
.pill.status-pending_onboarding,
.pill.status-draft,
.pill.status-todo { background: rgba(245,200,0,0.25); color: #7A5E00; }

.pill.status-paused,
.pill.status-blocked,
.pill.status-in_progress { background: rgba(249,115,22,0.15); color: #C2410C; }

.pill.status-rejected,
.pill.status-ended,
.pill.status-inactive { background: rgba(239,68,68,0.15); color: #B91C1C; }

.pill.status-reviewed { background: rgba(59,130,246,0.15); color: #1E40AF; }

.pill.status-owner { background: var(--black); color: var(--yellow); }
.pill.status-admin { background: rgba(0,0,0,0.08); color: var(--black); }
.pill.status-member { background: var(--grey-100); color: var(--grey-600); }

.panel-action {
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--grey-200);
  background: var(--white);
  transition: all 0.15s;
}
.panel-action:hover {
  border-color: var(--black);
  transform: translateY(-1px);
}

/* KANBAN */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kanban-col {
  background: var(--grey-50);
  border-radius: var(--radius-lg);
  padding: 16px;
  min-height: 200px;
}

.kanban-col h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--grey-600);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
}

.kanban-col .count {
  background: var(--white);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  color: var(--grey-600);
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card {
  background: var(--white);
  border-left: 3px solid var(--grey-400);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.1s;
}
.task-card:hover { transform: translateY(-1px); }
.task-card.priority-high { border-left-color: var(--warning); }
.task-card.priority-urgent { border-left-color: var(--error); }
.task-card.priority-low { border-left-color: var(--grey-400); }
.task-card.priority-medium { border-left-color: var(--yellow); }

.task-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}

.task-meta {
  font-size: 12px;
  color: var(--grey-600);
}

.task-meta .pill {
  font-size: 11px;
  padding: 1px 8px;
}

.btn-mini {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--black);
  color: var(--yellow);
  transition: all 0.1s;
  margin-right: 4px;
}
.btn-mini:hover { background: var(--grey-900); }
.btn-mini.btn-reject { background: rgba(239,68,68,0.15); color: #B91C1C; }
.btn-mini.btn-reject:hover { background: rgba(239,68,68,0.25); }

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 50;
  overflow-y: auto;
}

.modal.hidden { display: none; }

.modal-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  max-width: 720px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--grey-100);
}

.modal-header h2 {
  font-size: 20px;
  margin: 0;
}

.modal-body {
  padding: 24px 28px 28px;
}

.modal-body .form-grid {
  padding: 0;
  border: none;
  background: transparent;
}

.modal-body textarea {
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 15px;
  resize: vertical;
}
.modal-body textarea:focus { outline: none; border-color: var(--black); }

#modal-close {
  font-size: 24px;
  line-height: 1;
  padding: 4px 12px;
}

/* ROLE-BASED VISIBILITY */
body.role-member .admin-only,
body.role-member .owner-only { display: none !important; }
body.role-admin .owner-only { display: none !important; }

/* TEAM STATUS GRID (Home page, admin+) */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.status-card {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 14px 16px;
  border-left: 4px solid var(--grey-400);
}
.status-card.status-working { border-left-color: var(--success); }
.status-card.status-on_break { border-left-color: var(--warning); }
.status-card.status-clocked_out { border-left-color: var(--grey-400); }
.status-card.status-not_started { border-left-color: var(--grey-200); opacity: 0.7; }

.status-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.status-dot-sm {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grey-400);
  flex-shrink: 0;
}
.status-dot-sm.status-working { background: var(--success); animation: pulse 2s infinite; }
.status-dot-sm.status-on_break { background: var(--warning); }

.status-name { font-weight: 600; font-size: 14px; }

.status-label-sm {
  font-size: 12px;
  color: var(--grey-600);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 4px 0 2px;
}

.status-time { font-size: 11px; color: var(--grey-600); }

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

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

@media (max-width: 720px) {
  .app-header {
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    align-items: stretch;
  }

  .brand {
    justify-content: center;
  }

  /* Horizontal scrolling nav with snap for mobile */
  .app-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding: 4px;
    scrollbar-width: none;
  }
  .app-nav::-webkit-scrollbar { display: none; }

  .nav-item {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 14px;
  }

  .user-menu {
    justify-content: space-between;
    padding: 0 4px;
  }

  .app-main { padding: 20px 12px; }

  .view-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .view-header .btn-primary,
  .view-header .btn-ghost { width: 100%; }

  .clock-panel { padding: 24px 20px; }
  .clock-panel .big-number { font-size: 24px; }
  .clock-actions { flex-direction: column; }
  .clock-actions button { width: 100%; }

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

  .form-grid {
    grid-template-columns: 1fr;
    padding: 20px;
  }
  .form-grid button[type="submit"] { width: 100%; }

  .greeting h2 { font-size: 24px; }
  h2 { font-size: 22px; line-height: 1.25; }

  /* Tables scroll horizontally; the wrap is already overflow-x:auto */
  .data-table { font-size: 13px; }
  .data-table th,
  .data-table td { padding: 10px 12px; }

  /* Kanban: single column and scrolls vertically */
  .kanban { gap: 12px; }
  .kanban-col { min-height: auto; }

  /* Status grid */
  .status-grid { grid-template-columns: 1fr 1fr; gap: 8px; }

  /* Modal — full screen on small */
  .modal { padding: 0; align-items: stretch; }
  .modal-card { border-radius: 0; min-height: 100vh; }
  .modal-header { padding: 16px 20px; position: sticky; top: 0; background: var(--white); z-index: 2; border-bottom: 1px solid var(--grey-100); }
  .modal-body { padding: 20px; }

  /* Bigger touch targets */
  .btn-primary,
  .btn-secondary,
  .btn-warning { padding: 14px 20px; font-size: 15px; }
  .btn-mini { padding: 8px 12px; font-size: 13px; }

  /* Login card */
  .login-card { padding: 32px 24px; }
}

@media (max-width: 480px) {
  .status-grid { grid-template-columns: 1fr; }
  .logo-text { font-size: 22px; }
  .brand-text { font-size: 16px; }
}
