/**
 * TourSure Profile Management Styles
 * Airbnb-inspired modern design with clean aesthetics
 */

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
  /* Light Mode Colors */
  --tour-bg-primary: #ffffff;
  --tour-bg-secondary: #f9fafb;
  --tour-bg-tertiary: #f3f4f6;
  --tour-text-primary: #111827;
  --tour-text-secondary: #6b7280;
  --tour-text-tertiary: #9ca3af;
  --tour-border: #e5e7eb;
  --tour-border-light: #f3f4f6;
  --tour-accent: #6366f1;
  --tour-accent-hover: #4f46e5;
  --tour-accent-light: #eef2ff;
  --tour-success: #10b981;
  --tour-success-light: #d1fae5;
  --tour-error: #ef4444;
  --tour-error-light: #fee2e2;
  --tour-warning: #f59e0b;
  --tour-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --tour-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --tour-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --tour-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --tour-radius-sm: 6px;
  --tour-radius-md: 8px;
  --tour-radius-lg: 12px;
  --tour-radius-xl: 16px;
  --tour-transition: all 0.2s ease;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --tour-bg-primary: #1a1a1a;
    --tour-bg-secondary: #222222;
    --tour-bg-tertiary: #2a2a2a;
    --tour-text-primary: #ffffff;
    --tour-text-secondary: #a1a1aa;
    --tour-text-tertiary: #71717a;
    --tour-border: #3f3f46;
    --tour-border-light: #2a2a2a;
    --tour-accent-light: #312e81;
    --tour-success-light: #064e3b;
    --tour-error-light: #7f1d1d;
  }
}

/* ============================================
   Main Container
   ============================================ */
.toursure-profile-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: 70vh;
}

/* ============================================
   Sidebar
   ============================================ */
.toursure-profile-sidebar {
  background: var(--tour-bg-primary);
  border: 1px solid var(--tour-border);
  border-radius: var(--tour-radius-lg);
  padding: 24px;
  height: fit-content;
  position: sticky;
  top: 20px;
  box-shadow: var(--tour-shadow-sm);
}

/* User Info Section */
.toursure-profile-user-info {
  text-align: center;
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--tour-border);
}

.toursure-profile-avatar {
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--tour-accent-light);
  box-shadow: var(--tour-shadow-md);
  transition: var(--tour-transition);
}

.toursure-profile-avatar:hover {
  transform: scale(1.05);
  box-shadow: var(--tour-shadow-lg);
}

.toursure-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.toursure-profile-user-info h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--tour-text-primary);
  line-height: 1.4;
}

.toursure-profile-email {
  font-size: 14px;
  color: var(--tour-text-secondary);
  margin: 0;
  word-break: break-word;
}

/* Navigation Menu */
.toursure-profile-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toursure-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--tour-radius-md);
  color: var(--tour-text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--tour-transition);
  cursor: pointer;
  border: 1px solid transparent;
}

.toursure-nav-item:hover {
  background: var(--tour-bg-secondary);
  color: var(--tour-text-primary);
}

.toursure-nav-item.active {
  background: var(--tour-accent-light);
  color: var(--tour-accent);
  border-color: var(--tour-accent);
  font-weight: 600;
}

.toursure-nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toursure-nav-item.active svg {
  color: var(--tour-accent);
}

/* Navigation Wrapper for Fade Effects */
.toursure-profile-nav-wrapper {
  position: relative;
}

/* Fade gradient overlays */
.toursure-profile-nav-wrapper::before,
.toursure-profile-nav-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 4px;
  /* Account for scrollbar padding */
  width: 40px;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.toursure-profile-nav-wrapper::before {
  left: 0;
  background: linear-gradient(to right,
      var(--tour-bg-primary) 0%,
      var(--tour-bg-primary) 20%,
      rgba(255, 255, 255, 0) 100%);
}

.toursure-profile-nav-wrapper::after {
  right: 0;
  background: linear-gradient(to left,
      var(--tour-bg-primary) 0%,
      var(--tour-bg-primary) 20%,
      rgba(255, 255, 255, 0) 100%);
}

