/* ============================================================
   sis4u.com — DTE Document Viewer
   Color palette: White, Blue (#1565c0, #1976d2, #2196f3), Grey
   Typography: Inter
   ============================================================ */

:root {
  /* Primary Blues */
  --blue-900: #0d47a1;
  --blue-800: #1565c0;
  --blue-700: #1976d2;
  --blue-600: #1e88e5;
  --blue-500: #2196f3;
  --blue-400: #42a5f5;
  --blue-100: #bbdefb;
  --blue-50: #e3f2fd;

  /* Greys */
  --grey-900: #212121;
  --grey-800: #424242;
  --grey-700: #616161;
  --grey-600: #757575;
  --grey-500: #9e9e9e;
  --grey-400: #bdbdbd;
  --grey-300: #e0e0e0;
  --grey-200: #eeeeee;
  --grey-100: #f5f5f5;
  --grey-50: #fafafa;

  /* Functional */
  --white: #ffffff;
  --success: #4caf50;
  --warning: #ff9800;
  --error: #f44336;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.1), 0 8px 20px rgba(0,0,0,0.06);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--grey-100);
  color: var(--grey-900);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===================== HEADER ===================== */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.95);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--blue-800);
  font-weight: 700;
  font-size: 1.3rem;
}

.logo-icon {
  font-size: 28px;
  color: var(--blue-600);
}

.logo-accent {
  color: var(--grey-500);
  font-weight: 400;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  text-decoration: none;
  color: var(--grey-700);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover {
  background: var(--blue-50);
  color: var(--blue-700);
}

.nav-link .material-icons-outlined {
  font-size: 20px;
}

.nav-btn {
  background: var(--blue-700);
  color: var(--white) !important;
  border-radius: var(--radius-md);
}

.nav-btn:hover {
  background: var(--blue-800) !important;
  color: var(--white) !important;
}

/* ===================== MAIN ===================== */
.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ===================== CARDS ===================== */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--grey-200);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--grey-200);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--grey-50);
}

.card-header-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--blue-50);
  color: var(--blue-700);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--grey-900);
}

.card-subtitle {
  font-size: 0.85rem;
  color: var(--grey-600);
  margin-top: 2px;
}

.card-body {
  padding: 24px;
}

/* ===================== DTE VIEWER ===================== */
.dte-hero {
  background: linear-gradient(135deg, var(--blue-800), var(--blue-600));
  border-radius: var(--radius-xl);
  padding: 40px;
  color: var(--white);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.dte-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}

.dte-hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
}

.dte-hero-content {
  position: relative;
  z-index: 1;
}

.dte-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.dte-hero h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.dte-hero p {
  font-size: 1rem;
  opacity: 0.85;
}

.dte-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn-white {
  background: var(--white);
  color: var(--blue-800);
  box-shadow: var(--shadow-sm);
}

.btn-white:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border: 2px solid rgba(255,255,255,0.4);
}

.btn-outline:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.7);
}

.btn-blue {
  background: var(--blue-700);
  color: var(--white);
}

.btn-blue:hover {
  background: var(--blue-800);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

/* ===================== INFO GRID ===================== */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
}

.info-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--blue-50);
  color: var(--blue-600);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.info-icon .material-icons-outlined {
  font-size: 20px;
}

.info-label {
  font-size: 0.78rem;
  color: var(--grey-600);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.info-value {
  font-size: 0.95rem;
  color: var(--grey-900);
  font-weight: 600;
  margin-top: 2px;
  word-break: break-word;
}

/* ===================== TABLE ===================== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--grey-200);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead {
  background: var(--grey-50);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--grey-700);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--grey-200);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-100);
  color: var(--grey-800);
}

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

tr:hover td {
  background: var(--blue-50);
}

.text-right {
  text-align: right;
}

.total-row td {
  font-weight: 700;
  color: var(--blue-800);
  border-top: 2px solid var(--blue-100);
  background: var(--blue-50) !important;
}

/* ===================== PORTAL ===================== */
.portal-hero {
  text-align: center;
  padding: 60px 20px;
}

.portal-hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--grey-900);
  margin-bottom: 12px;
}

