/* global_worqrs.css — Worqt HRIS
   Mobile-first, collapsible sidebar, light/dark theme
   Optimized 2025 version
*/

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

/* -------------------------------------------------
   WORQT THEME VARIABLES
   Dark Mode = default
   Light Mode overrides below
-------------------------------------------------- */

:root {
  /* Brand */
  --primary: #3A47F4;
  --primary-hover: #323EE0;
  --primary-active: #2833C4;

  /* DARK MODE DEFAULTS */
  --bg: #0D0F1A;
  --surface: #1A1D2C;
  --surface-2: #24283A;
  --surface-3: #2A2F44;
  --surface-4: #323853;
  --surface-5: #3A4163;

  --card-bg: var(--surface);

  --text: #F2F3F7;
  --text-strong: #ffffff;
  --text-muted: #8D93A6;

  --border: #2A2D3C;
  --border-strong: #3A3F54;

  --success: #26C281;
  --danger:  #E25555;
  --warning: #F6C544;

  --radius: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,0.3);
  --transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* LIGHT MODE OVERRIDES */
[data-theme="light"] {
  --bg: #F8F9FC;
  --surface: #FFFFFF;
  --surface-2: #F1F3F5;
  --surface-3: #F3F4F6;
  --surface-4: #E5E7EB;
  --surface-5: #D1D5DB;

  --card-bg: var(--surface);

  --text: #11131C;
  --text-strong: #000000;
  --text-muted: #6B7280;

  --border: #E1E4EC;
  --border-strong: #C6CBD9;

  --shadow: 0 8px 32px rgba(0,0,0,0.08);
}

/* -------------------------------------------------
   BASE
-------------------------------------------------- */

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  transition: var(--transition);
}

.container {
  max-width: 100%;
  padding: 1rem;
}

@media (min-width: 768px) {
  .container {
    max-width: 1200px;
    margin: 0 auto;
  }
}

/* -------------------------------------------------
   CARDS & PANELS
-------------------------------------------------- */

.card,
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: var(--transition);
}

/* .card:hover,
.panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
} */

/* Optional wrapper */
.page-content {
  padding: 0.5rem 0;
}

/* -------------------------------------------------
   GRID & FORMS
-------------------------------------------------- */

.grid-4 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.form-group { margin-bottom: 1rem; }

label {
  display: block;
  margin-bottom: .5rem;
  font-weight: 500;
  color: var(--text);
}

input,
select,
textarea {
  width: 100%;
  padding: .875rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(58, 71, 244, .2);
}

/* Form grid layout */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-grid > div { grid-column: span 2; }
.form-grid > div.half { grid-column: span 1; }

@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid > div,
  .form-grid > div.half {
    grid-column: span 1;
  }
}

/* -------------------------------------------------
   ALERTS
-------------------------------------------------- */

.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: .9rem;
}

.alert-success {
  background: rgba(38, 194, 129, .15);
  color: var(--success);
  border: 1px solid rgba(38, 194, 129, .3);
}

.alert-error {
  background: rgba(226, 85, 85, .15);
  color: var(--danger);
  border: 1px solid rgba(226, 85, 85, .3);
}

/* -------------------------------------------------
   SIDEBAR & MAIN LAYOUT
-------------------------------------------------- */

.sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  transition: width .3s ease;
}

.sidebar.collapsed {
  width: 70px;
  padding: 1.5rem 0;
}

.sidebar.collapsed .sidebar-header .logo,
.sidebar.collapsed .nav-item span {
  display: none;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: .75rem 0;
}

.sidebar.collapsed .nav-item i {
  font-size: 1.2rem;
}

/* Collapse toggle pill */
.collapse-toggle {
  position: absolute;
  right: -12px;
  top: 1.5rem;
  width: 24px;
  height: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .8rem;
  color: var(--text-muted);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
  z-index: 1001;
  transition: var(--transition);
}
.collapse-toggle:hover {
  color: var(--primary);
  transform: scale(1.1);
}

.main-content {
  margin-left: 260px;
  transition: margin-left .3s ease;
  padding: 1rem;
  min-height: 100vh;
}
.main-content.expanded {
  margin-left: 70px;
}

/* Mobile auto-collapse */
@media (max-width: 1024px) {
  .sidebar {
    width: 70px;
    padding: 1.5rem 0;
  }
  .sidebar .logo,
  .sidebar .nav-item span {
    display: none;
  }
  .sidebar .nav-item {
    justify-content: center;
    padding: .75rem 0;
  }
  .main-content {
    margin-left: 70px;
  }
  .collapse-toggle {
    display: none;
  }
}

/* Mobile menu button */
.menu-toggle {
  display: flex;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text);
  cursor: pointer;
  padding: .5rem;
}
@media (min-width: 1024px) {
  .menu-toggle { display: none; }
}

/* -------------------------------------------------
   HEADER
-------------------------------------------------- */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 1rem;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.header {
    position: sticky;
    top: 0;
    z-index: 900;
    background: var(--page-bg);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}


