@tailwind base;
@tailwind components;
@tailwind utilities;

@layer components {
  /* Dashboard Components */
  .dashboard-card {
    @apply bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 p-6;
  }
  
  .dashboard-card-header {
    @apply flex items-center justify-between mb-4;
  }
  
  .dashboard-card-title {
    @apply text-lg font-semibold text-gray-900 dark:text-white;
  }
  
  .dashboard-card-subtitle {
    @apply text-sm text-gray-500 dark:text-gray-400;
  }
  
  .dashboard-stat-number {
    @apply text-3xl font-bold text-gray-900 dark:text-white;
  }
  
  .dashboard-stat-label {
    @apply text-sm font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wide;
  }
  
  .dashboard-sidebar {
    @apply bg-gray-900 text-white w-64 min-h-screen p-6;
  }
  
  .dashboard-sidebar-item {
    @apply flex items-center space-x-3 px-3 py-2 rounded-lg text-gray-300 hover:text-white hover:bg-gray-800 transition-colors duration-200;
  }
  
  .dashboard-sidebar-item.active {
    @apply bg-primary-600 text-white;
  }
  
  .dashboard-header {
    @apply bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-6 py-4;
  }
  
  .dashboard-main {
    @apply bg-gray-50 dark:bg-gray-900 min-h-screen p-6;
  }
  
  .dashboard-grid {
    @apply grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6;
  }
  
  .dashboard-chart-card {
    @apply dashboard-card col-span-1 md:col-span-2;
  }
  
  .dashboard-table {
    @apply w-full text-sm text-left text-gray-500 dark:text-gray-400;
  }
  
  .dashboard-table th {
    @apply px-6 py-3 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider;
  }
  
  .dashboard-table td {
    @apply px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-white;
  }
  
  .dashboard-table tbody tr {
    @apply bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-700;
  }
  
  .btn-primary {
    @apply bg-primary-600 hover:bg-primary-700 text-white font-medium py-2 px-4 rounded-lg transition-colors duration-200;
  }
  
  .btn-secondary {
    @apply bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-900 dark:text-white font-medium py-2 px-4 rounded-lg transition-colors duration-200;
  }
  
  .progress-bar {
    @apply w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2;
  }
  
  .progress-fill {
    @apply bg-primary-600 h-2 rounded-full transition-all duration-300;
  }
  
  .notification-dot {
    @apply absolute -top-1 -right-1 h-3 w-3 bg-red-500 rounded-full;
  }
  
  .avatar {
    @apply h-8 w-8 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center text-sm font-medium text-gray-700 dark:text-gray-300;
  }

  /* Pagination Styles - Match existing app pagination */
  .activity-pagination {
    @apply mt-6 flex justify-center;
  }

  .activity-pagination .pagination {
    @apply flex flex-col items-center gap-4;
  }

  .activity-pagination .pagination-info {
    @apply text-sm text-gray-500 dark:text-gray-400;
  }

  .activity-pagination .pagination-links {
    @apply flex gap-2 items-center;
  }

  /* Target Kaminari-generated HTML structure */
  .activity-pagination .pagination a,
  .activity-pagination .pagination span {
    @apply inline-block px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-white transition-colors duration-200 text-center min-w-[44px];
  }

  .activity-pagination .pagination .current {
    @apply bg-blue-600 text-white border-blue-600 font-semibold;
  }

  .activity-pagination .pagination .disabled {
    @apply opacity-50 cursor-not-allowed hover:bg-white dark:hover:bg-gray-800 hover:text-gray-700 dark:hover:text-gray-300;
  }

  .activity-pagination .pagination .gap {
    @apply px-1 py-2 text-gray-500 dark:text-gray-400 text-sm;
  }

  .activity-pagination .pagination .prev,
  .activity-pagination .pagination .next {
    @apply font-medium;
  }

  /* Override Kaminari's default styling more aggressively */
  .activity-pagination .pagination {
    @apply !flex !flex-col !items-center !gap-4;
  }

  .activity-pagination .pagination a,
  .activity-pagination .pagination span {
    @apply !inline-block !px-4 !py-2 !text-sm !font-medium !text-gray-700 !bg-white !border !border-gray-300 !rounded-md hover:!bg-gray-50 hover:!text-gray-900 !transition-colors !duration-200 !text-center !min-w-[44px] !no-underline;
  }

  .activity-pagination .pagination .current {
    @apply !bg-blue-600 !text-white !border-blue-600 !font-semibold;
  }

  /* Error Alert Styles */
  .error-alert {
    @apply bg-red-50 border border-red-200 rounded-lg p-4 mb-6 !important;
  }

  .error-alert-header {
    @apply flex items-start space-x-3 !important;
  }

  .error-alert-icon {
    @apply flex-shrink-0 w-5 h-5 text-red-400 mt-0.5 !important;
  }

  .error-alert-content {
    @apply flex-1 min-w-0 !important;
  }

  .error-alert-title {
    @apply text-sm font-medium text-red-800 mb-2 !important;
  }

  .error-alert-list {
    @apply space-y-1 !important;
  }

  .error-alert-item {
    @apply flex items-start space-x-2 text-sm text-red-700 !important;
  }

  .error-alert-bullet {
    @apply flex-shrink-0 text-red-500 font-bold !important;
  }

  /* Override any existing error_explanation styles */
  #error_explanation {
    @apply bg-red-50 border border-red-200 rounded-lg p-4 mb-6 !important;
  }

  #error_explanation h2,
  #error_explanation h3 {
    @apply text-sm font-medium text-red-800 mb-2 !important;
  }

  #error_explanation ul {
    @apply space-y-1 !important;
  }

  #error_explanation li {
    @apply flex items-start space-x-2 text-sm text-red-700 !important;
  }

  /* Success Alert Styles (for consistency) */
  .success-alert {
    @apply bg-green-50 border border-green-200 rounded-lg p-4 mb-6;
  }

  .success-alert-header {
    @apply flex items-start space-x-3;
  }

  .success-alert-icon {
    @apply flex-shrink-0 w-5 h-5 text-green-400 mt-0.5;
  }

  .success-alert-content {
    @apply flex-1 min-w-0;
  }

  .success-alert-title {
    @apply text-sm font-medium text-green-800 mb-2;
  }

  .success-alert-message {
    @apply text-sm text-green-700;
  }

  /* Info Alert Styles (for consistency) */
  .info-alert {
    @apply bg-blue-50 border border-blue-200 rounded-lg p-4 mb-6;
  }

  .info-alert-header {
    @apply flex items-start space-x-3;
  }

  .info-alert-icon {
    @apply flex-shrink-0 w-5 h-5 text-blue-400 mt-0.5;
  }

  .info-alert-content {
    @apply flex-1 min-w-0;
  }

  .info-alert-title {
    @apply text-sm font-medium text-blue-800 mb-2;
  }

  .info-alert-message {
    @apply text-sm text-blue-700;
  }
}
/* Navbar styles */
.navbar {
  background: transparent;
  padding: 15px 0;
  transition: all 0.3s ease;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

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

.brand-text {
  font-size: 1.4rem;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-logo {
  height: 40px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

.portal-button {
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  background: linear-gradient(135deg, #25A3D8, #1e90ff);
  color: white;
  border-radius: 20px;
  text-decoration: none;
  transition: all 0.3s ease;
  border: none;
  margin-left: 8px;
}

.portal-button:hover {
  background: linear-gradient(135deg, #1e90ff, #25A3D8);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 163, 216, 0.3);
}

/* Ensure nav-link hover effects take precedence for dropdown toggles */
.nav-link.dropdown-toggle.portal-button {
  background: linear-gradient(135deg, #25A3D8, #1e90ff) !important;
  border: none !important;
  border-radius: 6px !important;
  padding: 8px 16px !important;
  margin-left: 8px !important;
  color: white !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.3s ease !important;
}

.nav-link.dropdown-toggle.portal-button:hover {
  background: linear-gradient(135deg, #1e90ff, #25A3D8) !important;
  color: white !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(37, 163, 216, 0.3) !important;
}

/* Override inline styles from view files with maximum specificity */
.navbar-nav .nav-link.dropdown-toggle.portal-button:hover,
.navbar .nav-link.dropdown-toggle.portal-button:hover,
body .nav-link.dropdown-toggle.portal-button:hover {
  background: linear-gradient(135deg, #1e90ff, #25A3D8) !important;
  color: white !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(37, 163, 216, 0.3) !important;
  border: none !important;
  border-radius: 6px !important;
}

/* Ensure navbar has proper z-index */
.navbar {
  z-index: 1100;
}

/* Additional fixes for dropdown clickability */
.nav-item.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1100;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border: none;
  padding: 8px 0;
  min-width: 200px;
  margin-top: 8px;
}

.dropdown-item {
  padding: 12px 20px;
  color: #374151;
  text-decoration: none;
  display: block;
  transition: background-color 0.2s ease;
}

.dropdown-item:hover {
  background-color: #f3f4f6;
  color: #1f2937;
}

.dropdown-divider {
  height: 1px;
  background-color: #e5e7eb;
  margin: 8px 0;
}

/* Ensure no other elements block the dropdown */
.navbar-nav {
  position: relative;
  z-index: 1100;
}

.navbar-collapse {
  position: relative;
  z-index: 1100;
}

/* Completely isolate dropdown from Turbo interference */
.nav-item.dropdown[data-turbo="false"] {
  position: relative;
  z-index: 1100;
}

/* Navbar toggler styles */
.navbar-toggler {
  border: none;
  padding: 4px 8px; 
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  display: none;
}

.navbar-toggler:focus {
  box-shadow: none;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  width: 20px;
  height: 20px;
}

/* Navbar collapse styling */
.navbar-collapse {
  background: transparent;
}

/* Desktop: hide toggler, show nav items */
@media (min-width: 992px) {
  .navbar-toggler {
    display: none !important;
  }
  
  .navbar-collapse {
    display: block !important;
    margin-top: 0;
    background: transparent !important;
    border-radius: 0;
    padding: 0;
    backdrop-filter: none;
    box-shadow: none;
  }
  
  .navbar-nav {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
}

/* Mobile navbar styles */
@media (max-width: 991px) {
  /* Make navbar absolute on mobile */
  .navbar {
    position: absolute !important;
    background: transparent !important;
  }

  /* Show hamburger menu on mobile */
  .navbar-toggler {
    display: block !important;
  }

  /* Hide the navbar collapse by default on mobile */
  .navbar-collapse {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    min-width: 250px;
    display: none;
  }

  .navbar-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin: 0;
  }
  
  .portal-button {
    width: 100%;
    text-align: center;
    margin: 0;
    padding: 12px 20px;
  }
}
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */
