root {
  --color-primary: #190576;
  --color-primary-hover: #100447;
  --color-background: #f5f5f7;
  --color-surface: #ffffff;
  --color-text-primary: #1a1a2e;
  --color-text-secondary: #5c5c9e;
  --color-border: #d1d5db;
  --color-border-light: #e5e7eb;
  --z-sidebar: 1010;
  --z-topbar: 1000;
  --z-dropdown: 999;
  --z-modal: 1050;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-primary);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.dashboard-shell {
  padding-top: 0 !important;
  margin: 0 !important;
  background: var(--color-background) !important;
  display: flex !important;
  flex-direction: row !important;
}

body.dashboard-shell * {
  box-sizing: border-box;
}

/* ============================================================================
   SIDEBAR
   ============================================================================ */

.predig-sidebar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 260px !important;
  height: 100vh !important;
  background: #190576 !important;
  display: flex !important;
  flex-direction: column !important;
  z-index: 1010 !important;
  overflow: hidden !important;
  border-radius: 0 16px 16px 0 !important;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none !important;
  flex-shrink: 0;
}

.sidebar-brand img {
  height: 60px;
  width: auto;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 18px;
  color: #ffffff;
  text-decoration: none !important;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  margin: 4px 0;
  text-transform: uppercase;
  font-family: 'Segoe UI', Arial, sans-serif;
  letter-spacing: 0.3px;
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.sidebar-nav a.active {
  background: rgba(45, 125, 210, 0.15);
  color: #ffffff;
  border-left-color: #2d7dd2;
}

.sidebar-nav a img.nav-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  opacity: 1;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
}

.sidebar-nav a.active img.nav-icon,
.sidebar-nav a:hover img.nav-icon {
  opacity: 1;
  filter: brightness(0) invert(1);
}

/* ============================================================================
   DROPDOWN NAVIGATION
   ============================================================================ */

.nav-item-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  width: 100%;
  padding: 14px 18px;
  color: #ffffff;
  text-decoration: none !important;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
  background: none;
  border: none;
  text-align: left;
  margin: 4px 0;
  text-transform: uppercase;
  font-family: 'Segoe UI', Arial, sans-serif;
  letter-spacing: 0.3px;
}

.nav-dropdown-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
}

.nav-arrow {
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.2s ease;
}

.nav-item-dropdown.open .nav-arrow {
  transform: rotate(180deg);
}

.nav-submenu {
  display: none;
  list-style: none;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.1);
}

.nav-item-dropdown.open .nav-submenu {
  display: block;
}

.nav-submenu li a {
  padding-left: 2rem;
  font-size: 0.85em;
  padding-top: 12px;
  padding-bottom: 12px;
  margin: 2px 0;
}

.submenu-label {
  display: block;
  padding: 6px 6px 6px 2rem;
  font-size: 0.85em;
  opacity: 0.7;
  color: #ffffff;
}

.nav-arrow-nested {
  font-size: 10px;
  transition: transform 0.2s ease;
  margin-left: 6px;
}

.nav-item-dropdown-nested.open .nav-arrow-nested {
  transform: rotate(180deg);
}

.nav-submenu-nested {
  display: none;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-item-dropdown-nested.open .nav-submenu-nested {
  display: block;
}

.nav-submenu-nested li a {
  padding-left: 3rem;
}

.nav-dropdown-toggle-nested {
  cursor: pointer;
  display: flex;
  align-items: center;
  color: #ffffff;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 14px 18px;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none !important;
  transition: background 0.15s;
  margin: 4px 0;
  text-transform: uppercase;
  font-family: 'Segoe UI', Arial, sans-serif;
  letter-spacing: 0.3px;
}

.nav-dropdown-toggle-nested:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ============================================================================
   TOPBAR
   ============================================================================ */

.predig-topbar {
  position: fixed !important;
  top: 0 !important;
  left: 260px !important;
  right: 0 !important;
  height: 54px !important;
  background: #ffffff !important;
  border-bottom: 1px solid #e5e7eb !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  padding: 0 28px !important;
  z-index: 1000 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.topbar-status {
  flex: 1;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: #edf2f7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  font-size: 17px;
  flex-shrink: 0;
}

.user-info {
  line-height: 1.25;
  text-align: right;
  color:#1a1a2e;
}

.user-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #1a1a2e !important;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  color: var(--color-text-primary);
  text-decoration: none;
  transition: 0.2s ease;
}

.dropdown-toggle:hover {
  color: var(--color-primary);
}

.dropdown-toggle .fa-chevron-down {
  color: #9ca3af;
  font-size: 11px;
}

.dropdown-menu {
  right: 0;
  left: auto;
  min-width: 170px;
  margin-top: 8px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  border: 1px solid #e2e8f0;
  list-style: none;
  padding: 8px 0;
  margin: 0;
}

.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1f2937 !important;
  padding: 8px 14px;
  text-decoration: none;
  transition: 0.2s ease;
}