/* Dark mode gradient support */
@media (prefers-color-scheme: dark) {
  .toursure-profile-nav-wrapper::before {
    background: linear-gradient(to right,
        var(--tour-bg-primary) 0%,
        var(--tour-bg-primary) 20%,
        rgba(26, 26, 26, 0) 100%);
  }

  .toursure-profile-nav-wrapper::after {
    background: linear-gradient(to left,
        var(--tour-bg-primary) 0%,
        var(--tour-bg-primary) 20%,
        rgba(26, 26, 26, 0) 100%);
  }
}

/* Show gradients when scrollable */
.toursure-profile-nav-wrapper.show-left-fade::before {
  opacity: 1;
}

.toursure-profile-nav-wrapper.show-right-fade::after {
  opacity: 1;
}

/* ============================================
   Main Content Area
   ============================================ */
.toursure-profile-main {
  background: var(--tour-bg-primary);
  border: 1px solid var(--tour-border);
  border-radius: var(--tour-radius-lg);
  padding: 32px;
  box-shadow: var(--tour-shadow-sm);
  min-height: 500px;
}

/* Tab Content */
.toursure-profile-tab {
  display: none;
  animation: fadeIn 0.3s ease;
}

.toursure-profile-tab.active {
  display: block;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Tab Header */
.toursure-profile-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--tour-border-light);
}

.toursure-profile-header h2 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--tour-text-primary);
  line-height: 1.3;
}

.toursure-profile-subtitle {
  margin: 0;
  font-size: 15px;
  color: var(--tour-text-secondary);
  line-height: 1.5;
}

/* ============================================
   Forms
   ============================================ */
.toursure-profile-form {
  max-width: 600px;
}

/* Form Row (2-column layout) */
.toursure-form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

/* Form Group */
.toursure-form-group {
  margin-bottom: 24px;
}

.toursure-form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--tour-text-primary);
  font-size: 14px;
  line-height: 1.5;
}

.toursure-form-group label .required {
  color: var(--tour-error);
  margin-left: 2px;
}

/* Input Fields */
.toursure-form-group input[type="text"],
.toursure-form-group input[type="email"],
.toursure-form-group input[type="tel"],
.toursure-form-group input[type="password"],
.toursure-form-group select,
.toursure-form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--tour-border);
  border-radius: var(--tour-radius-md);
  font-size: 15px;
  font-family: inherit;
  color: var(--tour-text-primary);
  background: var(--tour-bg-primary);
  transition: var(--tour-transition);
  line-height: 1.5;
}

.toursure-form-group input:focus,
.toursure-form-group select:focus,
.toursure-form-group textarea:focus {
  outline: none;
  border-color: var(--tour-accent);
  box-shadow: 0 0 0 3px var(--tour-accent-light);
}

.toursure-form-group input::placeholder,
.toursure-form-group textarea::placeholder {
  color: var(--tour-text-tertiary);
}

/* Input States */
.toursure-form-group input.input-error,
.toursure-form-group select.input-error,
.toursure-form-group textarea.input-error {
  border-color: var(--tour-error);
}

.toursure-form-group input.input-error:focus,
.toursure-form-group select.input-error:focus,
.toursure-form-group textarea.input-error:focus {
  box-shadow: 0 0 0 3px var(--tour-error-light);
}

.toursure-form-group input:disabled,
.toursure-form-group select:disabled,
.toursure-form-group textarea:disabled {
  background: var(--tour-bg-secondary);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Select Dropdown */
.toursure-form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 40px;
}

/* Field Hints */
.toursure-field-hint {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--tour-text-tertiary);
  line-height: 1.4;
}

/* ============================================
   Checkboxes
   ============================================ */
.toursure-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--tour-text-primary);
}

.toursure-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--tour-accent);
  flex-shrink: 0;
}

.toursure-checkbox-label span {
  line-height: 1.5;
}

/* ============================================
   Buttons
   ============================================ */
.toursure-btn-primary,
.toursure-btn-secondary {
  padding: 12px 24px;
  border: none;
  border-radius: var(--tour-radius-md);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--tour-transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1.5;
  text-decoration: none;
}

.toursure-btn-primary {
  background: var(--tour-accent);
  color: white;
  box-shadow: var(--tour-shadow-sm);
}

.toursure-btn-primary:hover:not(:disabled) {
  background: var(--tour-accent-hover);
  box-shadow: var(--tour-shadow-md);
  transform: translateY(-1px);
}

.toursure-btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--tour-shadow-sm);
}

