/* ==========================================================================
   Construction Pre-Accounting (Ön Muhasebe) App-Specific Components
   Worker Timesheets (Puantaj), Quotes/Bids (Teklifler), Expenses, Incomes, Reports
   ========================================================================== */

/* Badges & Status Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge.success { background: rgba(52, 199, 89, 0.15); color: #34c759; border: 1px solid rgba(52, 199, 89, 0.3); }
.badge.warning { background: rgba(255, 149, 0, 0.15); color: #ff9500; border: 1px solid rgba(255, 149, 0, 0.3); }
.badge.danger  { background: rgba(255, 59, 48, 0.15);  color: #ff3b30; border: 1px solid rgba(255, 59, 48, 0.3); }
.badge.info    { background: rgba(0, 122, 255, 0.15); color: #007aff; border: 1px solid rgba(0, 122, 255, 0.3); }
.badge.amber   { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }

/* Quick Action Speed Dial / Floating Bar */
.quick-action-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.quick-action-bar::-webkit-scrollbar { display: none; }

.quick-action-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.quick-action-btn:active {
  background: var(--primary);
  color: #0b0f19;
}

/* Worker Card (Puantaj & Yevmiye Listesi) */
.worker-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.15s ease;
}

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

.worker-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.worker-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1e293b, #334155);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.worker-name-role {
  display: flex;
  flex-direction: column;
}

.worker-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.worker-role {
  font-size: 12px;
  color: var(--text-muted);
}

.worker-wages {
  text-align: right;
}

.worker-daily-rate {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
}

.worker-rate-sub {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Worker Attendance Buttons (Puantaj Seçici) */
.puantaj-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px;
  border-radius: var(--radius-md);
}

.puantaj-btn {
  padding: 8px 4px;
  text-align: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.puantaj-btn.active-full {
  background: #34c759;
  color: #ffffff;
  border-color: #34c759;
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.4);
}

.puantaj-btn.active-half {
  background: #ff9500;
  color: #ffffff;
  border-color: #ff9500;
  box-shadow: 0 2px 8px rgba(255, 149, 0, 0.4);
}

.puantaj-btn.active-overtime {
  background: #007aff;
  color: #ffffff;
  border-color: #007aff;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.4);
}

.puantaj-btn.active-absent {
  background: #ff3b30;
  color: #ffffff;
  border-color: #ff3b30;
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.4);
}

.worker-footer-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
}

.worker-stat-item {
  color: var(--text-secondary);
}

.worker-stat-item strong {
  color: var(--text-primary);
}

/* Proposal Item (Teklif Listesi) */
.proposal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.proposal-card:active { transform: scale(0.985); }

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

.proposal-client {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.proposal-project {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 8px;
}

.proposal-price-box {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.proposal-amount {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

/* Expense & Income Transactions List */
.transaction-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.transaction-item:last-child { border-bottom: none; }

.transaction-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.transaction-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.transaction-icon.expense { background: rgba(255, 59, 48, 0.12); color: #ff3b30; }
.transaction-icon.income  { background: rgba(52, 199, 89, 0.12); color: #34c759; }

.transaction-details {
  display: flex;
  flex-direction: column;
}

.transaction-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.transaction-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.transaction-right {
  text-align: right;
}

.transaction-amount {
  font-size: 16px;
  font-weight: 700;
}
.transaction-amount.expense { color: #ff3b30; }
.transaction-amount.income  { color: #34c759; }

.transaction-method {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Dynamic Line Items Builder for Proposals & Invoices */
.line-item-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.line-item-del-btn {
  background: rgba(255, 59, 48, 0.15);
  border: none;
  color: #ff3b30;
  width: 32px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
}

/* Printable / PDF Quote Template View (iOS Native Share / Print) */
#printQuoteModal .ios-modal-sheet {
  max-height: 96vh;
}

.quote-preview-document {
  background: #ffffff;
  color: #1a202c;
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  font-family: var(--font-family);
  user-select: text;
  -webkit-user-select: text;
}

.quote-doc-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.quote-company-name {
  font-size: 20px;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: -0.3px;
}

.quote-company-sub {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
}

.quote-meta-right {
  text-align: right;
  font-size: 12px;
  color: #64748b;
}

.quote-doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 12px;
}

.quote-doc-table th {
  background: #f1f5f9;
  color: #334155;
  text-align: left;
  padding: 8px;
  font-weight: 700;
  border-bottom: 1px solid #cbd5e1;
}

.quote-doc-table td {
  padding: 8px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

.quote-doc-totals {
  margin-left: auto;
  width: 240px;
  border-top: 2px solid #e2e8f0;
  padding-top: 8px;
}

.quote-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}

.quote-total-row.grand {
  font-size: 16px;
  font-weight: 800;
  color: #d97706;
  border-top: 1px solid #e2e8f0;
  padding-top: 6px;
  margin-top: 6px;
}

.quote-terms {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px dashed #cbd5e1;
  font-size: 10px;
  color: #64748b;
  line-height: 1.4;
}

/* Print CSS Media */
@media print {
  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    height: auto !important;
    overflow: visible !important;
  }
  #app, .ios-modal-overlay, .ios-modal-sheet, .ios-modal-content {
    position: static !important;
    overflow: visible !important;
    display: block !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    max-height: none !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .ios-header, .ios-tab-bar, .ios-modal-header, .no-print {
    display: none !important;
  }
  .quote-preview-document, .official-invoice-document, .report-print-container {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 10mm !important;
    box-shadow: none !important;
    border: none !important;
    background: #ffffff !important;
    color: #000000 !important;
    page-break-inside: avoid;
  }
}
