/* ============================================
   INTRANET SANI CONCEPT - Design System
   Colors from logo: Dark navy blue + Bright cyan blue
   ============================================ */

:root {
  --primary-dark: #1a3a5c;
  --primary: #1e6bb8;
  --primary-light: #2ba4e0;
  --accent: #00bcd4;
  --accent-light: #b2ebf2;
  --bg: #f0f7fb;
  --bg-card: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c9a;
  --text-muted: #b0bec5;
  --border: #e1edf5;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f39c12;
  --shadow: 0 2px 12px rgba(26, 58, 92, 0.08);
  --shadow-lg: 0 8px 32px rgba(26, 58, 92, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   WATER ANIMATIONS
   ============================================ */

/* Floating bubbles - pages intérieures */
.water-bubbles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.water-bubbles .bubble {
  position: absolute;
  bottom: -80px;
  background: radial-gradient(circle at 30% 30%,
    rgba(43, 164, 224, 0.12),
    rgba(0, 188, 212, 0.06));
  border-radius: 50%;
  animation: floatUp linear infinite;
  border: 1px solid rgba(43, 164, 224, 0.08);
}

.water-bubbles .bubble:nth-child(1) { width: 40px; height: 40px; left: 5%; animation-duration: 18s; animation-delay: 0s; }
.water-bubbles .bubble:nth-child(2) { width: 25px; height: 25px; left: 15%; animation-duration: 22s; animation-delay: 2s; }
.water-bubbles .bubble:nth-child(3) { width: 55px; height: 55px; left: 30%; animation-duration: 25s; animation-delay: 4s; }
.water-bubbles .bubble:nth-child(4) { width: 35px; height: 35px; left: 50%; animation-duration: 20s; animation-delay: 1s; }
.water-bubbles .bubble:nth-child(5) { width: 20px; height: 20px; left: 65%; animation-duration: 28s; animation-delay: 3s; }
.water-bubbles .bubble:nth-child(6) { width: 45px; height: 45px; left: 78%; animation-duration: 23s; animation-delay: 5s; }
.water-bubbles .bubble:nth-child(7) { width: 30px; height: 30px; left: 88%; animation-duration: 19s; animation-delay: 2.5s; }
.water-bubbles .bubble:nth-child(8) { width: 50px; height: 50px; left: 42%; animation-duration: 26s; animation-delay: 6s; }

@keyframes floatUp {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-110vh) scale(0.5);
    opacity: 0;
  }
}

/* Login page water effects */
.login-page {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #0d2137 40%, var(--primary) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.water-bg {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 0;
}

.waves {
  width: 100%;
  height: 120px;
  min-height: 80px;
}

.wave-parallax > use {
  animation: waveMove 20s cubic-bezier(.55,.5,.45,.5) infinite;
}
.wave-parallax > use:nth-child(1) { animation-delay: -2s; animation-duration: 8s; }
.wave-parallax > use:nth-child(2) { animation-delay: -3s; animation-duration: 12s; }
.wave-parallax > use:nth-child(3) { animation-delay: -4s; animation-duration: 16s; }
.wave-parallax > use:nth-child(4) { animation-delay: -5s; animation-duration: 24s; }

@keyframes waveMove {
  0% { transform: translate3d(-90px, 0, 0); }
  100% { transform: translate3d(85px, 0, 0); }
}

