/* ==========================================================================
   MINIGEST — components.css (Button, Card, Grid, Form, Table, Badge and UI Components)
   ========================================================================== */

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: var(--transition-normal);
  color: var(--text-primary);
  background: transparent;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  transition: transform 0.5s, opacity 0.5s;
  pointer-events: none;
}

.btn:active::after {
  transform: translate(-50%, -50%) scale(2);
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #059669);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
}

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

.btn-secondary:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.08);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

.btn-ghost {
  background: transparent;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
}

/* ==========================================================================
   CARDS
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: var(--transition-normal);
}

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

.card-glass {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 24px;
  transition: var(--transition-normal);
}

.card-glass:hover {
  border-color: var(--border-hover);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), var(--shadow-glow);
}

.stat-card {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   TABLES
   ========================================================================== */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th {
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 14px 16px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: rgba(255,255,255,0.01);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 0.875rem;
  color: var(--text-primary);
}

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

.data-table tbody tr:hover {
  background: rgba(16, 185, 129, 0.02);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ==========================================================================
   FORMS
   ========================================================================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-family);
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: var(--transition-normal);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(255,255,255,0.02);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-family);
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: var(--transition-normal);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px;
}

.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ==========================================================================
   BADGES
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-success { background: rgba(16, 185, 129, 0.12); color: #34d399; }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: #f87171; }
.badge-info { background: rgba(59, 130, 246, 0.12); color: #60a5fa; }
.badge-neutral { background: rgba(148, 163, 184, 0.08); color: #94a3b8; }

/* ==========================================================================
   LAYOUTS
   ========================================================================== */
.module-container {
  padding: 32px;
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) ease-out;
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.module-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.02em;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-bar {
  max-width: 320px;
  width: 100%;
}

.filters-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-muted);
  text-align: center;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}

.empty-state span {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state h3 {
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 4px;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 260px;
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition-normal);
}

.sidebar-logo {
  padding: 24px 20px;
  font-size: 1.5rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-logo span {
  font-weight: 400;
  font-size: 0.75rem;
  display: block;
  color: var(--text-muted);
  margin-top: 4px;
  -webkit-text-fill-color: initial;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-normal);
  border-left: 3px solid transparent;
  font-weight: 500;
  font-size: 0.9rem;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: rgba(16, 185, 129, 0.06);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.sidebar-item-icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  border: 1px solid rgba(16,185,129,0.2);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  min-height: 64px;
}

.header-greeting {
  font-weight: 600;
  font-size: 1.125rem;
}

.header-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.theme-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition-normal);
  font-size: 1.1rem;
}

.theme-toggle:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--border-hover);
}

/* ==========================================================================
   MAIN LAYOUT
   ========================================================================== */
#main-app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

#app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: 260px;
  overflow: hidden;
}

#main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-primary);
}

/* ==========================================================================
   MODAL DIALOG
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 560px;
  width: 90%;
  animation: scaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) ease-out;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.modal-content.modal-lg { max-width: 720px; }
.modal-content.modal-sm { max-width: 400px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-secondary);
  opacity: 0.6;
  transition: opacity 0.2s;
}

.modal-close:hover {
  opacity: 1;
}

.modal-body {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 320px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1) ease-out;
  transition: all 0.3s;
}

.toast.toast-exit {
  opacity: 0;
  transform: translateX(120%);
}

.toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.toast-message {
  font-size: 0.875rem;
  font-weight: 500;
  flex: 1;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--info); }

/* ==========================================================================
   MOBILE & RESPONSIVE MEDIA QUERIES
   ========================================================================== */

/* Show/Hide sidebar toggle in header */
#sidebar-toggle-btn {
  display: none !important;
}

@media (max-width: 768px) {
  #sidebar-toggle-btn {
    display: inline-flex !important;
  }

  /* Main Layout overrides */
  #app-content {
    margin-left: 0 !important;
    width: 100vw;
  }

  /* Sidebar drawer behavior */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
    z-index: 999;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6), var(--shadow-glow);
  }

  /* Header mobile adjustment */
  .header {
    padding: 12px 16px;
    min-height: 56px;
  }

  .header-greeting {
    font-size: 1rem;
  }

  .header-date {
    font-size: 0.72rem;
  }

  .header-actions #header-breadcrumb {
    display: none; /* Hide breadcrumb chip on mobile to save horizontal space */
  }

  /* Module container general styling */
  .module-container {
    padding: 16px;
  }

  .module-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 20px;
  }

  .module-title {
    font-size: 1.4rem;
  }

  /* Stack system grids */
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Make filter rows stack cleanly */
  .filters-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 16px;
  }

  .filters-row > * {
    width: 100% !important;
    max-width: none !important;
  }

  /* Make sure data tables inside cards are horizontally scrollable */
  .card {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    padding: 16px; /* slightly smaller padding on mobile */
  }

  /* Modal responsive behavior */
  .modal-content {
    padding: 20px 16px;
    width: 95%;
    max-height: 90vh;
  }

  .modal-footer {
    margin-top: 20px;
    padding-top: 16px;
  }
}

@media (max-width: 480px) {
  /* Forms mobile adjustment */
  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Toast notification center */
  .toast-container {
    top: 16px;
    left: 16px;
    right: 16px;
  }

  .toast {
    min-width: 0;
    width: 100%;
    padding: 12px 16px;
  }
}