.toursure-btn-secondary {
  background: white;
  color: var(--tour-text-primary);
  border: 1px solid var(--tour-border);
  box-shadow: var(--tour-shadow-sm);
}

.toursure-btn-secondary:hover:not(:disabled) {
  background: var(--tour-bg-secondary);
  border-color: var(--tour-text-secondary);
  box-shadow: var(--tour-shadow-md);
}

.toursure-btn-primary:disabled,
.toursure-btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Form Actions */
.toursure-form-actions {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--tour-border-light);
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ============================================
   Messages
   ============================================ */
.toursure-form-message {
  display: none;
  padding: 14px 16px;
  border-radius: var(--tour-radius-md);
  margin-top: 20px;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toursure-form-message.success {
  background: var(--tour-success-light);
  color: var(--tour-success);
  border: 1px solid var(--tour-success);
}

.toursure-form-message.error {
  background: var(--tour-error-light);
  color: var(--tour-error);
  border: 1px solid var(--tour-error);
}

/* ============================================
   Profile Photo Upload
   ============================================ */

/* Photo Preview Section */
.toursure-photo-preview-section {
  text-align: center;
  margin-bottom: 32px;
}

.toursure-current-photo {
  display: inline-block;
}

.toursure-current-photo img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  border: 3px solid var(--tour-border);
  box-shadow: var(--tour-shadow-lg);
  transition: var(--tour-transition);
}

.toursure-current-photo img:hover {
  transform: scale(1.02);
  box-shadow: var(--tour-shadow-xl);
}

/* Photo Preview Styling */
#toursure-photo-preview {
  border-radius: 10px;
}

/* Drag & Drop Upload Container */
.toursure-photo-upload-container {
  position: relative;
  padding: 48px 32px;
  background: var(--tour-bg-secondary);
  border-radius: var(--tour-radius-lg);
  border: 2px dashed var(--tour-border);
  text-align: center;
  transition: var(--tour-transition);
  cursor: pointer;
}

.toursure-photo-upload-container:hover {
  border-color: var(--tour-accent);
  background: var(--tour-accent-light);
}

.toursure-photo-upload-container.drag-over {
  border-color: var(--tour-accent);
  background: var(--tour-accent-light);
  border-style: solid;
  transform: scale(1.01);
}

/* Upload Content */
.toursure-upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.toursure-upload-icon {
  width: 64px;
  height: 64px;
  color: var(--tour-text-tertiary);
  transition: var(--tour-transition);
}

.toursure-photo-upload-container:hover .toursure-upload-icon,
.toursure-photo-upload-container.drag-over .toursure-upload-icon {
  color: var(--tour-accent);
  transform: translateY(-4px);
}

.toursure-upload-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.toursure-upload-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--tour-text-primary);
  line-height: 1.4;
}

.toursure-upload-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--tour-text-secondary);
  line-height: 1.4;
}

.toursure-photo-hint {
  margin: 12px 0 0 0;
  font-size: 13px;
  color: var(--tour-text-tertiary);
  line-height: 1.6;
  max-width: 500px;
}

/* Upload Progress */
.toursure-upload-progress {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.toursure-progress-bar {
  width: 100%;
  max-width: 400px;
  height: 8px;
  background: var(--tour-bg-tertiary);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toursure-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--tour-accent), var(--tour-accent-hover));
  border-radius: 999px;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.toursure-progress-text {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--tour-text-secondary);
}

/* Spinning animation for upload icon */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.toursure-upload-progress .toursure-upload-icon {
  animation: spin 2s linear infinite;
}

/* ============================================
   Login Required Message
   ============================================ */
.toursure-profile-login-required {
  text-align: center;
  padding: 60px 20px;
}

.toursure-profile-login-required h3 {
  font-size: 24px;
  margin: 0 0 12px 0;
  color: var(--tour-text-primary);
}