/* -------------------------------------------------
   THEME TOGGLE
-------------------------------------------------- */

.theme-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  width: 48px;
  height: 28px;
  border-radius: 14px;
  position: relative;
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: var(--primary);
  border-radius: 50%;
  transition: transform .3s ease, background .3s ease;
}

/* When in light mode, move the toggle knob + change color */
[data-theme="light"] .theme-toggle::after {
  transform: translateX(20px);
  background: #F6C544; /* Yellow sun pill */
}

/* -------------------------------------------------
   NAVIGATION
-------------------------------------------------- */

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.5rem;
  color: var(--text);
  text-decoration: none;
  transition: var(--transition);
}

.nav-item i {
  width: 20px;
  text-align: center;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(58, 71, 244, .15);
  color: var(--primary);
}

/* Task badge in nav */
.task-badge {
  background: #e53e3e;
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 8px;
  display: inline-block;
}

/* Overdue Task Styling */
.row-overdue td {
    background: rgba(229, 57, 53, 0.12) !important; /* subtle red */
}

[data-theme="dark"] .row-overdue td {
    background: rgba(229, 57, 53, 0.18) !important;
}

/* Overdue Badge */
.badge-overdue {
    background: rgba(229, 57, 53, .2);
    color: var(--danger);
    padding: .25rem .6rem;
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 600;
}


/* -------------------------------------------------
   BUTTON SYSTEM — WORQT UI
-------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 8px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.18s ease;
  line-height: 1.2;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Primary */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn-primary:active {
  background: var(--primary-active);
  border-color: var(--primary-active);
}

/* Secondary */
.btn-secondary {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--surface-4);
  border-color: var(--border-strong);
  color: var(--text-strong);
}
.btn-secondary:active {
  background: var(--surface-5);
}

/* Light / Ghost */
.btn-light {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-light:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-light:active {
  background: var(--surface-4);
}

/* Success */
.btn-success {
  background: #2E9B5E;
  border-color: #2E9B5E;
  color: #fff;
}
.btn-success:hover {
  background: #278D53;
  border-color: #278D53;
}
.btn-success:active {
  background: #207A47;
}

/* Danger */
.btn-danger {
  background: #E53935;
  border-color: #E53935;
  color: #fff;
}
.btn-danger:hover {
  background: #D32F2F;
  border-color: #D32F2F;
}
.btn-danger:active {
  background: #B71C1C;
}

/* Small */
.btn-small {
  padding: 5px 10px;
  font-size: 0.75rem;
  border-radius: 6px;
}

/* Icon buttons */
.btn-icon {
  padding: 6px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.btn-icon:hover {
  background: var(--surface-3);
}

/* Theme-aware button overrides (explicit, for clarity) */
[data-theme="light"] .btn-secondary {
  background: var(--surface-3);
  color: var(--text);
}
[data-theme="light"] .btn-secondary:hover {
  background: var(--surface-4);
  color: var(--text-strong);
}

[data-theme="light"] .btn-light {
  background: transparent;
  color: var(--text-muted);
}
[data-theme="light"] .btn-light:hover {
  background: var(--surface-3);
  color: var(--text);
}

[data-theme="light"] .btn-icon:hover {
  background: var(--surface-3);
}

/* -------------------------------------------------
   TABLES
-------------------------------------------------- */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: var(--surface-2);
  padding: .75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
}

tr:hover {
  background: rgba(255, 255, 255, .03);
}

/* -------------------------------------------------
   BADGES
-------------------------------------------------- */

.badge {
  padding: .25rem .75rem;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 600;
}

/* Old naming (kept for compatibility) */

.badge-success {
  background: rgba(38, 194, 129, .2);
  color: var(--success);
}

.badge-warning {
  background: rgba(246, 197, 68, .2);
  color: var(--warning);
}

.badge-danger {
  background: rgba(226, 85, 85, .2);
  color: var(--danger);
}

.badge-secondary {
  background: rgba(148, 163, 184, .25);
  color: var(--text);
}

/* -------------------------------------------------
   MODALS
-------------------------------------------------- */

.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal.active { display: flex; }

.modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

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

.modal-body {
  padding: 1.5rem;
}

.close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

/* -------------------------------------------------
   UTILITIES
-------------------------------------------------- */

.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); font-size: .9rem; }

.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 1.5rem; }

/* -------------------------------------------------
   AUTH PAGES
-------------------------------------------------- */

.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

