/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Header sticky */
header.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--pico-background-color);
  border-bottom: 1px solid var(--pico-muted-border-color);
  padding: 0;
}

header.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
}

header.navbar .logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

header.navbar .logo .logo-image {
  height: 40px;
  width: auto;
  display: block;
}

header.navbar .nav-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

header.navbar .nav-actions span {
  color: var(--pico-muted-color);
}

header.navbar .nav-actions button {
  margin: 0;
  padding: 0.5rem 1rem;
}

/* Sidebar menu */
.sidebar {
  position: fixed;
  top: 0;
  right: -300px;
  width: 300px;
  height: 100vh;
  background: var(--pico-background-color);
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  transition: right 0.3s ease;
  z-index: 2000;
  overflow-y: auto;
  padding: 2rem 1rem;
}

.sidebar.open {
  right: 0;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.sidebar-header h3 {
  margin: 0;
}

.sidebar-header button {
  padding: 0.5rem;
  margin: 0;
}

.sidebar nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar nav ul li {
  margin-bottom: 0.5rem;
}

.sidebar nav ul li a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--pico-color);
  text-decoration: none;
  border-radius: var(--pico-border-radius);
  transition: background-color 0.2s ease;
}

.sidebar nav ul li a:hover {
  background-color: var(--pico-primary-hover);
  color: var(--pico-primary-inverse);
}

.sidebar nav ul li a i {
  width: 1.5rem;
  text-align: center;
}

/* Main content */
main.container {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

/* Flash Messages */
.flash-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
}

.flash-message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
}

.flash-message.flash-show {
  opacity: 1;
  transform: translateX(0);
}

.flash-message.flash-hide {
  opacity: 0;
  transform: translateX(100%);
}

.flash-notice {
  background-color: #10b981;
  color: white;
  border-left: 4px solid #059669;
}

.flash-alert {
  background-color: #ef4444;
  color: white;
  border-left: 4px solid #dc2626;
}

.flash-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.flash-content i {
  font-size: 1.25rem;
}

.flash-content span {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.4;
}

.flash-close {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  transition: opacity 0.2s ease;
  font-size: 1rem;
  margin: 0;
  width: auto;
  height: auto;
}

.flash-close:hover {
  opacity: 1;
  background: transparent;
}

/* Responsive */
@media (max-width: 768px) {
  .flash-container {
    left: 20px;
    right: 20px;
    max-width: calc(100% - 40px);
  }
}

/* Authentication Pages */
.auth-container {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  background: var(--pico-card-background-color);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  padding: 2.5rem;
  width: 100%;
  max-width: 600px;
  border: 1px solid var(--pico-muted-border-color);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header .auth-logo {
  display: block;
  max-width: 200px;
  height: auto;
  margin: 0 auto 1.5rem;
}

.auth-header i {
  font-size: 3rem;
  color: var(--pico-primary);
  margin-bottom: 1rem;
  display: block;
}

.auth-header h2 {
  margin: 0 0 0.5rem 0;
  color: var(--pico-color);
  font-size: 1.75rem;
}

.auth-header p {
  margin: 0;
  color: var(--pico-muted-color);
  font-size: 0.95rem;
}

.auth-form {
  margin-bottom: 1.5rem;
}

.auth-form .form-group {
  margin-bottom: 1.5rem;
}

.auth-form .form-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  color: var(--pico-color);
  font-weight: 600;
  font-size: 0.95rem;
}

.auth-form .form-group label i {
  color: var(--pico-primary);
  font-size: 1rem;
}

.auth-form .form-group input[type="email"],
.auth-form .form-group input[type="password"],
.auth-form .form-group input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background-color: var(--pico-background-color);
  color: var(--pico-color);
}

.auth-form .form-group input:focus {
  outline: none;
  border-color: var(--pico-primary);
  box-shadow: 0 0 0 3px var(--pico-primary-focus);
}

.auth-form .form-group-checkbox {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}

.auth-form .form-group-checkbox label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin: 0;
}

.auth-form .form-group-checkbox input[type="checkbox"] {
  margin: 0;
  width: auto;
}

