/* งานด่วน - Main Stylesheet */
/* รองรับทุกขนาดหน้าจอ iOS และ Android */

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

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.5;
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Responsive Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* Cards */
.card {
  background: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  margin-bottom: 12px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #1E2A5E;
  color: white;
}

.btn-primary:hover {
  background: #0A192F;
}

.btn-secondary {
  background: #eef2ff;
  color: #1E2A5E;
}

.btn-secondary:hover {
  background: #e0e5f0;
}

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

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

.btn-success {
  background: #2e7d32;
  color: white;
}

.btn-success:hover {
  background: #1b5e20;
}

.btn-block {
  width: 100%;
}

/* Form Elements */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  background: white;
  transition: border 0.2s;
}

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

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.status-available {
  background: #e6f7e6;
  color: #2e7d32;
}

.status-progress {
  background: #fff3e0;
  color: #ed6c02;
}

.status-pending {
  background: #fff3e0;
  color: #ed6c02;
}

.status-completed {
  background: #e3f2fd;
  color: #1565c0;
}

/* Wallet Card */
.wallet-card {
  background: linear-gradient(135deg, #1E2A5E, #0A192F);
  border-radius: 20px;
  padding: 20px;
  color: white;
  margin-bottom: 16px;
}

.wallet-amount {
  font-size: 32px;
  font-weight: bold;
  margin: 8px 0;
}

/* Job Card */
.job-card {
  background: white;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.job-card:active {
  transform: scale(0.99);
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.job-title {
  font-size: 16px;
  font-weight: bold;
  color: #1E2A5E;
}

.job-price {
  font-size: 18px;
  font-weight: bold;
  color: #1E2A5E;
}

.job-location {
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}

.job-detail {
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}

.job-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  display: flex;
  justify-content: space-around;
  padding: 10px 0 20px;
  border-top: 1px solid #eee;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  z-index: 100;
}

.nav-item {
  text-align: center;
  cursor: pointer;
  flex: 1;
}

.nav-icon svg {
  width: 24px;
  height: 24px;
  stroke: #888;
  stroke-width: 1.8;
  fill: none;
}

.nav-item.active .nav-icon svg {
  stroke: #1E2A5E;
}

.nav-label {
  font-size: 11px;
  color: #888;
  margin-top: 4px;
}

.nav-item.active .nav-label {
  color: #1E2A5E;
  font-weight: 500;
}

/* Header */
.header {
  background: linear-gradient(135deg, #0A192F, #1E2A5E);
  color: white;
  padding: 20px 16px;
  border-radius: 0 0 25px 25px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Responsive Breakpoints */
@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
  
  .container {
    padding: 0 12px;
  }
  
  .grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .wallet-amount {
    font-size: 28px;
  }
  
  .job-header {
    flex-direction: column;
  }
  
  .job-price {
    margin-top: 6px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
  
  .container {
    max-width: 960px;
  }
}

@media (min-width: 1025px) {
  .container {
    max-width: 1200px;
  }
  
  .grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
}

/* Safe Area for Notch */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  
  body {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #eef2ff;
  border-top: 3px solid #1E2A5E;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

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

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.hidden { display: none; }
.visible { display: block; }

/* Touch Optimizations */
button, 
.nav-item,
.menu-item,
.job-card {
  cursor: pointer;
  touch-action: manipulation;
}

input, 
textarea, 
select {
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

/* iOS specific */
@supports (-webkit-touch-callout: none) {
  input, textarea, select {
    font-size: 16px;
  }
}