/* Import Bootstrap Icons */
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css");

/* Loading Animation */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f4f6;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  margin-top: 15px;
  color: #667eea;
  font-weight: 500;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8fafc;
}

/* Login Page Styles */
.login-page {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-form {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.logo {
  text-align: center;
  margin-bottom: 30px;
}

.logo h1 {
  color: #667eea;
  font-size: 2rem;
  margin-bottom: 5px;
}

.logo p {
  color: #6b7280;
  font-size: 0.9rem;
}

.error-message {
  background-color: #fee2e2;
  color: #dc2626;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.login-info {
  margin-top: 20px;
  padding: 15px;
  background-color: #f3f4f6;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #6b7280;
}

/* Navigation */
.navbar {
  background: white;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand h2 {
  color: #667eea;
  font-size: 1.5rem;
}

.nav-menu {
  display: flex;
  gap: 30px;
}

.nav-link {
  text-decoration: none;
  color: #6b7280;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: #667eea;
  background-color: #f3f4f6;
}

.nav-user {
  color: #6b7280;
  font-size: 0.9rem;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.page-header h1 {
  color: #1f2937;
  font-size: 2rem;
  font-weight: 700;
}

.date-filter {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.stat-icon {
  font-size: 2rem;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border-radius: 12px;
}

.stat-content h3 {
  font-size: 2rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 4px;
}

.stat-content p {
  color: #6b7280;
  font-size: 0.9rem;
}

/* Modern Filters */
.filters {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
  margin-bottom: 25px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
}

.filter-group label {
  color: white;
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.filter-group input,
.filter-group select {
  padding: 12px 15px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  font-size: 0.9rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  background: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: end;
}

.filter-actions .btn {
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.filter-actions .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Customer Cards */
.customers-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.customer-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.customer-header {
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.customer-header h3 {
  color: #1f2937;
  font-size: 1.25rem;
  font-weight: 600;
}

.customer-actions {
  display: flex;
  gap: 10px;
}

/* Progress Bar */
.progress-container {
  padding: 20px;
  background: #f9fafb;
}

.progress-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  overflow-x: auto;
  padding: 10px 0;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
  text-align: center;
  position: relative;
}

.progress-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 20px;
  right: -20px;
  width: 20px;
  height: 2px;
  background: #e5e7eb;
  z-index: 1;
}

.progress-step.completed:not(:last-child)::after {
  background: #10b981;
}

.step-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-bottom: 8px;
  position: relative;
  z-index: 2;
}

.progress-step.completed .step-icon {
  background: #10b981;
  color: white;
}

.progress-step.pending .step-icon {
  background: #e5e7eb;
  color: #6b7280;
}

.step-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 4px;
}

.step-date {
  font-size: 0.7rem;
  color: #6b7280;
}

/* Customer Details */
.customer-details {
  padding: 20px;
  border-top: 1px solid #e5e7eb;
}

.detail-row {
  display: flex;
  gap: 30px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.detail-row span {
  font-size: 0.9rem;
  color: #374151;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group small {
  color: #6b7280;
  font-size: 0.8rem;
  margin-top: 4px;
  display: block;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  gap: 8px;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5a67d8;
}

.btn-secondary {
  background: #6b7280;
  color: white;
}

.btn-secondary:hover {
  background: #4b5563;
}

.btn-outline {
  background: transparent;
  color: #6b7280;
  border: 1px solid #d1d5db;
}

.btn-outline:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.btn-danger {
  background: #dc2626;
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  color: #1f2937;
  font-size: 1.5rem;
  font-weight: 600;
}

.close {
  color: #6b7280;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.close:hover {
  color: #374151;
}

.modal form {
  padding: 20px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 30px 0;
  padding: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.pagination-info {
  color: #6b7280;
  font-size: 0.9rem;
}

.pagination {
  display: flex;
  gap: 5px;
  align-items: center;
}

.pagination a,
.pagination span {
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: #6b7280;
  font-weight: 500;
  transition: all 0.2s;
}

.pagination a:hover {
  background: #f3f4f6;
  color: #374151;
}

.pagination .current {
  background: #667eea;
  color: white;
}

.pagination .disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Document Modal */
.documents-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.documents-table th,
.documents-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.documents-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}

.documents-table tr:hover {
  background: #f9fafb;
}

.doc-view-btn {
  background: #1e40af;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.doc-view-btn:hover {
  background: #1d4ed8;
  color: white;
}

/* Dynamic Upload Fields */
.upload-container {
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 20px;
  background: #f9fafb;
}

.upload-field {
  display: flex;
  gap: 15px;
  align-items: end;
  margin-bottom: 15px;
  padding: 15px;
  background: white;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

.upload-field:last-child {
  margin-bottom: 0;
}

.upload-field .form-group {
  flex: 1;
  margin-bottom: 0;
}

.remove-upload {
  background: #dc2626;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

.add-upload-btn {
  background: #10b981;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.add-upload-btn:hover {
  background: #059669;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    height: auto;
    padding: 15px 20px;
  }

  .nav-menu {
    margin: 10px 0;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .customer-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .customer-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .progress-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .progress-step {
    flex-direction: row;
    min-width: auto;
    text-align: left;
    padding: 10px;
    background: white;
    border-radius: 6px;
  }

  .progress-step:not(:last-child)::after {
    display: none;
  }

  .step-icon {
    margin-bottom: 0;
    margin-right: 15px;
  }

  .detail-row {
    flex-direction: column;
    gap: 10px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .modal-content {
    margin: 10% auto;
    width: 95%;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 15px;
  }

  .login-form {
    padding: 30px 20px;
  }

  .customer-actions {
    flex-direction: column;
  }

  .btn-sm {
    width: 100%;
  }
}
