/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
    Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f7;
  width: 100%;
  overflow-x: hidden;
  min-width: 320px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* Header styles */
header {
  background-color: #000000;
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header .container {
  display: flex;
  justify-content: center;
  align-items: center;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}

/* Main content styles */
main {
  padding: 2rem 0;
  min-height: calc(100vh - 150px);
}

/* Footer styles */
footer {
  background-color: #333;
  color: #ccc;
  padding: 1rem 0;
  text-align: center;
  font-size: 0.8rem;
}

/* Login page */
.login-container {
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
  padding: 2rem 0;
}

.login-box {
  background-color: white;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-top: 2rem;
}

.strava-login-btn {
  display: inline-block;
  transition: transform 0.2s;
}

.strava-login-btn img {
  max-width: 100%;
  height: auto;
}

.strava-login-btn:hover {
  transform: scale(1.02);
}

/* Dashboard styles */
.dashboard-container {
  padding: 1rem 0;
}

.dashboard-container h2 {
  margin-bottom: 1.5rem;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.image-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.image-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
}

.image-container {
  position: relative;
  overflow: hidden;
}

.image-card img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-bottom: 1px solid #eee;
}

.image-info {
  padding: 15px;
}

.image-info h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.strava-link {
  display: inline-block;
  background-color: #fc5200;
  color: white;
  padding: 5px 12px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.8rem;
  margin-top: 0.5rem;
  transition: background-color 0.2s;
}

.strava-link:hover {
  background-color: #e34c00;
}

/* Download button styles */
.download-btn {
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.download-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translateY(-1px);
}

.download-btn-card {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.image-container:hover .download-btn-card {
  opacity: 1;
  transform: translateY(0);
}

.download-btn-modal {
  padding: 12px 16px;
  font-size: 1rem;
}

.download-btn svg {
  flex-shrink: 0;
}

.no-images {
  text-align: center;
  padding: 3rem 0;
  color: #777;
}

.btn {
  display: inline-block;
  background-color: transparent;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  text-decoration: none;
  border: 1px solid white;
  font-size: 0.9rem;
  transition: all 0.2s;
  cursor: pointer;
  font-family: inherit;
}

.btn:hover {
  background-color: white;
  color: #000000;
}

.btn-primary {
  background-color: #000000;
  color: white;
  border: 1px solid #000000;
}

.btn-primary:hover {
  background-color: #6c757d;
  border-color: #6c757d;
  color: white;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
  border: 1px solid #6c757d;
}

.btn-secondary:hover {
  background-color: #545b62;
  border-color: #545b62;
  color: white;
}

.btn-sm {
  padding: 4px 12px;
  font-size: 0.8rem;
}

.small-date {
  font-size: 0.8em;
  color: #000;
}

/* Selfie Upload Styles */
.selfie-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e1e5e9;
}

.selfie-description {
  color: #666;
  margin-bottom: 1.5rem;
  font-style: italic;
}

.selfie-upload-container {
  max-width: 400px;
  margin: 0 auto;
}

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

.selfie-preview {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #000000;
  margin-bottom: 1rem;
}

.selfie-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

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

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  border: 2px dashed #ddd;
  border-radius: 8px;
  margin-bottom: 1rem;
  color: #666;
}

.upload-placeholder svg {
  margin-bottom: 1rem;
  color: #999;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  overflow-y: auto;
}

.modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 0;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e1e5e9;
}

.modal-header h3 {
  margin: 0;
  color: #333;
}

