/**
 * RoyalExpress Frontend Styles
 * Modern and professional design for tracking interface
 */

/* Global styles and variables */
:root {
  --primary-color: #2271b1;
  --primary-dark: #185a8c;
  --primary-light: #e8f0f7;
  --accent-color: #ffba00;
  --success-color: #46b450;
  --warning-color: #ffb900;
  --danger-color: #dc3232;
  --info-color: #00a0d2;
  --gray-light: #f0f0f1;
  --gray-medium: #c3c4c7;
  --gray-dark: #50575e;
  --text-main: #1d2327;
  --text-light: #646970;
  --border-radius: 8px;
  --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --transition: all 0.3s ease;
}

/* Base Container */
.royalexpress-tracking-container {
  max-width: 900px;
  margin: 30px auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  color: var(--text-main);
  line-height: 1.5;
  font-size: 15px;
}

.royalexpress-tracking-container h2 {
  text-align: center;
  margin-bottom: 25px;
  color: var(--primary-color);
  font-weight: 600;
  font-size: 28px;
  position: relative;
  padding-bottom: 15px;
}

.royalexpress-tracking-container h2:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  border-radius: 3px;
}

/* Tracking Form */
.royalexpress-tracking-form {
  background: linear-gradient(135deg, var(--primary-light) 0%, white 100%);
  border-radius: var(--border-radius);
  padding: 30px;
  box-shadow: var(--box-shadow);
  margin-bottom: 30px;
  border: 1px solid var(--gray-light);
  position: relative;
  overflow: hidden;
}

.royalexpress-tracking-form:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.royalexpress-tracking-form form {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

.royalexpress-tracking-form input[type='text'] {
  flex: 1;
  min-width: 250px;
  padding: 14px 18px 14px 24px;
  border: 1px solid var(--gray-medium);
  border-radius: 30px;
  font-size: 16px;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) inset;
}

.royalexpress-tracking-form input[type='text']:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.2);
}

.royalexpress-tracking-form button {
  background: linear-gradient(
    to bottom right,
    var(--primary-color),
    var(--primary-dark)
  );
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 30px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: var(--transition);
  box-shadow: 0 4px 10px rgba(34, 113, 177, 0.3);
}

.royalexpress-tracking-form button:hover {
  background: linear-gradient(
    to bottom right,
    var(--primary-dark),
    var(--primary-color)
  );
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(34, 113, 177, 0.4);
}

.royalexpress-tracking-form button:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(34, 113, 177, 0.3);
}

/* Loading indicator */
.royalexpress-loading {
  text-align: center;
  padding: 30px;
  font-style: italic;
  color: var(--text-light);
  animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}

/* Tracking Results */
.royalexpress-tracking-result {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  overflow: hidden;
  border: 1px solid var(--gray-light);
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.royalexpress-tracking-result h3,
.royalexpress-tracking-result h4 {
  margin-top: 0;
  color: var(--primary-color);
}

/* Tracking Header */
.royalexpress-tracking-header {
  padding: 20px 25px;
  background: linear-gradient(120deg, var(--primary-light) 0%, #f8fcff 100%);
  border-bottom: 1px solid var(--gray-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.royalexpress-tracking-header h3 {
  margin: 0;
  font-size: 24px;
  color: var(--primary-color);
  font-weight: 600;
}

.royalexpress-tracking-header p {
  margin: 5px 0 0;
  color: var(--text-light);
  font-size: 14px;
}

/* Status Badges */
.royalexpress-tracking-status {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Status Colors - Enhanced */
.status-en_attente {
  background-color: var(--warning-color);
  color: #fff;
}

.status-prise_en_charge {
  background-color: var(--info-color);
  color: white;
}

.status-en_cours_expedition {
  background-color: var(--primary-color);
  color: white;
}

.status-en_cours_livraison {
  background-color: #6610f2;
  color: white;
}

.status-livree {
  background-color: var(--success-color);
  color: white;
}

.status-refusee,
.status-retournee {
  background-color: var(--danger-color);
  color: white;
}

.status-annulee {
  background-color: var(--gray-dark);
  color: white;
}

/* Tracking Details - 3 Columns Layout */
.royalexpress-tracking-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 25px;
}

.royalexpress-tracking-section {
  background-color: #fafafa;
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: var(--transition);
}

.royalexpress-tracking-section:hover {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.royalexpress-tracking-section h4 {
  margin: 0 0 15px;
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 10px;
  font-size: 16px;
  font-weight: 600;
}

.royalexpress-tracking-section p {
  margin: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.royalexpress-tracking-section p strong {
  color: var(--text-light);
  font-weight: 500;
}

.royalexpress-tracking-section p span {
  color: var(--text-main);
  font-weight: 500;
}

/* Tracking History */
.royalexpress-tracking-history {
  padding: 25px;
  border-top: 1px solid var(--gray-light);
  background-color: white;
}

.royalexpress-tracking-history h4 {
  margin: 0 0 20px;
  color: var(--primary-color);
  font-size: 18px;
  position: relative;
  padding-bottom: 10px;
}

.royalexpress-tracking-history h4:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background-color: var(--accent-color);
  border-radius: 3px;
}

.royalexpress-tracking-history table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 15px;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
}

.royalexpress-tracking-history th,
.royalexpress-tracking-history td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--gray-light);
}

.royalexpress-tracking-history th {
  background: linear-gradient(to bottom, var(--primary-light) 0%, #f0f7fc 100%);
  font-weight: 600;
  color: var(--primary-color);
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.royalexpress-tracking-history td {
  background-color: white;
}

.royalexpress-tracking-history tr:last-child td {
  border-bottom: none;
}

.royalexpress-tracking-history tbody tr:hover td {
  background-color: #f9fafb;
}

/* Package Items Section */
.royalexpress-tracking-items {
  padding: 25px;
  border-top: 1px solid var(--gray-light);
  background-color: white;
}

.royalexpress-tracking-items h4 {
  margin: 0 0 20px;
  color: var(--primary-color);
  font-size: 18px;
  position: relative;
  padding-bottom: 10px;
}

.royalexpress-tracking-items h4:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background-color: var(--accent-color);
  border-radius: 3px;
}

.royalexpress-tracking-items table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 15px;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
}

.royalexpress-tracking-items th,
.royalexpress-tracking-items td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--gray-light);
}

