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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  color: #333;
  direction: rtl;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header {
  text-align: center;
  padding: 30px 0;
  color: white;
}

.header h1 {
  font-size: 2.5rem;
  margin-bottom: 5px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header p {
  color: #a0a0a0;
  font-size: 1.1rem;
}

/* Loading */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: white;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: #f5576c;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

/* Error */
.error-container {
  background: white;
  border-radius: 16px;
  padding: 40px;
  text-align: center;
}

.error-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.error-container button {
  margin-top: 20px;
  padding: 12px 30px;
  background: #f5576c;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
}

/* Steps */
.step {
  background: white;
  border-radius: 16px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.step-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

.step-number {
  width: 35px;
  height: 35px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-left: 15px;
}

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

/* Order Info */
.order-info {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #e9ecef;
}

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

.info-row.highlight {
  background: #fff3cd;
  margin: 5px -10px;
  padding: 10px;
  border-radius: 8px;
  border: none;
}

.info-row .label {
  color: #666;
}

.info-row .value {
  font-weight: 600;
  color: #1a1a2e;
}

/* Payment Types */
.payment-types {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.type-btn {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 20px 10px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.type-btn:hover {
  border-color: #f5576c;
  background: #fff5f6;
}

.type-btn.active {
  border-color: #f5576c;
  background: linear-gradient(135deg, #fff5f6 0%, #ffe9eb 100%);
}

.type-btn .icon {
  font-size: 2rem;
}

.type-btn .text {
  font-weight: 600;
  color: #1a1a2e;
}

.type-btn .desc {
  font-size: 0.75rem;
  color: #888;
}

/* Payment Methods */
.payment-methods {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.method-btn {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.method-btn:hover {
  border-color: #f5576c;
  background: #fff5f6;
}

.method-btn.active {
  border-color: #f5576c;
  background: linear-gradient(135deg, #fff5f6 0%, #ffe9eb 100%);
}

.method-btn .icon {
  font-size: 1.5rem;
}

.method-btn .text {
  font-weight: 600;
  color: #1a1a2e;
}

/* Amount Input */
.amount-section {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 2px solid #f0f0f0;
}

.amount-section label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #1a1a2e;
}

.input-group {
  display: flex;
  align-items: center;
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  overflow: hidden;
}

.input-group .currency {
  padding: 15px;
  background: #e9ecef;
  font-weight: bold;
  color: #666;
}

.input-group input {
  flex: 1;
  border: none;
  padding: 15px;
  font-size: 1.2rem;
  background: transparent;
  outline: none;
}

.validation-msg {
  margin-top: 10px;
  font-size: 0.9rem;
}

.validation-msg.error {
  color: #dc3545;
}

.validation-msg.success {
  color: #28a745;
}

/* Details Sections */
.details-section {
  padding: 10px 0;
}

.details-section h3 {
  margin-bottom: 15px;
  color: #1a1a2e;
}

/* Terminal Options */
.terminal-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 25px;
}

.terminal-btn {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.terminal-btn:hover {
  border-color: #f5576c;
}

.terminal-btn.active {
  border-color: #f5576c;
  background: #fff5f6;
}

.terminal-btn .name {
  display: block;
  font-weight: 600;
  color: #1a1a2e;
}

.terminal-btn .id {
  font-size: 0.75rem;
  color: #888;
}

/* Installments */
.installments-section {
  margin-bottom: 20px;
}

.installments-section label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.installments-section select {
  width: 100%;
  padding: 12px;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  font-size: 1rem;
  background: white;
  cursor: pointer;
}

/* Warning */
.warning {
  color: #856404;
  background: #fff3cd;
  padding: 10px 15px;
  border-radius: 8px;
  margin-top: 10px;
}

.warning-box {
  background: #fff3cd;
  border: 1px solid #ffc107;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
}

/* Breakdown */
.breakdown {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 15px;
  margin: 20px 0;
}

.breakdown h4 {
  margin-bottom: 10px;
  color: #1a1a2e;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed #ddd;
}

.breakdown-row:last-child {
  border-bottom: none;
}

.breakdown-row.total {
  font-weight: bold;
  border-top: 2px solid #ddd;
  margin-top: 10px;
  padding-top: 15px;
}

/* Form Groups */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #1a1a2e;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="password"] {
  width: 100%;
  padding: 12px;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: #f5576c;
}

.bank-inputs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

/* File Upload */
input[type="file"] {
  width: 100%;
  padding: 12px;
  border: 2px dashed #e9ecef;
  border-radius: 10px;
  cursor: pointer;
}

.file-preview {
  margin-top: 10px;
}

.file-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 10px;
}

/* Bank Info */
.bank-info {
  background: #e8f4fd;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 25px;
}

.bank-info h3 {
  margin-bottom: 15px;
  color: #0066cc;
}

.bank-info p {
  margin: 8px 0;
}

.transfer-amount {
  font-size: 1.3rem;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 2px solid #cce5ff;
}

/* Check Info */
.check-info {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
}

.check-info ul {
  margin-top: 10px;
  padding-right: 20px;
}

.check-info li {
  margin: 5px 0;
  color: #666;
}

/* Cash Calculator */
.cash-calculator {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e9ecef;
}

.calc-row.input {
  flex-direction: column;
  align-items: stretch;
}

.calc-row.input label {
  margin-bottom: 10px;
}

.calc-result {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid #ddd;
}

.change .value.positive {
  color: #28a745;
  font-size: 1.5rem;
  font-weight: bold;
}

.shortage .value.negative {
  color: #dc3545;
  font-size: 1.5rem;
  font-weight: bold;
}

/* Buttons */
.primary-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(245, 87, 108, 0.4);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary-btn {
  padding: 12px 24px;
  background: #f8f9fa;
  color: #1a1a2e;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  margin: 5px;
}

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

/* Processing */
.processing {
  text-align: center;
  padding: 40px;
}

.processing p {
  margin-top: 20px;
  color: #666;
}

/* EMV Status */
.emv-status {
  text-align: center;
  padding: 40px;
}

.status-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.emv-status p {
  font-size: 1.1rem;
  color: #666;
  margin-bottom: 20px;
}

/* Success */
.success {
  text-align: center;
  padding: 40px;
}

.success-icon {
  font-size: 5rem;
  margin-bottom: 20px;
}

.success h2 {
  color: #28a745;
  margin-bottom: 20px;
}

.receipt-info {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  text-align: right;
}

.receipt-info p {
  margin: 8px 0;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 30px;
  max-width: 400px;
  width: 90%;
}

.modal-content h3 {
  margin-bottom: 15px;
  color: #1a1a2e;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-buttons button {
  flex: 1;
}

/* Tranzila iFrame */
#tranzila-iframe-container {
  margin-top: 20px;
  border-radius: 12px;
  overflow: hidden;
  background: #f8f9fa;
}

#tranzila-iframe {
  width: 100%;
  height: 500px;
  border: none;
}

/* Document Signature Section */
.signature-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pdf-viewer {
  background: #f8f9fa;
  border-radius: 12px;
  overflow: hidden;
  min-height: 400px;
  position: relative;
}

.pdf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: #666;
}

.pdf-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: #dc3545;
}

#pdf-iframe {
  width: 100%;
  height: 500px;
  border: none;
}