.auth-form .form-group-checkbox span {
  color: var(--pico-color);
  font-size: 0.9rem;
}

.auth-form .form-actions {
  margin-top: 2rem;
}

.auth-form .btn-primary {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: var(--pico-primary);
  color: var(--pico-primary-inverse);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  margin: 0;
}

.auth-form .btn-primary:hover {
  background: var(--pico-primary-hover);
  transform: translateY(-1px);
}

.auth-form .btn-primary:active {
  transform: translateY(0);
}

.auth-links {
  text-align: center;
  margin-top: 1.5rem;
}

.auth-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--pico-primary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
  padding: 0.5rem;
}

.auth-link:hover {
  color: var(--pico-primary-hover);
  text-decoration: underline;
}

.auth-link i {
  font-size: 0.85rem;
}

.auth-divider {
  margin: 1.5rem 0;
  text-align: center;
  position: relative;
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--pico-muted-border-color);
}

.auth-divider span {
  position: relative;
  background: var(--pico-card-background-color);
  padding: 0 1rem;
  color: var(--pico-muted-color);
  font-size: 0.85rem;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: var(--pico-primary);
  border: 2px solid var(--pico-primary);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  margin: 0;
}

.btn-secondary:hover {
  background: var(--pico-primary);
  color: var(--pico-primary-inverse);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-secondary i {
  font-size: 0.9rem;
}

/* Responsive Auth Pages */
@media (max-width: 768px) {
  .auth-card {
    padding: 2rem 1.5rem;
    margin: 1rem;
  }

  .auth-header h2 {
    font-size: 1.5rem;
  }

  .auth-header i {
    font-size: 2.5rem;
  }

  .auth-header .auth-logo {
    max-width: 150px;
  }
}

/* Responsive Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

figure.table-container {
  margin: 0;
  padding: 0;
}

/* Table styling improvements */
table[role="grid"] {
  min-width: 100%;
  white-space: nowrap;
}

table[role="grid"] th {
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

table[role="grid"] td {
  vertical-align: middle;
}

/* Make tables more mobile-friendly */
@media (max-width: 768px) {
  table[role="grid"] {
    font-size: 0.875rem;
  }

  table[role="grid"] th,
  table[role="grid"] td {
    padding: 0.5rem;
  }

  /* Stack action buttons vertically on mobile */
  table[role="grid"] td:last-child {
    white-space: normal;
  }

  table[role="grid"] td:last-child a,
  table[role="grid"] td:last-child button {
    display: block;
    width: 100%;
    margin-bottom: 0.25rem;
  }

  table[role="grid"] td:last-child a:last-child,
  table[role="grid"] td:last-child button:last-child {
    margin-bottom: 0;
  }
}

/* Utility classes */
.d-flex {
  display: flex;
}

.justify-content-between {
  justify-content: space-between;
}

.align-items-center {
  align-items: center;
}

.mb-4 {
  margin-bottom: 2rem;
}

.mt-4 {
  margin-top: 2rem;
}

/* Badge styles */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25rem;
}

.badge.bg-primary {
  background-color: var(--pico-primary);
  color: var(--pico-primary-inverse);
}

.badge.bg-success {
  background-color: #10b981;
  color: white;
}

.badge.bg-secondary {
  background-color: var(--pico-muted-color);
  color: white;
}

/* Alert styles */
.alert {
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
}

.alert.alert-info {
  background-color: var(--pico-primary-focus);
  border-color: var(--pico-primary);
  color: var(--pico-color);
}

/* Button size variants */
.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

.btn-info {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.btn-warning {
  background-color: #f59e0b;
  color: white;
  border-color: #f59e0b;
}

.btn-danger {
  background-color: #ef4444;
  color: white;
  border-color: #ef4444;
}

/* Filter Form Styles */
details[open] summary {
  margin-bottom: 1rem;
}

details summary i {
  margin-right: 0.5rem;
}

details[open] summary i.fa-filter {
  color: var(--pico-primary);
}

/* Responsive filter form */
@media (max-width: 768px) {
  details summary {
    font-size: 0.95rem;
  }
}
