* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
  --border-color: #e0e0e0;
  --text-color: #333;
  --text-muted: #666;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  min-height: 100vh;
  padding: 12px;
  line-height: 1.5;
  font-size: 16px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  width: 100%;
}

/* Header */
.header {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  color: white;
  padding: 24px 20px;
  text-align: center;
}

.header h1 {
  font-size: 2rem;
  margin-bottom: 8px;
  font-weight: 700;
}

.header p {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 20px;
}

.add-payment-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid white;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  display: inline-block;
}

.add-payment-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* Filtros */
.filters-section {
  padding: 20px;
  background: var(--light-color);
  border-bottom: 2px solid var(--border-color);
}

.section-title {
  color: var(--text-color);
  margin-bottom: 16px;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-weight: 600;
}

.form-group input,
.form-group select {
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  transition: border 0.3s;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.btn {
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  background: var(--dark-color);
  color: white;
}

.btn-info {
  background: var(--info-color);
  color: white;
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.filter-info {
  background: #e7f3ff;
  border: 1px solid #b3d9ff;
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
  font-size: 0.9rem;
  color: #0066cc;
}

/* Summary */
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 24px 20px;
  background: var(--light-color);
}

.summary-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.summary-card h3 {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-card .amount {
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary-color);
}

/* Contributors */
.contributors-section {
  padding: 24px 20px;
  background: var(--light-color);
  border-bottom: 2px solid var(--border-color);
}

.contributors-input {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.contributors-input input {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
}

.contributors-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.contributor-tag {
  background: var(--primary-color);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.contributor-tag form {
  margin: 0;
  padding: 0;
}

.contributor-tag button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.1rem;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

/* Payments List */
.payments-section {
  padding: 24px 20px;
}

.section-divider {
  margin: 32px 0 20px 0;
  text-align: center;
}

.section-divider h3 {
  color: var(--text-color);
  font-size: 1.4rem;
  margin-bottom: 16px;
  padding: 0 20px;
}

.payment-card {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.payment-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.payment-card.paid {
  border-color: var(--success-color);
  background: #f0f9f4;
}

.payment-card.pending {
  border-color: var(--danger-color);
  background: #fff5f5;
}

.payment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.payment-name {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--text-color);
}

.payment-status {
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
}

.status-paid {
  background: var(--success-color);
  color: white;
}

.status-pending {
  background: var(--danger-color);
  color: white;
}

.payment-details {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.detail-value {
  font-weight: 600;
  color: var(--text-color);
  font-size: 1rem;
}

.payment-actions {
  display: flex;
  gap: 12px;
}

.btn-edit {
  background: var(--warning-color);
  color: var(--text-color);
  padding: 10px 20px;
  font-size: 0.9rem;
  text-decoration: none;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  flex: 1;
}

.btn-delete {
  background: var(--danger-color);
  color: white;
  padding: 10px 20px;
  font-size: 0.9rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
}

.voucher-thumbnail {
  width: 100%;
  max-width: 120px;
  height: 80px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  object-fit: cover;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  color: white;
  padding: 20px;
  border-radius: 16px 16px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.file-upload {
  position: relative;
  overflow: hidden;
  width: 100%;
}

.file-upload input[type="file"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.file-label {
  display: block;
  padding: 12px;
  background: var(--light-color);
  border: 2px dashed var(--primary-color);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: background 0.3s;
  font-size: 0.95rem;
  width: 100%;
}

.file-label:hover {
  background: #e9ecef;
}

.preview-image {
  width: 100%;
  max-height: 200px;
  margin-top: 8px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  object-fit: contain;
}

.voucher-info {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--light-color);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.voucher-preview-container {
  margin-top: 12px;
  width: 100%;
}

.voucher-preview-title {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.modal-footer {
  padding: 0 20px 20px;
  display: flex;
  gap: 12px;
}

.modal-footer .btn {
  flex: 1;
}

/* Image Modal */
.image-modal {
  display: none;
  position: fixed;
  z-index: 1001;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.image-modal.active {
  display: flex;
}

.image-modal-content {
  max-width: 95%;
  max-height: 95%;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}

.image-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: white;
  font-size: 32px;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Utility Classes */
.empty-message {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-style: italic;
  font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .container {
    margin: 0 10px;
  }
}

@media (max-width: 768px) {
  body {
    padding: 8px;
  }

  .container {
    border-radius: 12px;
    margin: 0;
  }

  .header {
    padding: 20px 16px;
  }

  .header h1 {
    font-size: 1.6rem;
  }

  .filters-section,
  .summary,
  .contributors-section,
  .payments-section {
    padding: 20px 16px;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .actions-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .summary {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .payment-details {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .contributors-input {
    flex-direction: column;
  }

  .modal {
    padding: 16px;
  }

  .modal-content {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 16px 12px;
  }

  .header h1 {
    font-size: 1.4rem;
  }

  .filters-section,
  .summary,
  .contributors-section,
  .payments-section {
    padding: 16px 12px;
  }

  .actions-grid {
    grid-template-columns: 1fr;
  }

  .payment-details {
    grid-template-columns: 1fr;
  }

  .payment-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .payment-actions {
    flex-direction: column;
  }

  .section-divider h3 {
    font-size: 1.2rem;
  }

  .modal {
    padding: 12px;
  }

  .modal-header,
  .modal-body {
    padding: 16px;
  }

  .modal-footer {
    padding: 0 16px 16px;
    flex-direction: column;
  }
}

@media (max-width: 360px) {
  .header h1 {
    font-size: 1.3rem;
  }

  .section-title {
    font-size: 1.3rem;
  }

  .btn {
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  .contributor-tag {
    font-size: 0.85rem;
    padding: 6px 12px;
  }
}

/* se añadío para resposive botones */
/* Payment Actions - Corrección específica */
.payment-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.btn-edit {
  background: var(--warning-color);
  color: var(--text-color);
  padding: 10px 20px;
  font-size: 0.9rem;
  text-decoration: none;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  flex: 1;
  min-height: 44px;
  white-space: nowrap;
}

.btn-delete {
  background: var(--danger-color);
  color: white;
  padding: 10px 20px;
  font-size: 0.9rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  min-height: 44px;
  white-space: nowrap;
}

/* Responsive para botones */
@media (max-width: 768px) {
  .payment-actions {
    gap: 10px;
  }

  .btn-edit,
  .btn-delete {
    padding: 10px 16px;
    font-size: 0.85rem;
    min-height: 42px;
  }
}

@media (max-width: 480px) {
  .payment-actions {
    flex-direction: column;
    gap: 8px;
  }

  .btn-edit,
  .btn-delete {
    padding: 12px 16px;
    font-size: 0.9rem;
    min-height: 46px;
    width: 100%;
  }

  /* Asegurar que los botones sean fácilmente clickeables en móviles */
  .btn-edit:active,
  .btn-delete:active {
    transform: scale(0.98);
  }
}

@media (max-width: 360px) {
  .btn-edit,
  .btn-delete {
    padding: 10px 14px;
    font-size: 0.85rem;
    min-height: 44px;
  }

  .btn-edit span,
  .btn-delete span {
    display: inline;
    /* Asegurar que el texto siempre se vea */
  }
}