.signature-section {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
}

.signature-section label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #1a1a2e;
}

.canvas-container {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  overflow: hidden;
  cursor: crosshair;
}

#signature-canvas {
  width: 100%;
  height: 150px;
  display: block;
  touch-action: none;
}

.signature-actions {
  margin-top: 10px;
  text-align: left;
}

/* Order Input Section */
.order-input-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.order-input-form .input-group {
  margin-bottom: 0;
}

.order-input-form input {
  font-size: 1.5rem;
  text-align: center;
  padding: 20px;
}

/* PDF and Signature Headers with Fullscreen Button */
.pdf-header,
.signature-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.pdf-header span,
.signature-header label {
  font-weight: 600;
  color: #1a1a2e;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  background: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: #f5576c;
  color: white;
  border-color: #f5576c;
}

/* Fullscreen Modals */
.fullscreen-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: white;
  z-index: 2000;
  display: flex;
  flex-direction: column;
}

.fullscreen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: white;
}

.fullscreen-header span {
  font-size: 1.2rem;
  font-weight: 600;
}

.close-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.close-btn:hover {
  background: rgba(255,255,255,0.3);
}

#fullscreen-pdf-iframe {
  flex: 1;
  border: none;
  width: 100%;
}

.fullscreen-canvas-container {
  flex: 1;
  background: white;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  overflow: hidden;
}

