/* ======== BASE STYLES ======== */
:root {
  --dark-bg: #1a1a1a;
  --gold: #c5a047;
  --text-light: #ffffff;
  --hover-gold: #d4af37;
  --error-red: #ff4444;
  --success-green: #00C851;
  --modal-bg: #1a1a1a;
  --section-bg: rgba(255,255,255,0.05);
  --input-bg: #2a2a2a;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Arial', sans-serif;
  background-color: var(--dark-bg);
  color: var(--text-light);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
}

/* ======== FOOTER STYLES ======== */
.footer-text {
  text-align: center;
  margin: 2rem 0;
  padding: 1rem;
  color: #888;
  font-size: 0.9em;
  border-top: 1px solid rgba(197, 160, 71, 0.2);
}

.footer-text a {
  color: var(--gold);
  text-decoration: none;
  transition: opacity 0.3s ease;
}

.footer-text a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ======== COMMON COMPONENTS ======== */
.container {
  background: rgba(0, 0, 0, 0.7);
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 0 20px var(--gold);
  margin: 1rem auto;
  max-width: 1200px;
}

h1, h2, h3 {
  color: var(--gold);
  margin-bottom: 1.5rem;
  text-align: center;
}

.input-group {
  margin-bottom: 1.5rem;
}

input, select, button, textarea {
  width: 100%;
  padding: 0.8rem;
  margin: 0.5rem 0;
  border: 1px solid var(--gold);
  border-radius: 5px;
  transition: all 0.3s ease;
  background-color: var(--input-bg);
  color: var(--text-light);
}

button {
  background-color: var(--gold);
  color: var(--dark-bg);
  font-weight: bold;
  cursor: pointer;
  border: none;
}

button:hover {
  opacity: 0.9;
}

.error-message {
  color: var(--error-red);
  font-size: 0.9em;
  min-height: 1.2em;
  display: block;
  margin-top: 0.3rem;
}

.inline-error {
  color: #ff4444;
  background: #ff444422;
  padding: 12px;
  border-radius: 4px;
  margin: 15px 0;
  text-align: center;
  display: none;
  border: 1px solid #ff444466;
  font-size: 0.9em;
}

/* ======== FORM STYLES ======== */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--gold);
}

.form-text {
  display: block;
  font-size: 0.8em;
  color: #888;
  margin-top: 0.3rem;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23c5a047%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem top 50%;
  background-size: 0.65em auto;
}

/* ======== PARCEL DECLARATION SPECIFIC ======== */
.declaration-form .input-group {
  margin-bottom: 1.8rem;
}

#fileUpload {
  border: 1px dashed var(--gold);
  padding: 1rem;
  background: rgba(255,215,0,0.05);
}

#message {
  padding: 1rem;
  margin: 1.5rem 0;
  border-radius: 5px;
  font-size: 0.9em;
}

#message.success {
  background: rgba(0, 200, 81, 0.1);
  border: 1px solid var(--success-green);
  color: var(--success-green);
}

#message.error {
  background: rgba(255, 68, 68, 0.1);
  border: 1px solid var(--error-red);
  color: var(--error-red);
}

#message.pending {
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid #ffc107;
  color: #ffc107;
}

#error-message.status-message {
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid #ffc107;
  color: #ffc107;
}

#error-message.status-message.success {
  background: rgba(0, 200, 81, 0.1);
  border: 1px solid #00C851;
  color: #00C851;
}

/* ======== DASHBOARD STYLES ======== */
.thumbnail-container {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.thumbnail {
  background: var(--section-bg);
  padding: 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s ease;
  border: 1px solid var(--gold);
}

.thumbnail:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(197, 160, 71, 0.2);
}

/* ======== MODAL STYLES ======== */
.welcome-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.9);
  z-index: 9999;
  overflow-y: auto;
}

.welcome-content {
  background-color: var(--modal-bg);
  margin: 2% auto;
  padding: 2rem;
  border: 2px solid var(--gold);
  border-radius: 10px;
  max-width: 800px;
  position: relative;
}

.modal-section {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--section-bg);
  border-radius: 5px;
}

/* ======== TRACKING PAGE STYLES ======== */
.tracking-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr 2fr;
  height: 70vh;
  min-height: 500px;
}

.tracking-list-panel {
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 15px;
  height: 100%;
  overflow: hidden;
}

.tracking-items-container {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
  max-height: calc(100% - 40px);
}

.tracking-items-container::-webkit-scrollbar {
  width: 10px;
  background-color: rgba(0,0,0,0.1);
}