.dropdown-menu a:hover,
.dropdown-menu a:focus {
  color: #ffffff;
  background-color: #0066cd;
}

.dropdown-menu .divider {
  height: 1px;
  background: #e5e7eb;
  margin: 8px 0;
}

/* ============================================================================
   MAIN CONTENT AREA
   ============================================================================ */

.predig-main {
  margin-left: 260px !important;
  width: calc(100vw - 260px) !important;
  padding: 24px 100px 32px !important;
  min-height: 100vh !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
  background: #f5f5f7 !important;
  margin-top: 54px !important;
}

.predig-main .container,
.predig-main .container-fluid {
  width: 100% !important;
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.predig-main .content {
  width: 100% !important;
  max-width: 1280px;
  margin: 0 auto;
  min-width: 0;
  overflow-x: auto;
}

.predig-main.predig-main-fluid .content {
  max-width: none;
}

body.dashboard-shell#page-transfer .predig-main.predig-main-fluid .content,
body.dashboard-shell#page-ingest .predig-main.predig-main-fluid .content {
  max-width: 1360px;
  overflow-x: hidden;
}

body.dashboard-shell > .container,
body.dashboard-shell > .container-fluid {
  width: calc(100vw - 260px);
  max-width: none;
  margin: 0 0 0 260px;
  padding: 24px 28px 32px;
}

body.dashboard-shell > .container .content,
body.dashboard-shell > .container-fluid .content {
  margin-top: 0;
  overflow-x: auto;
}

/* ============================================================================
   WELCOME SECTION
   ============================================================================ */

body.dashboard-shell .welcome {
  width: 100% !important;
  padding: 16px 20px 0;
}

body.dashboard-shell .content .welcome-title {
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.2;
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
  overflow-wrap: anywhere;
  white-space: normal !important;
  text-align: center;
}

body.dashboard-shell .welcome .welcome-subtitle {
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.25;
}

body.dashboard-shell .welcome-text,
body.dashboard-shell .welcome-text2 {
  font-size: clamp(15px, 1.6vw, 20px);
  line-height: 1.25;
  padding-left: 0;
  overflow-wrap: anywhere;
  white-space: normal !important;
}

body.dashboard-shell hr {
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* ============================================================================
   TRANSFER Y INGEST SPECIFIC
   ============================================================================ */

body.dashboard-shell #sip-container,
body.dashboard-shell #path_container,
body.dashboard-shell #transfer-browser-form,
body.dashboard-shell #transfer_browse_tree,
body.dashboard-shell #transfer-alert {
  width: 100% !important;
  max-width: 100%;
}

body.dashboard-shell#page-transfer #transfer-alert,
body.dashboard-shell#page-transfer #path_container,
body.dashboard-shell#page-transfer #transfer_browse_tree,
body.dashboard-shell#page-transfer #transfer-browser-form {
  margin-left: auto !important;
  margin-right: auto !important;
}

body.dashboard-shell#page-transfer #transfer-browser-form {
  display: flex !important;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px 28px;
  max-width: 1180px;
  padding: 0 20px;
}

body.dashboard-shell#page-transfer #transfer-browser-form:before,
body.dashboard-shell#page-transfer #transfer-browser-form:after {
  display: none !important;
}