.toursure-profile-login-required p {
  font-size: 15px;
  color: var(--tour-text-secondary);
  margin: 0 0 24px 0;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet (768px and below) */
@media (max-width: 768px) {
  .toursure-profile-container {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 16px;
  }

  .toursure-profile-sidebar {
    position: static;
    padding: 20px;
    overflow: hidden;
    /* Prevent content from overflowing */
  }

  .toursure-profile-nav-wrapper {
    width: 100%;
    position: relative;
  }

  .toursure-profile-nav {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: thin;
    scrollbar-color: var(--tour-border) transparent;
  }

  /* Hide scrollbar for Chrome, Safari and Opera */
  .toursure-profile-nav::-webkit-scrollbar {
    height: 4px;
  }

  .toursure-profile-nav::-webkit-scrollbar-track {
    background: transparent;
  }

  .toursure-profile-nav::-webkit-scrollbar-thumb {
    background: var(--tour-border);
    border-radius: 2px;
  }

  .toursure-profile-nav::-webkit-scrollbar-thumb:hover {
    background: var(--tour-text-tertiary);
  }

  .toursure-nav-item {
    white-space: nowrap;
    flex-shrink: 0;
    min-width: fit-content;
  }

  .toursure-nav-item span {
    display: inline;
  }

  .toursure-profile-main {
    padding: 24px;
  }

  .toursure-profile-header h2 {
    font-size: 24px;
  }

  .toursure-form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .toursure-photo-upload-container {
    padding: 32px 20px;
  }

  .toursure-current-photo img {
    width: 150px;
    height: 150px;
  }

  .toursure-upload-icon {
    width: 48px;
    height: 48px;
  }

  .toursure-upload-title {
    font-size: 16px;
  }

  .toursure-form-actions {
    flex-direction: column;
    width: 100%;
  }

  .toursure-form-actions button {
    width: 100%;
  }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
  .toursure-profile-container {
    padding: 16px 12px;
  }

  .toursure-profile-sidebar {
    padding: 16px;
    overflow: hidden;
    /* Prevent content from overflowing */
  }

  .toursure-profile-nav-wrapper {
    width: 100%;
    position: relative;
  }

  .toursure-profile-nav-wrapper::before,
  .toursure-profile-nav-wrapper::after {
    width: 32px;
    /* Smaller gradients on small screens */
  }

  .toursure-profile-avatar {
    width: 80px;
    height: 80px;
  }

  .toursure-profile-user-info h3 {
    font-size: 16px;
  }

  .toursure-profile-email {
    font-size: 13px;
  }

  .toursure-nav-item {
    padding: 10px 14px;
    font-size: 13px;
  }

  .toursure-nav-item svg {
    width: 18px;
    height: 18px;
  }

  .toursure-profile-main {
    padding: 20px 16px;
  }

  .toursure-profile-header {
    margin-bottom: 24px;
  }

  .toursure-profile-header h2 {
    font-size: 20px;
  }

  .toursure-profile-subtitle {
    font-size: 14px;
  }

  .toursure-form-group {
    margin-bottom: 20px;
  }

  .toursure-form-group label {
    font-size: 13px;
  }

  .toursure-form-group input,
  .toursure-form-group select,
  .toursure-form-group textarea {
    padding: 10px 14px;
    font-size: 14px;
  }

  .toursure-btn-primary,
  .toursure-btn-secondary {
    padding: 10px 20px;
    font-size: 14px;
  }

  .toursure-photo-upload-container {
    padding: 24px 16px;
  }

  .toursure-current-photo img {
    width: 120px;
    height: 120px;
  }

  .toursure-upload-icon {
    width: 40px;
    height: 40px;
  }

  .toursure-upload-title {
    font-size: 15px;
  }

  .toursure-photo-hint {
    font-size: 12px;
  }
}

/* ============================================
   Accessibility Enhancements
   ============================================ */

/* Focus Visible for Keyboard Navigation */
.toursure-nav-item:focus-visible,
.toursure-btn-primary:focus-visible,
.toursure-btn-secondary:focus-visible {
  outline: 2px solid var(--tour-accent);
  outline-offset: 2px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {

  .toursure-profile-sidebar,
  .toursure-profile-main {
    border-width: 2px;
  }

  .toursure-nav-item.active {
    border-width: 2px;
  }

  .toursure-form-group input:focus,
  .toursure-form-group select:focus,
  .toursure-form-group textarea:focus {
    outline: 2px solid var(--tour-accent);
  }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {

  .toursure-profile-sidebar,
  .toursure-form-actions,
  .toursure-btn-primary,
  .toursure-btn-secondary {
    display: none;
  }

  .toursure-profile-container {
    grid-template-columns: 1fr;
  }

  .toursure-profile-main {
    border: none;
    box-shadow: none;
  }
}