/* Login bubbles */
.login-bubbles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.login-bubbles .bubble {
  position: absolute;
  bottom: -100px;
  background: radial-gradient(circle at 30% 30%,
    rgba(255, 255, 255, 0.15),
    rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  animation: floatUpLogin linear infinite;
}

.login-bubbles .bubble:nth-child(1) { width: 30px; height: 30px; left: 8%; animation-duration: 14s; animation-delay: 0s; }
.login-bubbles .bubble:nth-child(2) { width: 50px; height: 50px; left: 18%; animation-duration: 18s; animation-delay: 1s; }
.login-bubbles .bubble:nth-child(3) { width: 20px; height: 20px; left: 28%; animation-duration: 12s; animation-delay: 3s; }
.login-bubbles .bubble:nth-child(4) { width: 40px; height: 40px; left: 38%; animation-duration: 20s; animation-delay: 2s; }
.login-bubbles .bubble:nth-child(5) { width: 25px; height: 25px; left: 52%; animation-duration: 16s; animation-delay: 4s; }
.login-bubbles .bubble:nth-child(6) { width: 60px; height: 60px; left: 62%; animation-duration: 22s; animation-delay: 1.5s; }
.login-bubbles .bubble:nth-child(7) { width: 35px; height: 35px; left: 75%; animation-duration: 15s; animation-delay: 3.5s; }
.login-bubbles .bubble:nth-child(8) { width: 45px; height: 45px; left: 85%; animation-duration: 19s; animation-delay: 0.5s; }
.login-bubbles .bubble:nth-child(9) { width: 15px; height: 15px; left: 92%; animation-duration: 13s; animation-delay: 5s; }
.login-bubbles .bubble:nth-child(10) { width: 55px; height: 55px; left: 45%; animation-duration: 25s; animation-delay: 6s; }

@keyframes floatUpLogin {
  0% {
    transform: translateY(0) translateX(0) scale(1);
    opacity: 0;
  }
  10% { opacity: 0.8; }
  50% { transform: translateY(-50vh) translateX(30px) scale(0.8); }
  90% { opacity: 0.3; }
  100% {
    transform: translateY(-110vh) translateX(-20px) scale(0.3);
    opacity: 0;
  }
}

/* Water ripple effect on hover */
@keyframes ripple {
  0% { transform: scale(0); opacity: 0.6; }
  100% { transform: scale(4); opacity: 0; }
}

/* ============================================
   LOGIN
   ============================================ */

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 1rem;
}

.login-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.login-logo img {
  height: 70px;
  margin-bottom: 1rem;
}

.login-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 0.25rem;
}

.login-subtitle {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.login-form .form-group {
  text-align: left;
  margin-bottom: 1.2rem;
}

.login-form label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.login-form label svg {
  color: var(--primary);
}

.login-form input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  transition: var(--transition);
  background: var(--bg);
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(43, 164, 224, 0.15);
  background: white;
}

.btn-login {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.85rem;
  font-size: 1rem;
}

/* ============================================
   NAVIGATION
   ============================================ */

.navbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(26, 58, 92, 0.06);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 64px;
  gap: 2rem;
}

.nav-logo img {
  height: 40px;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  text-decoration: none;
  color: var(--text-light);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link svg {
  width: 18px;
  height: 18px;
}

.nav-link:hover {
  background: var(--bg);
  color: var(--primary);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(30, 107, 184, 0.08), rgba(43, 164, 224, 0.08));
  color: var(--primary);
  font-weight: 600;
}

.nav-admin {
  border-left: 1px solid var(--border);
  margin-left: 0.5rem;
  padding-left: 1rem;
}

.nav-user {
  position: relative;
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-user:hover {
  background: var(--bg);
}

.nav-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  min-width: 200px;
  overflow: hidden;
  z-index: 200;
}

.nav-user:hover .nav-dropdown {
  display: block;
}

.nav-dropdown a {
  display: block;
  padding: 0.7rem 1rem;
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
  transition: var(--transition);
}

.nav-dropdown a:hover {
  background: var(--bg);
  color: var(--primary);
}

.logout-link:hover {
  background: #ffeaea !important;
  color: var(--danger) !important;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 64px - 60px);
}

/* ============================================
   PAGE HEADER
   ============================================ */

.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.page-header h1 svg {
  color: var(--primary-light);
}

.page-subtitle {
  color: var(--text-light);
  font-size: 0.95rem;
  width: 100%;
}

.water-drop-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(43, 164, 224, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 20px 8px rgba(43, 164, 224, 0.1); }
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideIn 0.3s ease;
}

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

.alert-success {
  background: #e8f8ef;
  color: #1e7e46;
  border: 1px solid #a3d9b1;
}

.alert-error {
  background: #fdeaea;
  color: #c0392b;
  border: 1px solid #f1a9a0;
}