.royalexpress-tracking-items th {
  background: linear-gradient(to bottom, var(--primary-light) 0%, #f0f7fc 100%);
  font-weight: 600;
  color: var(--primary-color);
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.royalexpress-tracking-items td {
  background-color: white;
}

.royalexpress-tracking-items tbody tr:hover td {
  background-color: #f9fafb;
}

.royalexpress-tracking-items td:nth-child(2),
.royalexpress-tracking-items td:nth-child(3),
.royalexpress-tracking-items td:nth-child(4),
.royalexpress-tracking-items th:nth-child(2),
.royalexpress-tracking-items th:nth-child(3),
.royalexpress-tracking-items th:nth-child(4) {
  text-align: right;
}

.royalexpress-tracking-total td {
  font-weight: 600;
  background-color: #f9f9f9;
}

.royalexpress-tracking-total:hover td {
  background-color: #f9f9f9 !important;
}

.royalexpress-tracking-total:last-child td {
  color: var(--primary-color);
  font-weight: 700;
  font-size: 16px;
  background: linear-gradient(
    to bottom,
    var(--primary-light) 0%,
    #e8f0f7 100%
  ) !important;
}

/* Not Found Message */
.royalexpress-tracking-result[style*='text-align: center'] {
  padding: 40px 20px;
  text-align: center;
}

.royalexpress-tracking-result[style*='text-align: center'] h3 {
  color: var(--danger-color);
  font-size: 22px;
  margin-bottom: 15px;
}

.royalexpress-tracking-result[style*='text-align: center'] p {
  font-size: 16px;
  margin: 10px 0;
  color: var(--text-light);
}

.royalexpress-tracking-result[style*='text-align: center'] strong {
  color: var(--text-main);
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .royalexpress-tracking-details {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .royalexpress-tracking-form form {
    flex-direction: column;
  }

  .royalexpress-tracking-form input[type='text'] {
    width: 100%;
  }

  .royalexpress-tracking-form button {
    width: 100%;
  }

  .royalexpress-tracking-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .royalexpress-tracking-header > div:last-child {
    margin-top: 15px;
  }

  .royalexpress-tracking-details {
    grid-template-columns: 1fr;
  }

  .royalexpress-tracking-section {
    margin-bottom: 15px;
  }
}

@media (max-width: 600px) {
  .royalexpress-tracking-history th:nth-child(3),
  .royalexpress-tracking-history td:nth-child(3) {
    display: none;
  }

  .royalexpress-tracking-items th:nth-child(3),
  .royalexpress-tracking-items td:nth-child(3) {
    display: none;
  }

  .royalexpress-tracking-items th,
  .royalexpress-tracking-items td {
    padding: 10px 8px;
    font-size: 13px;
  }
}