.tracking-items-container::-webkit-scrollbar-thumb {
  background-color: var(--gold);
  border-radius: 5px;
  border: 2px solid rgba(0,0,0,0.1);
}

.tracking-items-container::-webkit-scrollbar-thumb:hover {
  background-color: var(--hover-gold);
}

.tracking-item {
  padding: 12px;
  margin: 8px 0;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tracking-item.active {
  background: rgba(255,215,0,0.1);
  border-left: 3px solid var(--gold);
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.status-pending { background: #ffc107; }
.status-transit { background: #17a2b8; }
.status-delivered { background: #28a745; }
.status-hold { background: #dc3545; }

.uncollected-indicator {
  background: #ff4444;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8em;
  margin-left: 8px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ======== MOBILE STYLES ======== */
@media screen and (max-width: 768px) {
  body {
    padding: 0.5rem !important;
  }
  
  .container {
    width: 95% !important;
    padding: 1rem !important;
    margin: 0.5rem auto !important;
  }
  
  input, button, select {
    font-size: 16px !important;
    padding: 12px !important;
    min-height: 44px;
  }
  
  .thumbnail-container {
    grid-template-columns: 1fr;
  }
  
  .welcome-content {
    width: 95% !important;
    margin: 10px auto !important;
    padding: 15px !important;
  }

  .tracking-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: unset;
  }

  .tracking-list-panel {
    height: 60vh;
    min-height: 300px;
  }

  .tracking-items-container {
    max-height: calc(100% - 30px);
  }
}

/* ======== DESKTOP OVERRIDES ======== */
@media screen and (min-width: 769px) {
  body.desktop-view {
    padding: 2rem;
  }
  
  .declaration-form {
    max-width: 800px;
    margin: 0 auto;
  }
}

/* ======== UTILITY CLASSES ======== */
.gold-text {
  color: var(--gold) !important;
}

.text-center {
  text-align: center;
}

.hidden {
  display: none !important;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.loading-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--gold);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

.button-loader {
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--gold);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ANIMATIONS */
@keyframes slideIn {
  from { transform: translateY(-20px) translateX(-50%); opacity: 0; }
  to { transform: translateY(0) translateX(-50%); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes confettiFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* VISUAL EFFECTS */
.confetti-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, 
    rgba(197,160,71,0.3) 0%,
    rgba(197,160,71,0.1) 70%,
    transparent 100%
  );
  pointer-events: none;
  animation: confettiFade 1.5s ease-out forwards;
}

/* LOGIN/REGISTER FORMS */
.auth-form {
  max-width: 400px;
  margin: 0 auto;
}

.secondary-btn {
  background: transparent !important;
  border: 1px solid var(--gold) !important;
  color: var(--gold) !important;
  margin-top: 1rem;
}

/* MY INFO PAGE */
#changePasswordSection,
#changeEmailSection {
  border-left: 3px solid var(--gold);
  padding-left: 15px;
  margin: 15px 0;
}

.password-rules {
  font-size: 0.8em;
  color: var(--gold);
  margin: 5px 0 10px;
}

/* PRINT STYLES */
@media print {
  body {
    background: white;
    color: black;
  }
  
  .no-print {
    display: none !important;
  }
  
  .container {
    box-shadow: none;
    border: none;
  }
}

/* File input styling for better visibility */
#fileUpload {
  display: block !important;
  width: 100%;
  padding: 12px;
  margin-top: 5px;
  background: #2a2a2a;
  border: 1px solid var(--gold);
  border-radius: 5px;
  color: white;
  cursor: pointer;
}

#fileUpload:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* File input for mobile */
body.mobile-view #fileUpload {
  font-size: 16px;
  min-height: 44px; /* Minimum touch target size */
}

/* File input label styling */
.file-upload-section label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: var(--gold);
}

/* File help text */
#fileHelp {
  display: block;
  margin-top: 5px;
  font-size: 0.9em;
}

/* Success message for files */
#invoiceFilesError.success {
  color: #00C851 !important;
}

/* Error message for files */
#invoiceFilesError {
  color: #ff4444;
  font-size: 0.9em;
  margin-top: 5px;
  display: block;
  min-height: 20px;
}

/* Fix dropdown option colors for select elements */
select option {
  background-color: var(--input-bg) !important;
  color: var(--text-light) !important;
  padding: 10px;
}

select optgroup {
  background-color: var(--dark-bg) !important;
  color: var(--gold) !important;
  font-weight: bold;
  font-size: 1em;
  padding: 8px;
}

select optgroup option {
  background-color: var(--input-bg) !important;
  color: var(--text-light) !important;
  padding-left: 20px;
}