#fullscreen-signature-canvas {
  background: white;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  display: block;
}

.fullscreen-actions {
  display: flex;
  gap: 15px;
  padding: 20px;
  background: #f8f9fa;
  justify-content: center;
}

.fullscreen-actions button {
  min-width: 150px;
}

/* Signature Status for Seller */
.signature-status-container {
  text-align: center;
}

.status-display {
  padding: 30px;
  margin-bottom: 25px;
}

.status-icon-large {
  font-size: 4rem;
  margin-bottom: 15px;
}

.status-display p {
  font-size: 1.2rem;
  color: #666;
}

.status-display.signed .status-icon-large {
  color: #28a745;
}

.status-display.not-signed .status-icon-large {
  color: #ffc107;
}

.signature-actions-seller {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.signature-actions-seller button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.signature-actions-seller .btn-icon {
  font-size: 1.2rem;
}

.warning-btn {
  background: #fff3cd !important;
  border-color: #ffc107 !important;
  color: #856404 !important;
}

.warning-btn:hover {
  background: #ffe69c !important;
}

/* Customer Success */
.customer-success {
  padding: 60px 20px;
}

.customer-message {
  font-size: 1.2rem;
  color: #666;
  margin: 10px 0;
}

.company-logo {
  margin-top: 40px;
  font-size: 1.5rem;
  font-weight: bold;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Send Link Modal */
.send-link-modal {
  max-width: 450px;
}

.link-container {
  display: flex;
  gap: 10px;
  margin: 20px 0;
}

.link-container input {
  flex: 1;
  padding: 12px;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  font-size: 0.9rem;
  direction: ltr;
  text-align: left;
}

.send-options {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.send-btn {
  flex: 1;
  padding: 15px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.2s;
}

.send-btn.whatsapp {
  background: #25D366;
  color: white;
}

.send-btn.whatsapp:hover {
  background: #1fb855;
}

.send-btn.copy {
  background: #f8f9fa;
  color: #333;
  border: 2px solid #e9ecef;
}

.send-btn.copy:hover {
  background: #e9ecef;
}

.send-btn.full-width {
  width: 100%;
  margin-bottom: 15px;
}

.divider {
  text-align: center;
  color: #999;
  font-size: 0.9rem;
  margin: 15px 0;
  position: relative;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: #e9ecef;
}

.divider::before {
  right: 0;
}

.divider::after {
  left: 0;
}

/* Customer Mode - Hide order info amounts */
.customer-mode #step-order .info-row.highlight,
.customer-mode #step-type,
.customer-mode #step-method,
.customer-mode #step-details {
  display: none !important;
}

.customer-mode .header p {
  display: none;
}

/* Custom Alert Modal */
.alert-modal {
  text-align: center;
  max-width: 350px;
}

.alert-icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 20px;
}

.alert-icon.success {
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  color: #28a745;
}

.alert-icon.error {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  color: #dc3545;
}

.alert-icon.warning {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
  color: #856404;
}

.alert-icon.info {
  background: linear-gradient(135deg, #cce5ff 0%, #b8daff 100%);
  color: #004085;
}

.alert-modal p {
  font-size: 1.1rem;
  color: #333;
  margin-bottom: 25px;
  line-height: 1.6;
}

.alert-modal .primary-btn {
  width: auto;
  min-width: 120px;
  padding: 12px 30px;
}

/* Utilities */
.hidden {
  display: none !important;
}

.highlight {
  font-weight: 600;
}

/* Responsive */
@media (max-width: 480px) {
  .payment-types {
    grid-template-columns: 1fr;
  }

  .payment-methods {
    grid-template-columns: 1fr;
  }

  .terminal-options {
    grid-template-columns: 1fr;
  }

  .bank-inputs {
    grid-template-columns: 1fr;
  }

  .header h1 {
    font-size: 2rem;
  }
}
