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

/* Custom CSS for the admin dashboard - Light Industrial Theme */

@layer base {
  body {
    @apply bg-gray-100 text-gray-700;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  main {
      @apply p-4 md:p-6;
  }
  h1, h2, h3, h4, h5, h6 {
      @apply text-gray-800;
  }
}

@layer components {
  .card {
    @apply bg-white rounded-lg shadow-md p-4 border border-gray-200;
  }
  .table-wrapper {
      @apply bg-white rounded-lg shadow-md overflow-x-auto border border-gray-200;
  }
  table {
      @apply min-w-full divide-y divide-gray-200;
  }
  thead {
      @apply bg-gray-50;
  }
  th {
      @apply px-4 py-3 text-left text-xs font-medium text-gray-600 uppercase tracking-wider;
  }
  tbody {
      @apply bg-white divide-y divide-gray-200;
  }
  td {
      @apply px-4 py-3 whitespace-nowrap text-sm text-gray-700;
  }
  td.actions a,
  td.actions button {
      @apply text-red-600 hover:text-red-800 mr-2;
  }
  td.actions a.secondary,
  td.actions button.secondary {
      @apply text-gray-600 hover:text-gray-800;
  }
  .form-input {
      @apply mt-1 block w-full px-3 py-2 bg-white border border-gray-300 rounded-md text-gray-700 placeholder-gray-400 focus:outline-none focus:ring-red-500 focus:border-red-500 sm:text-sm;
  }
  .form-select {
       @apply mt-1 block w-full pl-3 pr-10 py-2 text-base bg-white border-gray-300 focus:outline-none focus:ring-red-500 focus:border-red-500 sm:text-sm rounded-md text-gray-700;
  }
  .form-label {
      @apply block text-sm font-medium text-gray-700;
  }
   .badge {
      @apply px-2.5 py-0.5 rounded-full text-xs font-medium;
  }
  .badge-green {
      @apply bg-green-100 text-green-800 border border-green-200;
  }
  .badge-red {
       @apply bg-red-100 text-red-800 border border-red-200;
  }
   .badge-yellow {
      @apply bg-yellow-100 text-yellow-800 border border-yellow-200;
  }
  .btn {
     @apply py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 transition duration-150 ease-in-out;
  }
  .btn-primary {
     @apply text-white bg-red-600 hover:bg-red-700 focus:ring-red-500;
  }
  .btn-secondary {
      @apply text-gray-700 bg-gray-200 hover:bg-gray-300 focus:ring-gray-500 border-gray-300;
  }
  .btn-sm {
      @apply py-1 px-2 text-xs;
  }
  
  /* Fixed Layout System */
  .admin-layout {
    @apply flex min-h-screen bg-gray-100;
  }
  
  /* Main content area - properly positioned next to sidebar */
  .main-content {
    @apply flex-1 flex flex-col min-h-screen;
  }
  
  .main-content-with-sidebar {
    @apply ml-0 md:ml-60 w-full;
  }
}

/* Ensure proper spacing on desktop */
@media (min-width: 768px) {
  .main-content-with-sidebar {
      margin-left: 15rem; /* 240px sidebar width */
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f3f4f6; /* gray-100 */
}

::-webkit-scrollbar-thumb {
  background: #d1d5db; /* gray-300 */
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af; /* gray-400 */
}

/* Alpine JS hiding */
[x-cloak] { display: none !important; }

/* Style for active sidebar link */
.sidebar-active {
    @apply bg-red-600 text-white;
}

/* Basic styling for tables */
table th {
    @apply bg-gray-50 text-gray-600;
}

table td {
    @apply border-b border-gray-200;
}

/* Chart container */
.chart-container {
  @apply relative h-64 md:h-80 w-full;
  min-height: 250px;
}

/* Custom shadows */
.industrial-shadow {
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

/* Grid for dashboard cards */
.stats-grid {
  @apply grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-4;
}

/* Dashboard page layout */
.dashboard-layout {
  @apply grid grid-cols-1 lg:grid-cols-3 gap-6;
}

/* Mobile navigation */
.mobile-nav-open {
  @apply transform translate-x-0;
} 

/* ONIX 555 Ltd. Admin Dashboard Styles */
:root {
  --primary-color: #ef4444;
  --primary-dark: #b91c1c;
  --primary-light: #fecaca;
  --secondary-color: #1f2937;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --info-color: #3b82f6;
  --light-gray: #f3f4f6;
  --medium-gray: #d1d5db;
  --dark-gray: #6b7280;
  --text-dark: #1f2937;
  --text-light: #f9fafb;
  --border-radius: 0.5rem;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --transition: all 0.3s ease;
}

/* Base Styles */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-dark);
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

/* Layout - Fixed positioning for sidebar */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background-color: #f3f4f6;
}

/* Main content positioning */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.main-content-with-sidebar {
  margin-left: 0;
}

@media (min-width: 768px) {
  .main-content-with-sidebar {
    margin-left: 240px; /* Exact sidebar width */
  }
}

/* Sidebar positioning */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background-color: #f9fafb;
  border-right: 1px solid #e5e7eb;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 40;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.sidebar.open {
  transform: translateX(0);
}