body.dashboard-shell#page-transfer #transfer-browser-form > [class*="col-"] {
  float: none !important;
  width: auto !important;
  min-width: 180px;
  max-width: 240px;
  flex: 1 1 180px;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body.dashboard-shell#page-transfer #transfer-browser-form > div:last-child {
  min-width: 330px;
  max-width: 430px;
  flex: 1 1 330px;
}

body.dashboard-shell#page-transfer #transfer-browser-form .form-control {
  width: 100%;
}

body.dashboard-shell#page-transfer #transfer-browser-form .btn-group {
  max-width: 100%;
  vertical-align: top;
}

body.dashboard-shell #sip-container {
  overflow-x: auto;
}

body.dashboard-shell #sip-header,
body.dashboard-shell .sip-row {
  display: grid;
  align-items: center;
  min-width: 760px;
  column-gap: 12px;
}

body.dashboard-shell #sip-header {
  grid-template-columns: minmax(220px, 2fr) minmax(180px, 1.4fr) minmax(150px, 1fr) minmax(48px, auto) minmax(48px, auto);
}

body.dashboard-shell .sip-row {
  grid-template-columns: 26px minmax(220px, 2fr) minmax(180px, 1.4fr) minmax(150px, 1fr) minmax(90px, auto);
}

body.dashboard-shell #sip-header > div,
body.dashboard-shell .sip-detail-icon-status,
body.dashboard-shell .sip-detail-directory,
body.dashboard-shell .sip-detail-uuid,
body.dashboard-shell .sip-detail-timestamp,
body.dashboard-shell .sip-detail-actions {
  float: none !important;
  width: auto !important;
  min-width: 0;
}

body.dashboard-shell .sip-detail-directory {
  white-space: normal;
  overflow-wrap: anywhere;
}

body.dashboard-shell .sip-detail-uuid,
body.dashboard-shell .sip-detail-timestamp {
  overflow-wrap: anywhere;
}

/* ============================================================================
   FORMS
   ============================================================================ */

body.dashboard-shell .form-control,
body.dashboard-shell input,
body.dashboard-shell select,
body.dashboard-shell textarea {
  max-width: 100%;
}

body.dashboard-shell .form-inline {
  width: 100% !important;
  max-width: 100%;
  padding-left: 0 !important;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 24px;
}

body.dashboard-shell .form-inline .form-group {
  margin-right: 0;
  min-width: 180px;
  max-width: 100%;
}

body.dashboard-shell .form-inline .form-control,
body.dashboard-shell .form-inline input,
body.dashboard-shell .form-inline select {
  width: 100%;
}

body.dashboard-shell .form-inline .btn,
body.dashboard-shell .form-inline button {
  max-width: 100%;
  white-space: normal;
}

/* ============================================================================
   TABLES
   ============================================================================ */

body.dashboard-shell .table,
body.dashboard-shell table.dataTable {
  width: 100% !important;
  max-width: 100%;
}

/* ============================================================================
   NAVBAR OVERRIDE
   ============================================================================ */

body.dashboard-shell .navbar {
  display: none !important;
}

/* ============================================================================
   PAGE SPECIFIC
   ============================================================================ */

body.dashboard-shell#page-transfer .welcome,
body.dashboard-shell#page-ingest .welcome {
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
}

body.dashboard-shell#page-transfer .content .welcome-title,
body.dashboard-shell#page-ingest .content .welcome-title {
  display: block;
  width: 100%;
  max-width: 760px;
  font-size: clamp(20px, 2vw, 28px);
  padding: 0 12px;
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal !important;
}

/* ============================================================================
   HEADER Y BREADCRUMB
   ============================================================================ */

