/**
 * FarmConnect Location Manager Styles
 * Responsive, modern location selector with auto-detect functionality
 */

/* ==================== LOCATION SELECTOR WRAPPER ==================== */

.location-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.location-selector-fields {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}

.location-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
}

.location-label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 6px;
}

.location-label i {
  color: #059669;
  font-size: 11px;
}

.location-select {
  padding: 8px 32px 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #1f2937;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  appearance: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 180px;
}

.location-select:hover {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.location-select:focus {
  outline: none;
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

/* Auto-detect button */
.detect-location-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  height: 36px;
  align-self: flex-end;
}

.detect-location-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.detect-location-btn:active:not(:disabled) {
  transform: translateY(0);
}

.detect-location-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.detect-location-btn i {
  font-size: 14px;
}

/* ==================== NOTIFICATIONS ==================== */

.location-notification {
  position: fixed;
  top: 80px;
  right: 20px;
  background: white;
  padding: 14px 20px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 320px;
  border-left: 4px solid;
}

.location-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.location-notification i {
  font-size: 20px;
}

.location-notification-success {
  border-left-color: #10b981;
  background: linear-gradient(to right, #ecfdf5 0%, #ffffff 50%);
}

.location-notification-success i {
  color: #10b981;
}

.location-notification-error {
  border-left-color: #ef4444;
  background: linear-gradient(to right, #fef2f2 0%, #ffffff 50%);
}

.location-notification-error i {
  color: #ef4444;
}

.location-notification-warning {
  border-left-color: #f59e0b;
  background: linear-gradient(to right, #fffbeb 0%, #ffffff 50%);
}

.location-notification-warning i {
  color: #f59e0b;
}

.location-notification-info {
  border-left-color: #3b82f6;
  background: linear-gradient(to right, #eff6ff 0%, #ffffff 50%);
}

.location-notification-info i {
  color: #3b82f6;
}

/* ==================== LOCATION BADGE (OPTIONAL) ==================== */

.location-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #166534;
}

.location-badge i {
  color: #059669;
  font-size: 12px;
}

/* ==================== MOBILE RESPONSIVE ==================== */

@media (max-width: 768px) {
  .location-selector-wrapper {
    flex-direction: column;
    width: 100%;
  }

  .location-selector-fields {
    flex-direction: column;
    width: 100%;
  }

  .location-field {
    width: 100%;
    min-width: 100%;
  }

  .location-select {
    width: 100%;
    min-width: 100%;
  }

  .detect-location-btn {
    width: 100%;
    justify-content: center;
    align-self: stretch;
  }

  .detect-text {
    display: inline;
  }

  .location-notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .location-label {
    font-size: 11px;
  }

  .location-select {
    font-size: 13px;
    padding: 7px 28px 7px 10px;
  }

  .detect-location-btn {
    font-size: 13px;
    padding: 7px 14px;
  }

  .location-notification {
    font-size: 13px;
    padding: 12px 16px;
    top: 70px;
  }
}

/* ==================== HEADER INTEGRATION ==================== */

/* If location selector is in header */
.header-location-selector {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-location-selector .location-selector-wrapper {
  background: rgba(255, 255, 255, 0.95);
  padding: 10px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Compact mode for header */
.header-location-selector .location-field {
  min-width: 140px;
}

.header-location-selector .location-select {
  min-width: 140px;
  font-size: 13px;
}

.header-location-selector .detect-location-btn {
  padding: 6px 12px;
  font-size: 13px;
}

.header-location-selector .detect-text {
  display: none;
}

@media (min-width: 1024px) {
  .header-location-selector .detect-text {
    display: inline;
  }
}

/* ==================== DARK MODE SUPPORT ==================== */

@media (prefers-color-scheme: dark) {
  .location-label {
    color: #d1d5db;
  }

  .location-select {
    background-color: #1f2937;
    border-color: #374151;
    color: #f3f4f6;
  }

  .location-select:hover {
    border-color: #10b981;
  }

  .location-notification {
    background: #1f2937;
    color: #f3f4f6;
  }

  .location-notification-success {
    background: linear-gradient(to right, #064e3b 0%, #1f2937 50%);
  }

  .location-notification-error {
    background: linear-gradient(to right, #7f1d1d 0%, #1f2937 50%);
  }

  .location-notification-warning {
    background: linear-gradient(to right, #78350f 0%, #1f2937 50%);
  }

  .location-notification-info {
    background: linear-gradient(to right, #1e3a8a 0%, #1f2937 50%);
  }

  .header-location-selector .location-selector-wrapper {
    background: rgba(31, 41, 55, 0.95);
  }
}

/* ==================== ANIMATIONS ==================== */

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* Pulse animation for detect button when active */
.detect-location-btn:disabled .fa-spinner {
  animation: spin 1s linear infinite;
}

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

/* ==================== UTILITY CLASSES ==================== */

.location-hidden {
  display: none !important;
}

.location-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.location-loading {
  position: relative;
}

.location-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: #059669;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