@media (min-width: 768px) {
  .sidebar {
    transform: translateX(0);
    position: fixed;
  }
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  text-decoration: none;
}

.sidebar-close {
  display: block;
  color: #6b7280;
  cursor: pointer;
}

@media (min-width: 768px) {
  .sidebar-close {
    display: none;
  }
}

.sidebar-nav {
  padding: 1rem 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: #4b5563;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.15s ease;
  margin: 0 0.5rem;
  border-radius: 0.375rem;
}

.sidebar-nav-item:hover,
.sidebar-nav-item.active {
  background-color: #ef4444;
  color: white;
}

.sidebar-nav-item svg {
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.75rem;
}

/* Header */
.header {
  background-color: white;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin-left: 2rem;
}

@media (min-width: 768px) {
  .header-title {
    margin-left: 0;
  }
}

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

.menu-toggle {
  display: block;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.5rem;
  color: #4b5563;
  cursor: pointer;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

@media (min-width: 768px) {
  .menu-toggle {
    display: none;
  }
}

/* Remove any conflicting styles */
.user-dropdown {
  position: relative;
}

.user-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  min-width: 12rem;
  z-index: 50;
  display: none;
}

.user-menu.show {
  display: block;
}

.user-menu-item {
  display: block;
  padding: 0.75rem 1rem;
  color: #4b5563;
  text-decoration: none;
  font-size: 0.875rem;
  border-bottom: 1px solid #f3f4f6;
}

.user-menu-item:hover {
  background-color: #f9fafb;
  color: #1f2937;
}

/* Cards and components */
.card {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  padding: 1.5rem;
}

.product-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.badge-green {
  background-color: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.badge-red {
  background-color: #fecaca;
  color: #991b1b;
  border-color: #fca5a5;
}

.badge-yellow {
  background-color: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.badge-blue {
  background-color: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.btn svg {
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

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

.btn-primary:hover {
  background-color: #dc2626;
  border-color: #dc2626;
}

.btn-secondary {
  background-color: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}

.btn-secondary:hover {
  background-color: #e5e7eb;
  border-color: #9ca3af;
}

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

.btn-success:hover {
  background-color: #059669;
}

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

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-outline {
  background-color: transparent;
  border-color: #d1d5db;
}

.btn-outline-primary {
  color: #ef4444;
  border-color: #ef4444;
}

.btn-outline-primary:hover {
  background-color: #ef4444;
  color: white;
}

/* Forms */
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background-color: white;
  color: #1f2937;
  font-size: 0.875rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-checkbox {
  width: 1rem;
  height: 1rem;
  color: #ef4444;
  background-color: white;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.form-checkbox:checked {
  background-color: #ef4444;
  border-color: #ef4444;
}

.form-checkbox:checked::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 4px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.form-checkbox:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 0.5rem;
  overflow: hidden;
}

th {
  background-color: #f9fafb;
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
}

tbody tr:hover {
  background-color: #f9fafb;
}

/* Utilities */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 120px;
  background-color: #1f2937;
  color: white;
  text-align: center;
  border-radius: 0.375rem;
  padding: 0.5rem;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.75rem;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  max-width: 32rem;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 1.5rem 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 1rem;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
}

.modal-close {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: color 0.15s ease;
}

.modal-close:hover {
  color: #374151;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[x-cloak] {
  display: none !important;
} 