.breadcrumb {
  background: #ffffff;
  padding: 12px 28px;
  margin: 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb-item {
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb-item a {
  color: #190576;
  text-decoration: none;
  transition: 0.2s ease;
}

.breadcrumb-item a:hover {
  color: #100447;
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: #1a1a2e;
  font-weight: 600;
}

.breadcrumb-item:not(:last-child)::after {
  content: '/';
  margin-left: 8px;
  color: #d1d5db;
}

/* Page Title Styles */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: 16px;
  color: #1a1a2e;
  font-weight: 600;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  margin-bottom: 24px;
}

h2 {
  font-size: 24px;
  line-height: 1.25;
  margin-bottom: 20px;
}

h3 {
  font-size: 20px;
  line-height: 1.3;
  margin-bottom: 16px;
}

/* Header Section */
.page-header {
  background: #ffffff;
  padding: 24px 28px;
  margin-bottom: 24px;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 0;
}

.page-header h1 {
  margin: 0;
  padding: 0;
  font-size: 24px;
  font-weight: 600;
  color: #1a1a2e;
}

.page-header .page-title {
  font-size: 24px;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0;
  padding: 0;
}

/* ============================================================================
   RESPONSIVE - TABLET (768px - 1024px)
   ============================================================================ */

@media (max-width: 1024px) {
  .predig-main {
    padding: 24px;
  }

  body.dashboard-shell > .container,
  body.dashboard-shell > .container-fluid {
    padding: 24px 16px 32px;
  }

  .predig-main .content {
    max-width: 100%;
  }
}

/* ============================================================================
   RESPONSIVE - MOBILE (< 768px)
   ============================================================================ */

@media (max-width: 768px) {
  body.dashboard-shell {
    padding-left: 0;
  }

  .predig-sidebar {
    transform: translateX(-260px);
    transition: transform 0.25s;
  }

  .predig-sidebar.open {
    transform: translateX(0);
  }

  .predig-topbar {
    left: 0;
    padding-left: 28px;
  }

  .predig-main {
    margin-left: 0 !important;
    width: 100%;
    padding: 24px 16px 24px;
    margin-top: 54px;
  }

  body.dashboard-shell > .container,
  body.dashboard-shell > .container-fluid {
    width: 100%;
    margin-left: 0;
    padding: 24px 16px;
  }

  body.dashboard-shell .welcome {
    padding-left: 0;
    padding-right: 0;
  }

  body.dashboard-shell .content .welcome-title {
    font-size: clamp(18px, 5vw, 24px);
  }

  body.dashboard-shell .welcome-text,
  body.dashboard-shell .welcome-text2 {
    font-size: clamp(13px, 3.5vw, 16px);
  }

  body.dashboard-shell .form-inline {
    gap: 12px 16px;
  }

  body.dashboard-shell .form-inline .form-group {
    min-width: 100%;
    max-width: 100%;
  }

  body.dashboard-shell#page-transfer #transfer-browser-form {
    gap: 16px;
    padding: 0 12px;
  }

  body.dashboard-shell#page-transfer #transfer-browser-form > [class*="col-"] {
    min-width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
  }

  body.dashboard-shell#page-transfer #transfer-browser-form > div:last-child {
    min-width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
  }

  body.dashboard-shell #sip-header,
  body.dashboard-shell .sip-row {
    min-width: auto;
    column-gap: 8px;
  }

  body.dashboard-shell #sip-header {
    grid-template-columns: auto auto auto;
  }

  body.dashboard-shell .sip-row {
    grid-template-columns: 20px auto auto;
  }
}

/* ============================================================================
   RESPONSIVE - SMALL MOBILE (< 480px)
   ============================================================================ */

@media (max-width: 480px) {
  .predig-topbar {
    top: 8px;
    right: 8px;
    padding: 8px 12px;
  }

  .predig-main,
  body.dashboard-shell > .container,
  body.dashboard-shell > .container-fluid {
    padding: 12px 8px;
  }

  body.dashboard-shell .content .welcome-title {
    font-size: clamp(16px, 6vw, 20px);
  }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
  .predig-sidebar,
  .predig-topbar,
  .navbar {
    display: none !important;
  }

  .predig-main {
    margin-left: 0;
    width: 100%;
    padding: 0;
  }

  body.dashboard-shell > .container,
  body.dashboard-shell > .container-fluid {
    margin: 0;
    padding: 0;
    width: 100%;
  }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}