.portal-hero h1 span {
  color: var(--blue-700);
}

.portal-hero p {
  font-size: 1.1rem;
  color: var(--grey-600);
  max-width: 600px;
  margin: 0 auto 32px;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 48px;
}

.feature-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  border: 1px solid var(--grey-200);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.feature-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--blue-50);
  color: var(--blue-600);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.feature-icon .material-icons-outlined {
  font-size: 28px;
}

.feature-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--grey-900);
  margin-bottom: 8px;
}

.feature-desc {
  font-size: 0.88rem;
  color: var(--grey-600);
  line-height: 1.5;
}

/* ===================== LOGIN ===================== */
.login-container {
  max-width: 440px;
  margin: 40px auto;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--grey-700);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--grey-300);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  color: var(--grey-900);
  transition: var(--transition);
  background: var(--white);
}

.form-input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px var(--blue-100);
}

.form-input::placeholder {
  color: var(--grey-400);
}

/* ===================== ALERTS ===================== */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin: 16px 0;
}

.alert-info {
  background: var(--blue-50);
  color: var(--blue-800);
  border: 1px solid var(--blue-100);
}

.alert-success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.alert-error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

/* ===================== ERROR ===================== */
.error-page {
  text-align: center;
  padding: 80px 20px;
}

.error-code {
  font-size: 6rem;
  font-weight: 800;
  color: var(--grey-300);
  line-height: 1;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--grey-800);
  margin-top: 16px;
}

.error-message {
  font-size: 1rem;
  color: var(--grey-600);
  margin-top: 8px;
  margin-bottom: 24px;
}

/* ===================== FOOTER ===================== */
.footer {
  background: var(--white);
  border-top: 1px solid var(--grey-200);
  padding: 32px 24px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--blue-700);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.footer-text {
  font-size: 0.85rem;
  color: var(--grey-600);
}

.footer-copy {
  font-size: 0.78rem;
  color: var(--grey-500);
  margin-top: 4px;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  .dte-hero {
    padding: 28px 20px;
  }

  .dte-hero h1 {
    font-size: 1.4rem;
  }

  .dte-actions {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
  }

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

  .portal-hero h1 {
    font-size: 1.8rem;
  }

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

  .header-inner {
    padding: 0 16px;
  }
}

/* ===================== UTILITY ===================== */
.hidden {
  display: none !important;
}

/* ===================== BUTTONS EXTRA ===================== */
.btn-outline-blue {
  background: transparent;
  color: var(--blue-700);
  border: 2px solid var(--blue-200);
}

.btn-outline-blue:hover {
  background: var(--blue-50);
  border-color: var(--blue-400);
}

/* ===================== TOOLBAR ===================== */
.dte-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===================== STATS ===================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--grey-200);
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon .material-icons-outlined {
  font-size: 24px;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--grey-900);
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--grey-600);
  margin-top: 4px;
}

/* ===================== BADGES ===================== */
.doc-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--blue-50);
  color: var(--blue-700);
}

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-P, .status-A {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-R {
  background: #ffebee;
  color: #c62828;
}

.status-N {
  background: var(--blue-50);
  color: var(--blue-700);
}

/* ===================== ICON BUTTONS ===================== */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--grey-600);
  text-decoration: none;
  transition: var(--transition);
}

.icon-btn:hover {
  background: var(--blue-50);
  color: var(--blue-700);
}

.icon-btn .material-icons-outlined {
  font-size: 20px;
}

/* ===================== ANIMATIONS ===================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.card, .dte-hero, .feature-card {
  animation: fadeIn 0.4s ease-out;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline-flex;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--grey-300);
  border-top-color: var(--blue-600);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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