/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
  line-height: 1.6;
}

/* Login page styles */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 40px 30px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.logo h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: #667eea;
}

.logo p {
  color: #666;
  font-size: 1.1rem;
  margin-bottom: 30px;
}

.login-form {
  margin-bottom: 30px;
}

.input-group {
  margin-bottom: 20px;
  text-align: left;
}

.input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #555;
}

.input-group input {
  width: 100%;
  padding: 15px;
  border: 2px solid #e1e5e9;
  border-radius: 10px;
  font-size: 1.1rem;
  transition: border-color 0.3s ease;
}

.input-group input:focus {
  outline: none;
  border-color: #667eea;
}

.btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  background: #f8f9fa;
  color: #667eea;
  border: 2px solid #667eea;
}

.btn-secondary:hover {
  background: #667eea;
  color: white;
}

.error-message {
  background: #fee;
  color: #c33;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
  border-left: 4px solid #c33;
}

.pin-info {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  color: #666;
}

.pin-info p {
  margin-bottom: 5px;
}

/* Dashboard styles */
.dashboard {
  min-height: 100vh;
  background: #f5f7fa;
}

.header {
  background: white;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.header h1 {
  color: #667eea;
  font-size: 1.5rem;
}

.user-info-header {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 1.2rem;
  font-weight: 500;
}

.user-role {
  color: #667eea;
  margin-right: 8px;
}

.user-name {
  color: #333;
  margin-right: 8px;
}

.logout-btn {
  background: #e53e3e;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
  cursor: pointer;
  font-size: 1rem;
}

.logout-btn:hover {
  background: #c53030;
}

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.menu-card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.menu-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
  border-color: #667eea;
}

.menu-card h3 {
  color: #667eea;
  margin-bottom: 10px;
  font-size: 1.3rem;
}

.menu-card p {
  color: #666;
  font-size: 0.95rem;
}

.menu-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
  display: block;
}

/* Quick stats styles */
.quick-stats {
  margin-bottom: 30px;
}

.quick-stats h2 {
  color: #667eea;
  margin-bottom: 20px;
  font-size: 1.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.stat-card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  border-left: 4px solid #667eea;
}

.stat-card h3 {
  font-size: 2rem;
  color: #667eea;
  margin-bottom: 10px;
}

.stat-card p {
  color: #666;
  font-size: 0.9rem;
}

/* Form styles */
.form-container {
  background: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  max-width: 600px;
  margin: 0 auto;
}

.form-title {
  text-align: center;
  margin-bottom: 30px;
  color: #667eea;
  font-size: 1.8rem;
}

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

@media (min-width: 768px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
}

/* Table styles */
.table-container {
  background: white;
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  overflow-x: auto;
}

.table-title {
  margin-bottom: 20px;
  color: #667eea;
  font-size: 1.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e1e5e9;
}

th {
  background: #f8f9fa;
  font-weight: 600;
  color: #555;
}

tr:hover {
  background: #f8f9fa;
}

/* Search form styles */
.search-form {
  margin-bottom: 30px;
  background: white;
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 15px;
  align-items: end;
}

.search-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-group input,
.search-group select {
  padding: 12px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 1rem;
  background: #f8f9fa;
  transition: border-color 0.3s;
}

.search-group input:focus {
  border-color: #667eea;
  background: #fff;
}

.search-group .btn {
  padding: 12px 20px;
  font-size: 1rem;
  width: 100%;
  margin-bottom: 0;
}

.table-footer {
  margin-top: 20px;
  text-align: center;
  color: #666;
}

/* Stock management styles */
.stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stock-card {
  background: white;
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  border-left: 4px solid #28a745;
}

.stock-card.low {
  border-left-color: #dc3545;
}

.stock-card h4 {
  color: #333;
  margin-bottom: 10px;
}

.stock-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
}

.stock-quantity {
  font-weight: 600;
  font-size: 1.2rem;
}

.stock-quantity.low {
  color: #dc3545;
}

.stock-actions {
  display: flex;
  gap: 10px;
}

.btn-small {
  padding: 8px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}

/* Check-in styles */
.checkin-container {
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}

.code-input {
  font-size: 2rem;
  text-align: center;
  letter-spacing: 5px;
  font-weight: bold;
  margin-bottom: 20px;
}

.success-message {
  background: #d4edda;
  color: #155724;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
  border-left: 4px solid #28a745;
}

/* Housekeeping styles */
.task-list {
  margin-bottom: 30px;
}

.task-item {
  background: white;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.task-info h4 {
  color: #333;
  margin-bottom: 5px;
}

.task-info p {
  color: #666;
  font-size: 0.9rem;
}

.task-status {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.task-status.open {
  background: #fff3cd;
  color: #856404;
}

.task-status.closed {
  background: #d4edda;
  color: #155724;
}

/* Responsive design */
@media (max-width: 768px) {
  .login-card {
    padding: 30px 20px;
  }

  .logo h1 {
    font-size: 2rem;
  }

  .header-content {
    flex-direction: column;
    gap: 15px;
  }

  .menu-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .stock-grid {
    grid-template-columns: 1fr;
  }

  .task-item {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .code-input {
    font-size: 1.5rem;
    letter-spacing: 3px;
  }

  .search-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .search-group {
    width: 100%;
  }

  .search-group .btn {
    margin-bottom: 8px;
  }

  .search-group input {
    width: 100%;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }

  table {
    min-width: 700px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .table-responsive {
    overflow-x: auto;
  }
  table {
    min-width: unset !important;
    width: 100%;
    font-size: 0.92rem;
  }
  th,
  td {
    padding: 6px 4px !important;
    white-space: normal !important;
    word-break: break-word;
  }
  .table-title {
    font-size: 1.1rem;
  }
}

@media (max-width: 600px) {
  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
    width: 100%;
  }
  thead tr {
    display: none;
  }
  tr {
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    padding: 0.5rem;
    background: #fff;
  }
  td {
    position: relative;
    padding-left: 50% !important;
    min-height: 2.5em;
    border: none;
    border-bottom: 1px solid #eee;
    text-align: left;
    box-sizing: border-box;
  }
  td:before {
    position: absolute;
    left: 0.75rem;
    top: 0.5rem;
    width: 45%;
    white-space: nowrap;
    font-weight: bold;
    content: attr(data-label);
    color: #888;
    font-size: 0.95em;
  }
  .table-actions {
    flex-direction: row;
    gap: 8px;
    justify-content: flex-start;
  }
  .table-title {
    font-size: 1rem;
  }
}

/* Loading spinner */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Back button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #667eea;
  text-decoration: none;
  margin-bottom: 20px;
  font-weight: 600;
}

.back-btn:hover {
  text-decoration: underline;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  margin-bottom: 10px;
}

.form-checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.form-checkbox-group input[type='checkbox'] {
  transform: scale(1.2);
  margin: 0;
}

.form-checkbox-group label {
  font-size: 1.1rem;
  color: #444;
  font-weight: 500;
  margin: 0;
  cursor: pointer;
}

.btn-danger {
  background: #e53e3e;
  color: #fff;
  border: 2px solid #e53e3e;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}
.btn-danger:hover {
  background: #c53030;
  color: #fff;
  border-color: #c53030;
}

.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}

.table-actions .btn {
  width: auto;
  min-width: 60px;
  text-align: center;
  display: inline-block;
}

/* Barcode-specific utilities */
.barcode-value {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: #667eea;
  background: #f0f4ff;
  padding: 3px 8px;
  border-radius: 4px;
}

.btn-success {
  background: #28a745;
  color: white;
  border: 2px solid #28a745;
}

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