/**
 * Request Approval Modal CSS
 * Giao diện hiện đại cho chức năng tạo đơn xin phép
 */

/* =====================================================
   MODAL OVERLAY & CONTAINER
   ===================================================== */
.request-approval-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif;
}

.request-approval-modal.active {
  display: flex;
}

.request-approval-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

.request-approval-container {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  margin: auto;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

/* =====================================================
   HEADER
   ===================================================== */
.request-approval-header {
  padding: 20px 24px;
  background: var(--primary-color, #0071e3);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.request-approval-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.request-approval-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1;
}

.request-approval-header h2 i {
  font-size: 1.4rem;
}

.request-approval-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 1;
}

.request-approval-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* =====================================================
   REQUEST TYPE SELECTOR (Pills)
   ===================================================== */
.request-type-selector {
  padding: 12px 20px;
  margin-bottom: 20px;
  background: #f5f5f7;
  border-bottom: 1px solid #e2e8f0;
}

.request-type-selector label,
.request-type-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.request-type-pills,
.request-type-options {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
}

.request-type-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: white;
  border: 1.5px solid #e2e8f0;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  color: #64748b;
}

.request-type-pill:hover {
  border-color: var(--primary-color, #0071e3);
  color: var(--primary-color, #0071e3);
  background: #f0f0ff;
}

.request-type-pill.active {
  background: var(--primary-color, #0071e3);
  border-color: transparent;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.3);
}

.request-type-pill i {
  font-size: 0.8rem;
}

.request-type-pill input[type='radio'] {
  display: none;
}

/* Type-specific colors */
.request-type-pill[data-type='late_early'].active {
  background: #ff9500;
  box-shadow: 0 2px 8px rgba(255, 149, 0, 0.3);
}

.request-type-pill[data-type='leave'].active {
  background: #30b0c7;
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.3);
}

.request-type-pill[data-type='overtime'].active {
  background: #0071e3;
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.3);
}

.request-type-pill[data-type='salary_advance'].active {
  background: #22c55e;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

/* =====================================================
   FORM CONTENT
   ===================================================== */
.request-approval-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  padding-bottom: 100px; /* Space for sticky footer */
}

.request-form-section {
  display: none;
  animation: fadeInUp 0.4s ease;
}

.request-form-section.active {
  display: block;
}

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

.request-form-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #3a3a3c;
  margin-bottom: 8px;
}