/* ============================================
   DASHBOARD
   ============================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.dash-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.8rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: block;
  border: 1px solid var(--border);
}

.dash-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: var(--transition);
}

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

.dash-card:hover::before {
  transform: scaleX(1);
}

.dash-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.dash-card-icon svg {
  width: 24px;
  height: 24px;
}

.documents-icon {
  background: linear-gradient(135deg, rgba(30, 107, 184, 0.1), rgba(43, 164, 224, 0.1));
  color: var(--primary);
}

.private-icon {
  background: linear-gradient(135deg, rgba(0, 188, 212, 0.1), rgba(178, 235, 242, 0.3));
  color: var(--accent);
}

.admin-icon {
  background: linear-gradient(135deg, rgba(26, 58, 92, 0.1), rgba(30, 107, 184, 0.1));
  color: var(--primary-dark);
}

.dash-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 0.3rem;
}

.dash-card p {
  font-size: 0.85rem;
  color: var(--text-light);
}

.dash-card-arrow {
  position: absolute;
  bottom: 1.2rem;
  right: 1.5rem;
  font-size: 1.3rem;
  color: var(--primary-light);
  opacity: 0;
  transform: translateX(-5px);
  transition: var(--transition);
}

.dash-card:hover .dash-card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================
   SECTION CARDS
   ============================================ */

.section-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 2px solid var(--bg);
}

.section-title svg {
  color: var(--primary-light);
}

/* ============================================
   DOCUMENTS
   ============================================ */

.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 0.45rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
  background: white;
  color: var(--text-light);
  border: 1px solid var(--border);
}

.filter-chip:hover {
  background: var(--bg);
  color: var(--primary);
  border-color: var(--primary-light);
}

.filter-chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-color: transparent;
}

.doc-category-section {
  margin-bottom: 2rem;
}

.category-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.category-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.documents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem;
}

.doc-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.doc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(43, 164, 224, 0.3);
}

.doc-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.doc-type-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, rgba(30, 107, 184, 0.1), rgba(43, 164, 224, 0.1));
  color: var(--primary);
}

.private-badge {
  background: linear-gradient(135deg, rgba(0, 188, 212, 0.1), rgba(0, 188, 212, 0.05));
  color: var(--accent);
}

.private-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
}

.doc-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 0.3rem;
}

.doc-card-desc {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 0.8rem;
  flex: 1;
}

.doc-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--bg);
}

.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
}

/* Recent docs on dashboard */
.recent-docs-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.recent-doc-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: var(--transition);
}

.recent-doc-item:hover {
  background: var(--bg);
}

.doc-file-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(30, 107, 184, 0.08), rgba(43, 164, 224, 0.08));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.doc-file-icon svg {
  width: 18px;
  height: 18px;
}

.doc-info {
  flex: 1;
}

.doc-title {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary-dark);
}

.doc-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.download-icon {
  color: var(--text-muted);
  transition: var(--transition);
}

.recent-doc-item:hover .download-icon {
  color: var(--primary);
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}

.empty-state svg {
  color: var(--text-muted);
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(30, 107, 184, 0.3);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

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

.btn-danger:hover {
  background: #c0392b;
}

.btn-welcome {
  background: #27ae60;
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.btn-welcome:hover {
  background: #219a52;
}

.btn-sm {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
}

/* ============================================
   FORMS
   ============================================ */

.form-container {
  max-width: 600px;
}

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

.styled-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.styled-form input,
.styled-form select,
.styled-form textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: var(--transition);
  background: var(--bg);
  font-family: inherit;
}

.styled-form input:focus,
.styled-form select:focus,
.styled-form textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(43, 164, 224, 0.12);
  background: white;
}

.styled-form small {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.checkbox-group {
  margin-top: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--bg);
  transition: var(--transition);
}

.checkbox-label:hover {
  border-color: var(--primary-light);
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"]:checked + span {
  color: var(--primary);
}

.form-actions {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.filter-form .form-row {
  align-items: flex-end;
}

/* ============================================
   TABLES
   ============================================ */

.logs-table-container {
  overflow-x: auto;
}

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

.data-table th {
  text-align: left;
  padding: 0.7rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  border-bottom: 2px solid var(--bg);
}

.data-table td {
  padding: 0.65rem 0.8rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--bg);
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: rgba(240, 247, 251, 0.7);
}