.close {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.close:hover,
.close:focus {
  color: #000;
}

.modal-body {
  padding: 1.5rem;
}

.upload-step {
  min-height: 300px;
}

.file-upload-area {
  border: 2px dashed #ddd;
  border-radius: 8px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.file-upload-area:hover {
  border-color: #000000;
  background-color: #fff5f1;
}

.file-upload-area.drag-over {
  border-color: #000000;
  background-color: #fff5f1;
}

.file-upload-area svg {
  margin-bottom: 1rem;
  color: #999;
}

.file-upload-area p {
  margin-bottom: 0.5rem;
  color: #333;
}

.file-upload-area small {
  color: #666;
}

.file-validation-error {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 4px;
  text-align: center;
}

.file-validation-error.error {
  background-color: #fee;
  color: #c33;
  border: 1px solid #fcc;
}

.file-validation-error.success {
  background-color: #efe;
  color: #3c3;
  border: 1px solid #cfc;
}

.crop-container {
  max-height: 400px;
  margin-bottom: 1rem;
}

.crop-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.uploading-spinner {
  text-align: center;
  padding: 3rem 2rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #000000;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.uploading-spinner p {
  color: #666;
  margin: 0;
}

.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* Image Viewer Modal */
.image-viewer-modal {
  animation: fadeIn 0.3s ease-out;
  overflow-y: auto;
}

.image-viewer-modal.closing {
  animation: fadeOut 0.3s ease-out;
}

.image-viewer-content {
  position: relative;
  background: none;
  margin: 0;
  padding: 20px;
  border-radius: 0;
  width: 100%;
  max-width: none;
  max-height: none;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  box-sizing: border-box;
}

.image-viewer-header {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 1001;
  width: auto;
  max-width: calc(100vw - 40px);
}

.image-viewer-content .close {
  position: static;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  transition: color 0.2s ease;
  background: none;
  border: none;
}

.image-viewer-content .close:hover,
.image-viewer-content .close:focus {
  color: #000000;
}

#viewerImage {
  max-width: min(1024px, 90vw);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  animation: imageZoomIn 0.3s ease-out;
  width: auto;
  height: auto;
}

.activity-image {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.activity-image:hover {
  opacity: 0.9;
}

/* Multi-image layout styles */
.image-container-multi {
  display: flex;
  gap: 8px;
  padding: 4px;
}

.single-image-wrapper {
  position: relative;
  flex: 1;
  overflow: hidden;
}

.activity-image-multi {
  width: 100%;
  height: auto;
  object-fit: contain;
  max-height: 200px;
}

.image-container-multi .download-btn-card {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 6px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.single-image-wrapper:hover .download-btn-card {
  opacity: 1;
  transform: translateY(0);
}

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

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

@keyframes imageZoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Responsive styles */
@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }

  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
  }

  .modal-content {
    width: 95%;
    margin: 2% auto;
    max-width: calc(100vw - 20px);
  }

  .crop-container {
    max-height: 300px;
  }

  .file-upload-area {
    padding: 2rem 1rem;
  }

  .selfie-actions {
    flex-direction: column;
    align-items: center;
  }

  .image-viewer-content {
    padding: 10px;
  }

  .image-viewer-content .close {
    position: fixed;
    top: 10px;
    right: 15px;
    font-size: 30px;
    z-index: 1002;
  }

  .image-viewer-header {
    position: fixed;
    top: 10px;
    left: 15px;
    transform: none;
    flex-direction: row;
    gap: 15px;
    max-width: calc(100vw - 80px);
    z-index: 1001;
  }

  .download-btn-card {
    opacity: 1;
    transform: translateY(0);
  }

  #viewerImage {
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 80px);
  }

  .credit-packages-table {
    font-size: 0.8rem;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .credit-packages-table th,
  .credit-packages-table td {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .package-notes {
    max-width: 120px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 10px;
  }

  header .container {
    flex-direction: column;
    gap: 0.5rem;
  }

  .image-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .modal-content {
    width: 98%;
    margin: 1% auto;
    max-width: calc(100vw - 10px);
  }

  #viewerImage {
    max-width: calc(100vw - 10px);
    max-height: calc(100vh - 60px);
  }

  .image-viewer-header {
    max-width: calc(100vw - 80px);
  }
}

/* Credit packages section */
.credit-packages-section {
  margin-top: 3rem;
}

.credit-packages-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  margin-top: 1rem;
  overflow-x: auto;
  display: block;
  white-space: nowrap;
}

.credit-packages-table thead,
.credit-packages-table tbody,
.credit-packages-table tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.credit-packages-table th,
.credit-packages-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.credit-packages-table th {
  background-color: #fafafa;
  font-weight: 500;
  color: #666;
  font-size: 0.875rem;
}

.credit-packages-table tr:last-child td {
  border-bottom: none;
}

.package-id {
  font-family: monospace;
  font-size: 0.875rem;
  color: #666;
}

.package-number {
  font-weight: 500;
  color: #666;
  text-align: center;
  width: 40px;
}

.package-status {
  font-size: 0.875rem;
}

.status-active {
  color: #28a745;
}

.status-expired {
  color: #999;
}

.package-credits {
  font-size: 0.875rem;
}

.package-date {
  font-size: 0.875rem;
  color: #666;
}

.package-notes {
  font-size: 0.875rem;
  color: #666;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credit-summary {
  margin-top: 1rem;
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #666;
}

/* Feedback Section Styles */
.feedback-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e1e5e9;
}

.feedback-description {
  color: #666;
  margin-bottom: 1.5rem;
  font-style: italic;
}

.feedback-form {
  max-width: 600px;
  margin: 0 auto;
}

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

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #333;
}

.form-group .required {
  color: #dc3545;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-help {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: #666;
}

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

.feedback-status {
  margin-top: 1.5rem;
}

.feedback-success,
.feedback-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
}

.feedback-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.feedback-success svg {
  color: #28a745;
}

.feedback-error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.feedback-error svg {
  color: #dc3545;
}

/* Account Deletion Styles */
.account-deletion-section {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 2rem;
  margin-top: 2rem;
  border: 1px solid #e5e5e7;
}

.account-deletion-section h2 {
  color: #1d1d1f;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.deletion-description {
  color: #666;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.deletion-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background-color: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  color: #856404;
}

.deletion-warning svg {
  color: #ffc107;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.deletion-warning strong {
  color: #856404;
}

.btn-danger {
  background-color: #dc3545;
  color: white;
  border: 1px solid #dc3545;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-danger:hover {
  background-color: #c82333;
  border-color: #bd2130;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.btn-danger:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.btn-danger:disabled {
  background-color: #6c757d;
  border-color: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Account Deletion Modal Styles */
#deleteAccountModal .modal-content {
  max-width: 600px;
  margin: 50px auto;
}

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

.warning-icon {
  margin: 0 auto 1.5rem;
  color: #ffc107;
}

.deletion-confirmation h4 {
  color: #dc3545;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.deletion-confirmation p {
  color: #666;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.deletion-confirmation ul {
  text-align: left;
  max-width: 400px;
  margin: 1rem auto 1.5rem;
  padding-left: 1.5rem;
}

.deletion-confirmation li {
  color: #666;
}

.confirmation-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

.deletion-status {
  margin-top: 1.5rem;
}

.deletion-processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
}

.deletion-processing .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.deletion-processing .success-icon {
  color: #28a745;
}

.deletion-processing p {
  color: #666;
  margin: 0;
}

.deletion-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 12px 16px;
  border-radius: 8px;
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  font-size: 0.875rem;
}

.deletion-error svg {
  color: #dc3545;
}

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