.request-form-group label i {
  color: var(--primary-color, #0071e3);
  font-size: 1rem;
}

.request-form-group label .required {
  color: #ff3b30;
  margin-left: 2px;
}

.request-form-input,
.request-form-select,
.request-form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: #f5f5f7;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 0.9375rem;
  color: #1e293b;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.request-form-input:focus,
.request-form-select:focus,
.request-form-textarea:focus {
  outline: none;
  border-color: var(--primary-color, #0071e3);
  background: white;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

.request-form-input::placeholder,
.request-form-textarea::placeholder {
  color: #94a3b8;
}

.request-form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 44px;
}

.request-form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

/* =====================================================
   INLINE GROUPS (2 columns)
   ===================================================== */
.request-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* =====================================================
   SUB-TYPE PILLS (Late/Early, Leave Type)
   ===================================================== */
.sub-type-pills {
  display: flex;
  gap: 12px;
}

.sub-type-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background: #f5f5f7;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  color: #64748b;
}

.sub-type-pill:hover {
  border-color: var(--primary-color, #0071e3);
  background: #f2f2f7;
}

.sub-type-pill.active {
  border-color: var(--primary-color, #0071e3);
  background: rgba(0, 113, 227, 0.1);
  color: var(--primary-color, #0071e3);
}

.sub-type-pill input[type='radio'] {
  display: none;
}

/* Late type colors */
.sub-type-pill[data-value='late'].active {
  border-color: #ff3b30;
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
}

.sub-type-pill[data-value='early'].active {
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.1);
  color: #f97316;
}

/* Leave type colors */
.sub-type-pill[data-value='annual'].active {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.sub-type-pill[data-value='unpaid'].active {
  border-color: #64748b;
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
}

.sub-type-pill[data-value='sick'].active {
  border-color: #ff3b30;
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
}

/* =====================================================
   CALCULATED VALUES (Read-only info)
   ===================================================== */
.calculated-value {
  padding: 12px 16px;
  background: #f0fdf4;
  border: 2px solid #86efac;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #16a34a;
  font-weight: 600;
}

.calculated-value i {
  font-size: 1.2rem;
}

.calculated-value .value {
  font-size: 1.1rem;
}

/* =====================================================
   AMOUNT INPUT (Currency)
   ===================================================== */
.amount-input-wrapper {
  position: relative;
}

.amount-input-wrapper .currency-prefix {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-weight: 600;
  pointer-events: none;
}

.amount-input-wrapper .request-form-input {
  padding-left: 60px;
  font-size: 1.125rem;
  font-weight: 600;
}

/* =====================================================
   STICKY FOOTER (Action Buttons)
   ===================================================== */
.request-approval-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 24px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 12px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
  z-index: 10;
}

/* Cancel Button */
.request-cancel-btn {
  flex: 0 0 auto;
  padding: 12px 20px;
  background: #f2f2f7;
  color: #64748b;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.request-cancel-btn:hover {
  background: #e2e8f0;
  color: #475569;
  border-color: #c7c7cc;
}

.request-cancel-btn i {
  font-size: 0.85rem;
}

/* Submit Button */
.request-submit-btn {
  flex: 1;
  padding: 12px 24px;
  background: var(--primary-color, #0071e3);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.request-submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 113, 227, 0.4);
}

.request-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

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

/* Loading state */
.request-submit-btn.loading {
  pointer-events: none;
}

.request-submit-btn.loading i {
  animation: spin 1s linear infinite;
}

/* Legacy classes for backwards compatibility */
.request-btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.request-btn-submit {
  background: var(--primary-color, #0071e3);
  color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.request-btn-cancel {
  background: #f2f2f7;
  color: #64748b;
  border: 1.5px solid #e2e8f0;
}

/* =====================================================
   MY REQUESTS SECTION (History)
   ===================================================== */
.my-requests-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 2px dashed #e2e8f0;
}

.my-requests-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.my-requests-header h3,
.my-requests-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #3a3a3c;
  display: flex;
  align-items: center;
  gap: 8px;
}

.my-requests-header h3 i,
.my-requests-title i {
  color: var(--primary-color, #0071e3);
}

.my-requests-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.my-requests-time-filter {
  padding: 6px 12px;
  font-size: 0.8125rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  color: #475569;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.my-requests-time-filter:hover {
  border-color: var(--primary-color, #0071e3);
}

.my-requests-time-filter:focus {
  border-color: var(--primary-color, #0071e3);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.my-requests-refresh {
  background: none;
  border: none;
  color: var(--primary-color, #0071e3);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.my-requests-refresh:hover {
  background: rgba(0, 113, 227, 0.1);
}

.my-requests-refresh.loading i {
  animation: spin 1s linear infinite;
}

.my-requests-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.my-request-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all 0.2s ease;
}

.my-request-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: #c7c7cc;
}

.my-request-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.my-request-icon.late_early {
  background: #fff3e0;
  color: #ff9500;
}

.my-request-icon.leave {
  background: #ccfbf1;
  color: #30b0c7;
}

.my-request-icon.overtime {
  background: #e3f0fc;
  color: #0071e3;
}

.my-request-icon.salary_advance {
  background: #dcfce7;
  color: #22c55e;
}

.my-request-info {
  flex: 1;
  min-width: 0;
}

.my-request-type {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}

.my-request-date {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 6px;
}

.my-request-detail {
  font-size: 0.8125rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.my-request-status {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.my-request-status.pending {
  background: #fff3e0;
  color: #ff9500;
}

.my-request-status.approved {
  background: #dcfce7;
  color: #22c55e;
}

.my-request-status.rejected {
  background: #ffe5e3;
  color: #ff3b30;
}

/* Card wrapper for status and action */
.my-request-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* Revoke button */
.my-request-revoke-btn {
  padding: 4px 10px;
  background: transparent;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.my-request-revoke-btn:hover {
  background: #ffe5e3;
  color: #ff3b30;
  border-color: #ffd4d1;
}

.my-request-revoke-btn i {
  font-size: 0.65rem;
}

.my-requests-empty {
  text-align: center;
  padding: 24px;
  color: #94a3b8;
}

.my-requests-empty i {
  font-size: 2rem;
  margin-bottom: 8px;
  display: block;
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 576px) {
  .request-approval-container {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    height: 100%;
  }

  .request-approval-header {
    padding: 16px 20px;
  }

  .request-type-selector {
    padding: 14px 20px;
  }

  .request-type-pills,
  .request-type-options {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
    gap: 6px;
  }

  .request-type-pills::-webkit-scrollbar,
  .request-type-options::-webkit-scrollbar {
    display: none;
  }

  .request-type-pill {
    flex-shrink: 0;
    padding: 6px 10px;
    font-size: 0.7rem;
    gap: 4px;
    white-space: nowrap;
  }

  .request-type-pill i {
    font-size: 0.75rem;
  }

  /* Hiển thị đầy đủ text trên mobile */
  .request-type-pill span {
    display: inline;
  }

  .request-approval-content {
    padding: 20px;
    padding-bottom: 100px;
  }

  .request-form-row {
    grid-template-columns: 1fr;
  }

  .sub-type-pills {
    flex-direction: column;
  }

  .request-approval-footer {
    padding: 14px 20px;
  }

  .request-btn {
    padding: 12px 16px;
    font-size: 0.9375rem;
  }
}

/* =====================================================
   FLOATING BUTTON (Trigger)
   ===================================================== */
.request-approval-trigger {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  background: var(--primary-color, #0071e3);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.request-approval-trigger:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.request-approval-trigger:active {
  transform: scale(0.95);
}

/* Tooltip */
.request-approval-trigger::before {
  content: 'Tạo đơn xin phép';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 12px;
  padding: 8px 14px;
  background: #1e293b;
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.request-approval-trigger:hover::before {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 576px) {
  .request-approval-trigger {
    bottom: 70px;
    right: 16px;
    width: 52px;
    height: 52px;
    font-size: 1.3rem;
  }

  .request-approval-trigger::before {
    display: none;
  }
}

/* Spinning animation for refresh button */
.my-requests-refresh.spinning i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
