/* EasyFile shared interface system */
:root {
  --easyfile-blue: #2563eb;
  --easyfile-blue-strong: #1d4ed8;
  --easyfile-surface: #ffffff;
  --easyfile-page: #f3f6fb;
  --easyfile-text: #0f172a;
  --easyfile-muted: #64748b;
  --easyfile-border: #e2e8f0;
  --easyfile-success: #16a34a;
  --easyfile-danger: #dc2626;
  --easyfile-radius: 1rem;
  --easyfile-control-radius: .625rem;
  --easyfile-shadow: 0 12px 32px rgba(15, 23, 42, .08);
  --easyfile-focus: 0 0 0 4px rgba(37, 99, 235, .20);
}

.dark,
[data-theme="dark"] {
  --easyfile-surface: #0f172a;
  --easyfile-page: #0b1220;
  --easyfile-text: #e5e7eb;
  --easyfile-muted: #94a3b8;
  --easyfile-border: rgba(148, 163, 184, .22);
  --easyfile-shadow: 0 18px 42px rgba(2, 6, 23, .42);
}

* { box-sizing: border-box; }

body.easyfile-app {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 92% 3%, rgba(37, 99, 235, .09), transparent 28rem),
    var(--easyfile-page);
  color: var(--easyfile-text);
  font-family: var(--easyfile-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  text-rendering: optimizeLegibility;
}

.easyfile-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(110deg, var(--easyfile-blue-strong), var(--easyfile-blue));
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 10px 28px rgba(30, 64, 175, .20);
}

.easyfile-nav > div {
  width: min(100%, 80rem);
  margin-inline: auto;
}

.easyfile-nav a {
  border-radius: .5rem;
  padding: .45rem .55rem;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  transition: background-color .15s ease, transform .15s ease;
}

.easyfile-nav a:hover,
.easyfile-nav a:focus-visible {
  background: rgba(255, 255, 255, .13);
}

.easyfile-nav a[aria-current="page"] {
  background: #fff;
  color: var(--easyfile-blue-strong);
  text-decoration: none;
}

.easyfile-main {
  width: min(100%, 80rem);
  margin-inline: auto;
}

.easyfile-page-header {
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--easyfile-border);
  box-shadow: 0 5px 20px rgba(15, 23, 42, .04);
  backdrop-filter: blur(12px);
}

.dark .easyfile-page-header,
[data-theme="dark"] .easyfile-page-header {
  background: rgba(15, 23, 42, .94);
}

body.easyfile-app .card,
body.easyfile-app .surface,
body.easyfile-app .print-container {
  border: 1px solid var(--easyfile-border);
  border-radius: var(--easyfile-radius);
  background: var(--easyfile-surface);
  color: var(--easyfile-text);
  box-shadow: var(--easyfile-shadow);
}

body.easyfile-app input:not([type="checkbox"]):not([type="radio"]),
body.easyfile-app select,
body.easyfile-app textarea {
  border-color: var(--easyfile-border);
  border-radius: var(--easyfile-control-radius);
  background: var(--easyfile-surface);
  color: var(--easyfile-text);
}

body.easyfile-app input:focus,
body.easyfile-app select:focus,
body.easyfile-app textarea:focus,
body.easyfile-app button:focus-visible,
body.easyfile-app a:focus-visible {
  outline: none;
  box-shadow: var(--easyfile-focus);
}

body.easyfile-app table {
  border-color: var(--easyfile-border);
}

body.easyfile-app thead {
  background: #f8fafc;
  color: #475569;
}

.dark body.easyfile-app thead,
[data-theme="dark"] body.easyfile-app thead {
  background: #111c31;
  color: #cbd5e1;
}

/* Shared module action bar */
.easyfile-action-card {
  width: min(100%, 80rem);
  margin: 1rem auto 1.5rem;
  padding: 1rem;
}

.easyfile-action-row,
.easyfile-action-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}

.easyfile-action-group { margin-left: auto; }

.easyfile-action-button {
  display: inline-flex;
  min-height: 2.625rem;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: 1px solid transparent;
  border-radius: .625rem;
  padding: .625rem 1rem;
  font: inherit;
  font-size: .875rem;
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.easyfile-action-button:hover { transform: translateY(-1px); }

.easyfile-action-primary {
  background: var(--easyfile-blue);
  color: #fff;
}

.easyfile-action-primary:hover { background: var(--easyfile-blue-strong); }

.easyfile-action-success {
  background: var(--easyfile-success);
  color: #fff;
}

.easyfile-action-success:hover { background: #15803d; }

.easyfile-action-secondary {
  border-color: var(--easyfile-border);
  background: var(--easyfile-surface);
  color: var(--easyfile-text);
}

.easyfile-action-secondary:hover { background: #f8fafc; }

.easyfile-action-secondary.bg-gray-900 {
  border-color: #111827;
  background: #111827;
  color: #fff;
}

.easyfile-action-secondary.bg-gray-900:hover { background: #000; }

.dark .easyfile-action-secondary:hover,
[data-theme="dark"] .easyfile-action-secondary:hover { background: #172033; }

.dark .easyfile-action-secondary.bg-gray-900,
[data-theme="dark"] .easyfile-action-secondary.bg-gray-900 { background: #020617; }

.easyfile-action-status {
  flex: 1 1 100%;
  min-height: 1.25rem;
  margin-top: .25rem;
  color: var(--easyfile-muted);
  font-size: .75rem;
  font-weight: 700;
}

.easyfile-native-action-hidden { display: none !important; }

.easyfile-action-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9999;
  max-width: min(26rem, calc(100vw - 2rem));
  border-radius: .75rem;
  padding: .8rem 1rem;
  background: #111827;
  color: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .30);
  font-size: .875rem;
  font-weight: 700;
}

.easyfile-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding: 2rem 1rem;
  background: rgba(2, 6, 23, .72);
}

.easyfile-preview-dialog {
  width: min(100%, 72rem);
  border-radius: 1rem;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 30px 80px rgba(2, 6, 23, .38);
}

.easyfile-preview-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 1rem 1rem 0 0;
  padding: 1rem 1.25rem;
  background: #fff;
}

.easyfile-preview-body { padding: 1.5rem; }

@media (max-width: 900px) {
  .easyfile-action-group {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .easyfile-nav > div {
    gap: .35rem;
    overflow-x: auto;
    white-space: nowrap;
  }

  .easyfile-action-card { padding: .75rem; }
  .easyfile-action-row,
  .easyfile-action-group { align-items: stretch; }
  .easyfile-action-button { flex: 1 1 calc(50% - .5rem); }
}

@media (max-width: 390px) {
  .easyfile-action-button { flex-basis: 100%; }
}

@media print {
  .no-print,
  .easyfile-action-card,
  .easyfile-action-toast,
  .easyfile-preview-modal { display: none !important; }

  body.easyfile-app { background: #fff !important; }
  body.easyfile-app .card,
  body.easyfile-app .surface,
  body.easyfile-app .print-container {
    border: 0 !important;
    box-shadow: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