.nowrap {
  white-space: nowrap;
}

.actions-cell {
  display: flex;
  gap: 0.4rem;
}

/* Badges */
.role-badge, .status-badge, .action-badge, .category-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}

.role-admin {
  background: linear-gradient(135deg, rgba(26, 58, 92, 0.1), rgba(30, 107, 184, 0.1));
  color: var(--primary-dark);
}

.role-user {
  background: rgba(240, 247, 251, 1);
  color: var(--text-light);
}

.status-active {
  background: #e8f8ef;
  color: var(--success);
}

.status-inactive {
  background: #fdeaea;
  color: var(--danger);
}

.action-badge {
  background: var(--bg);
  color: var(--text-light);
  font-size: 0.72rem;
  text-transform: capitalize;
}

.action-login { background: #e8f8ef; color: var(--success); }
.action-logout { background: #fff3e0; color: var(--warning); }
.action-login_failed { background: #fdeaea; color: var(--danger); }
.action-download_document, .action-download_private { background: #e3f2fd; color: var(--primary); }

.category-badge {
  background: linear-gradient(135deg, rgba(30, 107, 184, 0.08), rgba(43, 164, 224, 0.08));
  color: var(--primary);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--bg);
}

.page-info {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* ============================================
   ADMIN NAV
   ============================================ */

.admin-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-nav-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.3rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
}

.admin-nav-card svg {
  width: 28px;
  height: 28px;
  color: var(--primary);
}

.admin-nav-card span {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary-dark);
}

.admin-nav-card small {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.admin-nav-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

/* ============================================
   USER SELECT GRID (Private Files Admin)
   ============================================ */

.user-select-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.user-select-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
}

.user-select-card:hover {
  border-color: var(--primary-light);
  background: var(--bg);
}

.user-select-card.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(30, 107, 184, 0.05), rgba(43, 164, 224, 0.05));
  color: var(--primary);
  font-weight: 700;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
  text-align: center;
  padding: 1.2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  background: white;
  position: relative;
  z-index: 1;
}

/* ============================================
   DOCUMENT ORDER ARROWS
   ============================================ */

.order-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}

.btn-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
  color: var(--text-light);
  transition: var(--transition);
  padding: 0;
}

.btn-arrow:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ============================================
   MAINTENANCE TOGGLE
   ============================================ */

.maintenance-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.maintenance-info {
  flex: 1;
}

.maintenance-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-online .status-dot {
  background: var(--success);
  box-shadow: 0 0 6px rgba(39, 174, 96, 0.5);
}

.status-online {
  color: var(--success);
}

.status-offline .status-dot {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(231, 76, 60, 0.5);
}

.status-offline {
  color: var(--danger);
}

.maintenance-desc {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-top: 0.3rem;
}

.toggle-btn {
  width: 60px;
  height: 32px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}

.toggle-on {
  background: var(--success);
}

.toggle-off {
  background: var(--danger);
}

.toggle-knob {
  position: absolute;
  top: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: var(--transition);
}

.toggle-on .toggle-knob {
  left: 31px;
}

.toggle-off .toggle-knob {
  left: 3px;
}

.toggle-btn:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

/* ============================================
   HAMBURGER MENU
   ============================================ */

.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 201;
  -webkit-tap-highlight-color: transparent;
}

.nav-hamburger span {
  display: block;
  width: 24px;
  height: 2.5px;
  background: var(--primary-dark);
  border-radius: 2px;
  transition: var(--transition);
}

.nav-hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-hamburger.active span:nth-child(2) {
  opacity: 0;
}

.nav-hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.nav-user-mobile {
  display: none;
}

