/* ============================================================
   採購交期公告系統 - 共用樣式表
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f0f2f5;
  color: #333;
  line-height: 1.6;
}

/* 頂部導航列 */
.navbar {
  background: #1a1a2e;
  color: #fff;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.navbar h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.navbar .user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}

.navbar .user-info .role-badge {
  background: #e94560;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.navbar .logout-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 0.35rem 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.navbar .logout-btn:hover {
  background: rgba(255,255,255,0.1);
}

/* 主內容區 */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* 工具列 */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.toolbar h2 {
  font-size: 1.3rem;
  color: #1a1a2e;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary {
  background: #0f3460;
  color: #fff;
}

.btn-primary:hover {
  background: #16213e;
}

.btn-success {
  background: #27ae60;
  color: #fff;
}

.btn-success:hover {
  background: #219a52;
}

.btn-danger {
  background: #e94560;
  color: #fff;
}

.btn-danger:hover {
  background: #d63447;
}

.btn-warning {
  background: #f39c12;
  color: #fff;
}

.btn-warning:hover {
  background: #e08e0b;
}

.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

/* 資訊卡佈局 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.25rem;
}

.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  padding: 1.25rem;
  transition: box-shadow 0.2s, transform 0.2s;
  border-left: 4px solid #0f3460;
}

.card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

.card.status-pending {
  border-left-color: #f39c12;
}

.card.status-agreed {
  border-left-color: #27ae60;
}

.card.status-disagreed {
  border-left-color: #e94560;
}

.card.status-admin_approved {
  border-left-color: #2980b9;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.card-header .order-number {
  font-weight: 700;
  font-size: 1rem;
  color: #1a1a2e;
}

.card-header .status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.pending {
  background: #fef3cd;
  color: #856404;
}

.status-badge.agreed {
  background: #d4edda;
  color: #155724;
}

.status-badge.disagreed {
  background: #f8d7da;
  color: #721c24;
}

.status-badge.admin_approved {
  background: #cce5ff;
  color: #004085;
}

.card-body {
  margin-bottom: 1rem;
}

.card-body .info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9rem;
}

.card-body .info-row:last-child {
  border-bottom: none;
}

.card-body .info-row .label {
  color: #666;
  font-weight: 500;
}

.card-body .info-row .value {
  color: #333;
  font-weight: 600;
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

/* 備註區塊 */
.note-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #e0e0e0;
}

.note-section label {
  display: block;
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.3rem;
  font-weight: 500;
}

.note-section textarea {
  width: 100%;
  min-height: 50px;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.85rem;
  resize: vertical;
  font-family: inherit;
  transition: border-color 0.2s;
}

.note-section textarea:focus {
  outline: none;
  border-color: #0f3460;
}

/* 卡片操作列 */
.card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f0f0f0;
}

/* 登入頁面 */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-box {
  background: #fff;
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.login-box h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #1a1a2e;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: #555;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #0f3460;
}

.form-group .error-msg {
  color: #e94560;
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

/* 模態對話框 */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  margin-bottom: 1rem;
  color: #1a1a2e;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* Toast 通知 */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
}

.toast {
  background: #333;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  animation: slideIn 0.3s ease;
  max-width: 350px;
}

.toast.success {
  background: #27ae60;
}

.toast.error {
  background: #e94560;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* 響應式設計 */
@media (max-width: 768px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .navbar {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .container {
    padding: 0 1rem;
    margin: 1rem auto;
  }
}

/* 空狀態 */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: #999;
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* 管理員同意日期標記 */
.admin-approved-marker {
  background: #e8f4fd;
  border: 1px solid #b3d9f2;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #004085;
}

.admin-approved-marker strong {
  color: #002752;
}