/**
 * Shift Management Styles for App Thợ
 * Giao diện Quản lý Ca - Thu Ngân & Quản Lý
 * @version 1.0.0
 */

/* ============================================
   Container & Layout
   ============================================ */
.shift-management-container {
  padding: 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .shift-management-container {
    padding: 1.5rem;
  }
}

/* ============================================
   Access Denied
   ============================================ */
.shift-access-denied {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  color: var(--text-secondary, #6b7280);
}

.shift-access-denied i {
  font-size: 4rem;
  color: var(--text-muted, #9ca3af);
  margin-bottom: 1rem;
}

.shift-access-denied h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  margin-bottom: 0.5rem;
}

.shift-access-denied p {
  color: var(--text-secondary, #6b7280);
}

/* ============================================
   Shift Header & Status Card
   ============================================ */
.shift-header {
  margin-bottom: 1.5rem;
}

.shift-status-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: 12px;
  background: var(--card-bg, #ffffff);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color, #e5e7eb);
  transition: all 0.3s ease;
}

.shift-status-card.shift-open {
  border-left: 4px solid #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), transparent);
}

.shift-status-card.shift-closed {
  border-left: 4px solid #6b7280;
}

.shift-status-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1.5rem;
}

.shift-open .shift-status-icon {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.shift-closed .shift-status-icon {
  background: rgba(107, 114, 128, 0.15);
  color: #6b7280;
}

.shift-status-info {
  flex: 1;
  min-width: 200px;
}

.shift-status-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  margin-bottom: 0.25rem;
}

.shift-status-detail {
  font-size: 0.875rem;
  color: var(--text-secondary, #6b7280);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.shift-status-detail span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.shift-opening-balance {
  font-size: 0.9rem;
  color: var(--text-secondary, #6b7280);
  margin-top: 0.35rem;
}

.shift-opening-balance strong {
  color: #10b981;
}

.shift-actions {
  display: flex;
  gap: 0.75rem;
}

/* ============================================
   Buttons
   ============================================ */
.shift-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.shift-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.shift-btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
}

.shift-btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.shift-btn-secondary {
  background: var(--btn-secondary-bg, #f3f4f6);
  color: var(--text-primary, #374151);
  border: 1px solid var(--border-color, #d1d5db);
}

.shift-btn-secondary:hover:not(:disabled) {
  background: var(--btn-secondary-hover, #e5e7eb);
}

.shift-btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
}

.shift-btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.shift-btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
}

.shift-btn-warning:hover:not(:disabled) {
  background: linear-gradient(135deg, #d97706, #b45309);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.shift-btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
}

.shift-btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.shift-btn-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
  transition: all 0.2s ease;
}

.shift-btn-icon:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.shift-btn-link {
  background: transparent;
  border: none;
  color: var(--primary-color, #3b82f6);
  cursor: pointer;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0;
}

.shift-btn-link:hover {
  text-decoration: underline;
}

/* ============================================
   Quick Stats
   ============================================ */
.shift-quick-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.shift-stat-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem;
  background: var(--card-bg, #ffffff);
  border-radius: 10px;
  border: 1px solid var(--border-color, #e5e7eb);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.shift-stat-card.shift-stat-highlight {
  border-color: #8b5cf6;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), transparent);
}

.shift-stat-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.shift-stat-icon.bg-blue {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.shift-stat-icon.bg-green {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.shift-stat-icon.bg-indigo {
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
}

.shift-stat-icon.bg-cyan {
  background: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
}

.shift-stat-icon.bg-red {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.shift-stat-icon.bg-purple {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
}

.shift-stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.shift-stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  white-space: normal;
  line-height: 1.3;
}

.shift-stat-label small {
  font-size: 0.6rem;
  text-transform: none;
  color: var(--text-muted, #9ca3af);
  font-weight: 400;
}

.shift-stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary, #1f2937);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   Section Headers
   ============================================ */
.shift-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.shift-section-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.shift-section-header h3 i {
  color: var(--primary-color, #3b82f6);
}

.shift-action-buttons {
  display: flex;
  gap: 0.5rem;
}

/* ============================================
   Transaction Section
   ============================================ */
.shift-transaction-section {
  background: var(--card-bg, #ffffff);
  border-radius: 12px;
  padding: 1.25rem;
  border: 1px solid var(--border-color, #e5e7eb);
  margin-bottom: 1.5rem;
}

.shift-transaction-list {
  margin-top: 1rem;
}

.shift-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: var(--text-secondary, #9ca3af);
  text-align: center;
}

.shift-empty-state i {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.shift-empty-state p {
  font-size: 0.9rem;
}

/* ============================================
   Transaction Table
   ============================================ */
.transaction-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.transaction-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.transaction-table th {
  text-align: left;
  padding: 0.75rem;
  background: var(--table-header-bg, #f9fafb);
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  color: var(--text-secondary, #6b7280);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.transaction-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color, #f3f4f6);
  color: var(--text-primary, #374151);
}

.transaction-row:hover {
  background: var(--row-hover-bg, #f9fafb);
}

.transaction-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}

.transaction-type-badge.receipt {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

.transaction-type-badge.payment {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.transaction-amount.receipt {
  color: #10b981;
  font-weight: 600;
}

.transaction-amount.payment {
  color: #ef4444;
  font-weight: 600;
}

.transaction-reason {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================
   Shift History Section
   ============================================ */
.shift-history-section {
  background: var(--card-bg, #ffffff);
  border-radius: 12px;
  padding: 1.25rem;
  border: 1px solid var(--border-color, #e5e7eb);
}

.shift-history-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.shift-select {
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 6px;
  background: var(--input-bg, #ffffff);
  color: var(--text-primary, #374151);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.25rem;
}

.shift-select:focus {
  outline: none;
  border-color: var(--primary-color, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.shift-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ============================================
   Shift History Item
   ============================================ */
.shift-history-item {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 10px;
  padding: 1rem;
  transition: all 0.2s ease;
}

.shift-history-item:hover {
  border-color: var(--primary-color, #3b82f6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.shift-history-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 0.75rem;
  padding: 10px;
  gap: 20px;
}

.shift-history-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: var(--text-primary, #1f2937);
}

.shift-history-user i {
  color: var(--primary-color, #3b82f6);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.open {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

.status-badge.closed,
.status-badge.handover_completed {
  background: rgba(107, 114, 128, 0.15);
  color: #4b5563;
}

.status-badge.handover_pending {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.shift-history-details {
  font-size: 0.875rem;
}

.shift-time-range {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--text-secondary, #6b7280);
  margin-bottom: 0.75rem;
}

.shift-time-range span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.shift-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-secondary, #f9fafb);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.summary-item {
  display: flex;
  flex-direction: column;
}

.summary-item .label {
  font-size: 0.75rem;
  color: var(--text-secondary, #6b7280);
}

.summary-item .value {
  font-weight: 600;
  color: var(--text-primary, #1f2937);
}

.summary-item.total .value {
  color: var(--primary-color, #3b82f6);
}

.shift-handover-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary, #4b5563);
}

.shift-handover-info i {
  color: #3b82f6;
}

.shift-history-actions {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  padding-right: 0.75rem;
  border-top: 1px solid var(--border-color, #f3f4f6);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
}

/* New layout: 2-column rows */
.shift-summary-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg-secondary, #f9fafb);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  gap: 20px;
}

.shift-summary-row:last-of-type {
  margin-bottom: 0.75rem;
}

.shift-summary-row .summary-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.shift-summary-row .summary-item .label {
  font-size: 0.75rem;
  color: var(--text-secondary, #6b7280);
  white-space: nowrap;
}

.shift-summary-row .summary-item .value {
  font-weight: 600;
  font-size: 0.875rem;
}

.shift-summary-row .summary-item .value.text-green {
  color: #10b981;
}

.shift-summary-row .summary-item .value.text-blue {
  color: #3b82f6;
}

.shift-time-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--text-secondary, #6b7280);
  font-size: 0.8rem;
}

.shift-time-info span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.shift-balance-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.shift-balance-info .label {
  font-size: 0.75rem;
  color: var(--text-secondary, #6b7280);
}

.shift-balance-info .value {
  font-weight: 600;
  color: var(--text-primary, #1f2937);
}

/* Desktop: 4 columns in 1 row for stats */
@media (min-width: 768px) {
  .shift-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
  }

  .shift-stats-row .summary-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

/* Mobile: 2 columns per row */
@media (max-width: 767px) {
  .shift-stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
}

/* ============================================
   Modal Styles
   ============================================ */
.shift-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.shift-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.shift-modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card-bg, #ffffff);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: modalSlideIn 0.2s ease;
}

.shift-modal-content.shift-modal-lg {
  max-width: 680px;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.shift-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.shift-modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.shift-modal-header h3 i {
  color: var(--primary-color, #3b82f6);
}

.shift-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary, #6b7280);
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.shift-modal-close:hover {
  background: var(--bg-secondary, #f3f4f6);
  color: var(--text-primary, #374151);
}

.shift-modal-body {
  padding: 1.5rem;
}

.shift-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color, #e5e7eb);
  background: var(--bg-secondary, #f9fafb);
  border-radius: 0 0 16px 16px;
}

/* ============================================
   Form Styles
   ============================================ */
.shift-form-group {
  margin-bottom: 1.25rem;
}

.shift-form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary, #374151);
  margin-bottom: 0.5rem;
}

.shift-form-group label .required {
  color: #ef4444;
}

.shift-input,
.shift-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 8px;
  background: var(--input-bg, #ffffff);
  color: var(--text-primary, #374151);
  transition: all 0.2s ease;
}

.shift-input:focus,
.shift-textarea:focus {
  outline: none;
  border-color: var(--primary-color, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.shift-input.currency-input {
  font-size: 1.125rem;
  font-weight: 600;
  text-align: right;
  padding-right: 1rem;
}

.shift-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary, #9ca3af);
  margin-top: 0.35rem;
}

.shift-form-divider {
  height: 1px;
  background: var(--border-color, #e5e7eb);
  margin: 1.5rem 0;
}

/* Radio buttons */
.shift-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.shift-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.625rem 1rem;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 8px;
  background: var(--input-bg, #ffffff);
  transition: all 0.2s ease;
}

.shift-radio:hover {
  border-color: var(--primary-color, #3b82f6);
}

.shift-radio input[type='radio'] {
  display: none;
}

.shift-radio input[type='radio']:checked + .radio-custom::after {
  opacity: 1;
  transform: scale(1);
}

.shift-radio input[type='radio']:checked ~ .radio-label {
  color: var(--primary-color, #3b82f6);
  font-weight: 500;
}

.radio-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color, #d1d5db);
  border-radius: 50%;
  position: relative;
  transition: all 0.2s ease;
}

.shift-radio input[type='radio']:checked + .radio-custom {
  border-color: var(--primary-color, #3b82f6);
}

.radio-custom::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-color, #3b82f6);
  opacity: 0;
  transform: scale(0);
  transition: all 0.2s ease;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-primary, #374151);
  font-size: 0.9rem;
}

/* ============================================
   Close Shift Summary
   ============================================ */
.close-shift-summary {
  background: var(--bg-secondary, #f9fafb);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.close-shift-summary h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  margin-bottom: 0.75rem;
}

.summary-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  padding: 0.35rem 0;
}

.summary-row.summary-total {
  border-top: 1px solid var(--border-color, #e5e7eb);
  margin-top: 0.5rem;
  padding-top: 0.75rem;
}

.text-green {
  color: #10b981;
}

.text-red {
  color: #ef4444;
}

/* Balance Difference Alert */
.balance-difference-alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.balance-difference-alert i {
  color: #f59e0b;
}

/* ============================================
   Shift Detail Modal
   ============================================ */
.shift-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.detail-section {
  background: var(--bg-secondary, #f9fafb);
  border-radius: 10px;
  padding: 1rem;
}

.detail-section.full-width {
  grid-column: 1 / -1;
}

.detail-section h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-color, #3b82f6);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  font-size: 0.875rem;
}

.detail-row .label {
  color: var(--text-secondary, #6b7280);
}

.detail-row .value {
  font-weight: 500;
  color: var(--text-primary, #1f2937);
}

.detail-row.total {
  border-top: 1px solid var(--border-color, #e5e7eb);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

.detail-row.total .value {
  color: var(--primary-color, #3b82f6);
  font-weight: 600;
}

/* ============================================
   Dark Mode Support
   ============================================ */
.dark .shift-status-card,
.dark .shift-stat-card,
.dark .shift-transaction-section,
.dark .shift-history-section,
.dark .shift-history-item,
.dark .shift-modal-content {
  background: var(--card-bg-dark, #1f2937);
  border-color: var(--border-color-dark, #374151);
}

.dark .shift-status-title,
.dark .shift-stat-value,
.dark .shift-section-header h3,
.dark .shift-history-user,
.dark .summary-item .value,
.dark .shift-modal-header h3,
.dark .shift-form-group label,
.dark .shift-input,
.dark .shift-textarea,
.dark .shift-select {
  color: var(--text-primary-dark, #f3f4f6);
}

.dark .shift-status-detail,
.dark .shift-stat-label,
.dark .shift-opening-balance,
.dark .transaction-table th,
.dark .shift-time-range,
.dark .summary-item .label,
.dark .detail-row .label,
.dark .form-hint {
  color: var(--text-secondary-dark, #9ca3af);
}

.dark .transaction-table td {
  color: var(--text-primary-dark, #e5e7eb);
}

.dark .shift-summary,
.dark .close-shift-summary,
.dark .detail-section {
  background: var(--bg-dark, #111827);
}

.dark .shift-input,
.dark .shift-textarea,
.dark .shift-select {
  background: var(--input-bg-dark, #374151);
  border-color: var(--border-color-dark, #4b5563);
}

.dark .shift-modal-footer {
  background: var(--bg-dark, #111827);
}

.dark .shift-btn-secondary {
  background: var(--btn-secondary-bg-dark, #374151);
  border-color: var(--border-color-dark, #4b5563);
  color: var(--text-primary-dark, #e5e7eb);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 640px) {
  .shift-status-card {
    align-items: flex-start;
  }

  .shift-actions {
    width: 100%;
    margin-top: 0.75rem;
  }

  .shift-actions .shift-btn {
    flex: 1;
  }

  .shift-quick-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .shift-stat-card {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .shift-stat-card.shift-stat-highlight {
    grid-column: 1 / -1;
  }

  .shift-stat-icon {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .shift-stat-value {
    font-size: 0.9rem;
  }

  .shift-stat-label {
    font-size: 0.6rem;
  }

  .shift-action-buttons {
    width: 100%;
  }

  .shift-action-buttons .shift-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .transaction-table th,
  .transaction-table td {
    padding: 0.5rem;
    font-size: x-small;
  }

  .shift-modal-content {
    max-height: 85vh;
  }

  .shift-radio-group {
    flex-direction: column;
  }

  .shift-radio {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .shift-quick-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .shift-stat-card {
    padding: 0.6rem;
    gap: 0.4rem;
  }

  .shift-stat-icon {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  .shift-stat-value {
    font-size: 0.8rem;
  }

  .shift-stat-label {
    font-size: 0.55rem;
    letter-spacing: 0;
  }
}

/* Print styles */
@media print {
  .shift-modal-overlay {
    display: none;
  }

  .shift-modal-content {
    box-shadow: none;
    max-width: 100%;
  }

  .shift-modal-footer {
    display: none;
  }

  .shift-btn {
    display: none;
  }
}

/* ============================================
   Pre-Open Sales Section (Doanh số trước mở ca)
   ============================================ */
.pre-open-sales-section {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.pre-open-sales-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.pre-open-sales-alert > i {
  font-size: 1.5rem;
  color: #d97706;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.pre-open-sales-alert strong {
  display: block;
  color: #92400e;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.pre-open-sales-alert p {
  color: #b45309;
  font-size: 0.8rem;
  margin: 0;
}

.pre-open-sales-summary {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.pre-open-sales-summary .sales-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  color: #1f2937;
}

.pre-open-sales-summary .sales-row:not(:last-child) {
  border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
}

.pre-open-sales-summary .sales-row i {
  margin-right: 0.5rem;
  width: 18px;
  text-align: center;
}

.pre-open-sales-summary .sales-row.total {
  border-top: 2px solid rgba(0, 0, 0, 0.15);
  margin-top: 0.25rem;
  padding-top: 0.75rem;
  font-size: 1rem;
}

.pre-open-sales-summary .text-green {
  color: #059669;
  font-weight: 600;
}

.pre-open-sales-summary .text-blue {
  color: #2563eb;
  font-weight: 600;
}

/* Checkbox label */
.shift-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: #1f2937;
}

.shift-checkbox-label input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
  cursor: pointer;
}

.pre-open-sales-section .shift-form-group {
  margin-bottom: 0;
}

.pre-open-sales-section .form-hint {
  color: #92400e;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

/* ============================================
   Close Shift Modal - Step-by-Step UI
   ============================================ */

/* Handover Type Selection - Pills */
.handover-type-selector {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.handover-type-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--border-color, #e5e7eb);
  border-radius: 12px;
  background: var(--bg-secondary, #f9fafb);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary, #6b7280);
}

.handover-type-pill:hover {
  border-color: var(--primary-color, #3b82f6);
  background: rgba(59, 130, 246, 0.05);
}

.handover-type-pill.active {
  border-color: var(--primary-color, #3b82f6);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
  color: var(--primary-color, #3b82f6);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.handover-type-pill.active i {
  transform: scale(1.1);
}

.handover-type-pill i {
  font-size: 1.25rem;
  transition: transform 0.3s ease;
}

.handover-type-pill .pill-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.125rem;
}

.handover-type-pill .pill-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.handover-type-pill .pill-subtitle {
  font-size: 0.75rem;
  opacity: 0.7;
  font-weight: 400;
}

/* Step Sections with Animation */
.close-shift-step {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 0;
}

.close-shift-step.visible {
  max-height: 500px;
  opacity: 1;
  transform: translateY(0);
  margin-bottom: 1.5rem;
}

.close-shift-step.visible .shift-form-group {
  animation: slideInUp 0.3s ease forwards;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Handover Person Input */
.handover-person-input {
  position: relative;
}

.handover-person-input .shift-input {
  padding-right: 2.5rem;
}

.handover-person-input .input-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted, #9ca3af);
  pointer-events: none;
}

/* Handover Method - Enhanced Cards */
.handover-method-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.handover-method-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem 1rem;
  border: 2px solid var(--border-color, #e5e7eb);
  border-radius: 12px;
  background: var(--bg-secondary, #f9fafb);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}

.handover-method-card:hover {
  border-color: var(--primary-color, #3b82f6);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.handover-method-card.active {
  border-color: var(--primary-color, #3b82f6);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
}

.handover-method-card.active i {
  color: var(--primary-color, #3b82f6);
  transform: scale(1.15);
}

.handover-method-card i {
  font-size: 1.75rem;
  color: var(--text-secondary, #6b7280);
  transition: all 0.3s ease;
}

.handover-method-card .method-label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-primary, #1f2937);
}

.handover-method-card input[type='radio'] {
  display: none;
}

/* Step Divider */
.step-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: var(--text-muted, #9ca3af);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.step-divider::before,
.step-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color, #e5e7eb), transparent);
}

/* Close Shift Summary - Enhanced */
.close-shift-summary {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.close-shift-summary h4 {
  margin: 0 0 1rem;
  color: #0369a1;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.close-shift-summary .summary-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.close-shift-summary .summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  color: var(--text-primary, #1f2937);
}

.close-shift-summary .summary-row:not(:last-child) {
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

.close-shift-summary .summary-total {
  background: rgba(255, 255, 255, 0.8);
  margin: 0.5rem -0.75rem -0.5rem;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 1rem;
}

/* Selected Summary Pill */
.selected-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color, #e5e7eb);
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: var(--primary-color, #3b82f6);
  color: white;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 500;
  animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.summary-pill i {
  font-size: 0.7rem;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Dark mode */
.dark .handover-type-pill {
  background: var(--bg-tertiary-dark, #374151);
  border-color: var(--border-color-dark, #4b5563);
  color: var(--text-secondary-dark, #9ca3af);
}

.dark .handover-type-pill:hover,
.dark .handover-type-pill.active {
  border-color: var(--primary-color, #3b82f6);
}

.dark .handover-method-card {
  background: var(--bg-tertiary-dark, #374151);
  border-color: var(--border-color-dark, #4b5563);
}

.dark .handover-method-card .method-label {
  color: var(--text-primary-dark, #e5e7eb);
}

.dark .close-shift-summary {
  background: linear-gradient(135deg, #1e3a5f 0%, #1e40af20 100%);
  border-color: #3b82f6;
}

.dark .close-shift-summary h4 {
  color: #93c5fd;
}

/* Responsive for Close Shift Modal */
@media (max-width: 640px) {
  .handover-type-selector {
    flex-direction: column;
    gap: 0.5rem;
  }

  .handover-type-pill {
    padding: 0.875rem 1rem;
    justify-content: flex-start;
  }

  .handover-type-pill .pill-text {
    flex-direction: row;
    gap: 0.5rem;
  }

  .handover-type-pill .pill-subtitle {
    display: none;
  }

  .handover-method-cards {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .handover-method-card {
    padding: 1rem 0.75rem;
  }

  .handover-method-card i {
    font-size: 1.5rem;
  }

  .close-shift-summary {
    padding: 1rem;
  }

  .close-shift-summary .summary-row {
    font-size: 0.85rem;
  }

  .selected-summary {
    flex-direction: column;
    gap: 0.375rem;
  }

  .summary-pill {
    justify-content: center;
  }
}

/* ============================================
   Other User's Shift Styles
   ============================================ */
.shift-status-card.shift-other-user {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), transparent);
}

.shift-other-user .shift-status-icon {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.shift-other-user-notice {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(245, 158, 11, 0.1);
  border-radius: 6px;
  font-size: 0.85rem;
  color: #92400e;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.shift-other-user-notice i {
  margin-top: 0.1rem;
  color: #f59e0b;
}

.shift-waiting-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(245, 158, 11, 0.15);
  color: #92400e;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
}

.shift-waiting-badge i {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Other User Info Section */
.shift-other-user-info {
  margin-top: 1.5rem;
}

.other-user-alert {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.02));
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.other-user-alert .alert-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.15);
  border-radius: 10px;
  color: #f59e0b;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.other-user-alert .alert-content h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 0.5rem;
}

.other-user-alert .alert-content p {
  font-size: 0.9rem;
  color: #78350f;
  margin-bottom: 0.25rem;
}

.other-user-alert .alert-content p:last-child {
  margin-bottom: 0;
}

.shift-readonly-stats h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.shift-quick-stats.readonly {
  opacity: 0.85;
}

.shift-quick-stats.readonly .shift-stat-card {
  cursor: default;
}

@media (max-width: 640px) {
  .other-user-alert {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }

  .other-user-alert .alert-icon {
    margin-bottom: 0.5rem;
  }
}