/* Auth card */
.auth-card {
  width: 800px;
  max-width: 90%;
  background: var(--surface);
  margin: 4rem auto;
  padding: 2rem 2.5rem;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.auth-logo {
  width: 180px;
  max-width: 80%;
  display: block;
  margin: 0 auto 1rem auto;
  object-fit: contain;
}

.auth-header h1 {
  margin-top: 0.25rem;
  font-size: 1.6rem;
  font-weight: 700;
}

.auth-header p {
  margin-top: 0.25rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Wordmark logo text style (if used) */
.logo {
  font-weight: 700;
  font-size: 1.8rem;
  background: linear-gradient(90deg, #3A47F4, #7C5CFC);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
  margin-bottom: 1.5rem;
}

/* -------------------------------------------------
   AVATAR
-------------------------------------------------- */

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: .9rem;
}




.dropdown {
    position: relative;
}
.dropdown button {
    cursor: pointer;
}
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding:.25rem 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 999;
}
.dropdown:hover .dropdown-menu {
    display: block;
}
.dropdown-item {
    display: block;
    padding:.4rem .75rem;
    text-decoration:none;
    color:#333;
    font-size:.9rem;
}
.dropdown-item:hover {
    background:#f5f5f5;
}


/* UNIVERSAL BUTTON SPACING FIX */
button,
.btn,
input[type="submit"],
button[type="submit"] {
    margin-top: 14px !important;   /* space from fields above */
}


#tenantPreview {
    margin-top: 25px;
    padding: 20px 15px;
    border-radius: 12px;
    background: var(--card-muted);
    text-align: center;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#tenantLogo {
    max-height: 70px;      /* handles tall logos */
    max-width: 220px;      /* handles wide logos */
    width: auto;
    height: auto;
    object-fit: contain;    /* ensures beautiful scaling */
    margin-bottom: 10px;
}


#tenantName {
    font-weight: 600;
    font-size: 1.2rem;
    text-align: center;
    margin-top: 5px;
}


.brand-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}

#defaultLoginLogo {
    max-width: 70%;
    max-height: 60px;
    object-fit: contain;
}


/* Force 2-column forms on tablets & desktops – only collapse on real mobile */
.form-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Full-width fields that should span both columns */
.form-grid-2col .full    { grid-column: 1 / -1; }

/* On small screens (<768px) go back to single column */
@media (max-width: 767px) {
    .form-grid-2col {
        grid-template-columns: 1fr;
    }
    .form-grid-2col .full { grid-column: 1; }
}

/* ORG CHART CONTAINER */
/***********************************************
   OPTION C — CURVED SVG CONNECTOR ORG CHART
   (Modern Google / Linear-style)
***********************************************/

.org-chart {
    display: flex;
    justify-content: center;
    padding: 40px 0;
    overflow-x: auto;
}

/* Base structure */
.org-chart ul {
    display: flex;
    justify-content: center;
    gap: 60px;
    padding: 60px 0 0 0;
    margin: 0;
    list-style: none;
    position: relative;
}

.org-chart li {
    position: relative;
    text-align: center;
    list-style: none;
}

/***********************************************
   SVG CONNECTORS RENDERED BEHIND ELEMENTS
***********************************************/
.org-chart .connector {
    position: absolute;
    top: -40px; /* distance to parent */
    left: 50%;
    width: 0;
    height: 0;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 0; /* behind cards */
}

/* Connector SVG size */
.org-chart svg {
    overflow: visible;
}

/***********************************************
   ORG CARD
***********************************************/
.org-card {
    position: relative;
    z-index: 2;
    min-width: 220px;
    display: inline-block;
    padding: 1.25rem 1rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.org-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}

/***********************************************
   AVATAR
***********************************************/
.org-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 1rem;
    margin: 0 auto 10px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

/***********************************************
   TEXT STYLES
***********************************************/
.org-name {
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}
.org-name:hover {
    text-decoration: underline;
}

.org-position {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.badge {
    margin-top: 6px;
}

/* Mobile drawer open */
.sidebar.open {
    left: 0;
    width: 260px;
}

/* Main content shift when mobile menu visible */
#main-content.shifted {
    margin-left: 260px;
}

@media (max-width: 1024px) {
    .sidebar {
        left: -260px;
        position: fixed;
        width: 260px;
    }

    .sidebar.open {
        left: 0;
    }
}


/* ===========================================================
   NOTIFICATIONS — Modern Dropdown
=========================================================== */

.notif-wrapper {
    position: relative;
}

.notif-bell {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text);
    cursor: pointer;
    position: relative;
}

.notif-count {
    position: absolute;
    top: -6px;
    right: -8px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
}

.notif-dropdown {
    position: absolute;
    top: 34px;
    right: 0;
    width: 300px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    animation: fadeIn .15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.notif-dropdown.open {
    display: flex;
}

.notif-header {
    padding: 10px 12px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.notif-actions {
    display: flex;
    gap: 8px;
}

.notif-action {
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
}

.notif-list {
    max-height: 300px;
    overflow-y: auto;
}

.notif-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.notif-item.unread {
    background: rgba(58, 71, 244, 0.10);
}

.notif-item:hover {
    background: var(--surface-2);
}

.notif-message {
    font-weight: 600;
    margin-bottom: 3px;
}

.notif-date {
    color: var(--text-muted);
    font-size: 11px;
}

.notif-link {
    display: inline-block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
}

.notif-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.notif-footer {
    padding: 10px 12px;
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

.notif-view-all {
    font-size: 13px;
    color: var(--primary);
}