.nav-user-desktop {
  display: block;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  /* -- Hamburger visible -- */
  .nav-hamburger {
    display: flex;
  }

  /* -- Nav container -- */
  .nav-container {
    padding: 0 0.8rem;
    flex-wrap: nowrap;
    justify-content: space-between;
  }

  /* -- Hide desktop user dropdown -- */
  .nav-user-desktop {
    display: none;
  }

  /* -- Mobile slide menu -- */
  .nav-menu {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 200;
    padding: 1rem;
    overflow-y: auto;
    animation: slideDown 0.25s ease;
  }

  .nav-menu.open {
    display: block;
  }

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

  .nav-menu .nav-links {
    flex-direction: column;
    gap: 0.3rem;
  }

  .nav-menu .nav-link {
    font-size: 1rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    gap: 0.7rem;
  }

  .nav-menu .nav-link.active {
    background: linear-gradient(135deg, rgba(30, 107, 184, 0.1), rgba(43, 164, 224, 0.1));
  }

  .nav-menu .nav-admin {
    border-left: none;
    margin-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--border);
    margin-top: 0.3rem;
    padding-top: 0.3rem;
  }

  /* -- Mobile user section at bottom of menu -- */
  .nav-user-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--bg);
  }

  .nav-user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 0.95rem;
  }

  .logout-link-mobile {
    color: var(--danger) !important;
  }

  /* -- Main content -- */
  .main-content {
    padding: 1rem 0.8rem;
  }

  /* -- Page header -- */
  .page-header {
    margin-bottom: 1.2rem;
    gap: 0.6rem;
  }

  .page-header h1 {
    font-size: 1.2rem;
  }

  .page-header .btn {
    width: 100%;
    justify-content: center;
  }

  .page-subtitle {
    font-size: 0.85rem;
  }

  /* -- Forms -- */
  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .section-card {
    padding: 1rem;
  }

  .section-title {
    font-size: 1rem;
  }

  /* -- Dashboard -- */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .dash-card {
    padding: 1.3rem;
  }

  /* -- Documents grid -- */
  .documents-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* -- Filter chips -- */
  .filter-bar {
    gap: 0.4rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
  }

  .filter-chip {
    flex-shrink: 0;
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  /* -- Tables mobile: card layout -- */
  .data-table thead {
    display: none;
  }

  .data-table tbody tr {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.8rem;
    margin-bottom: 0.6rem;
    gap: 0.4rem;
  }

  .data-table td {
    padding: 0.25rem 0;
    border-bottom: none;
    font-size: 0.88rem;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: block;
    margin-bottom: 0.15rem;
  }

  .actions-cell {
    flex-wrap: wrap;
    padding-top: 0.5rem !important;
    border-top: 1px solid var(--bg) !important;
    margin-top: 0.3rem;
  }

  .actions-cell .btn-sm {
    padding: 0.45rem 1rem;
    font-size: 0.82rem;
  }

  .order-cell {
    flex-direction: row;
    gap: 0.5rem;
  }

  .btn-arrow {
    width: 36px;
    height: 32px;
  }

  /* -- Category blocks (admin docs) -- */
  .category-block .data-table td:first-child {
    order: -1;
  }

  /* -- Admin nav -- */
  .admin-nav {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }

  .admin-nav-card {
    padding: 1rem;
  }

  .admin-nav-card span {
    font-size: 0.85rem;
  }

  .admin-nav-card small {
    font-size: 0.72rem;
  }

  /* -- User select grid (private files) -- */
  .user-select-grid {
    flex-direction: column;
  }

  .user-select-card {
    padding: 0.8rem 1rem;
  }

  /* -- Maintenance toggle -- */
  .maintenance-toggle-card {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  /* -- Pagination -- */
  .pagination {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* -- Alerts -- */
  .alert {
    font-size: 0.85rem;
    padding: 0.7rem 1rem;
  }

  /* -- Footer -- */
  .footer {
    font-size: 0.72rem;
    padding: 1rem 0.8rem;
  }

  /* -- Login page -- */
  .login-container {
    padding: 0.8rem;
  }

  .login-card {
    padding: 1.8rem 1.2rem;
  }

  .login-title {
    font-size: 1.2rem;
  }

  .login-subtitle {
    font-size: 0.82rem;
  }

  /* -- Logs table specific -- */
  .logs-table-container {
    overflow-x: visible;
  }
}

@media (max-width: 380px) {
  .admin-nav {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 1.5rem 1rem;
  }

  .nav-logo img {
    height: 32px;
  }
}
