/* iOS-style components for McDowell Caddie Club */

/* iOS Navigation Bar */
.ios-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 44px;
  background-color: var(--paper-translucent, rgba(251, 244, 230, 0.85));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 0.5px solid var(--border, rgba(127, 106, 79, 0.3));
  position: relative;
  z-index: 100;
}

.ios-nav-title {
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink, #2E2114);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.ios-nav-button {
  background: none;
  border: none;
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 17px;
  font-weight: 400;
  color: var(--accent, #B87333);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.ios-nav-button:active {
  background-color: var(--accent-soft, rgba(184, 115, 51, 0.1));
}

/* Interface toggle button in topbar */
.topbar .ios-nav-button {
  margin-left: 16px;
  white-space: nowrap;
}

/* iOS Tab Bar */
.ios-tab-bar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 49px;
  background-color: var(--paper-translucent, rgba(251, 244, 230, 0.85));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 0.5px solid var(--border, rgba(127, 106, 79, 0.3));
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.ios-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  text-decoration: none;
  color: var(--muted, #6E5A40);
  font-size: 10px;
  font-weight: 400;
  transition: color 0.2s ease;
}

.ios-tab-item.active {
  color: var(--accent, #B87333);
}

.ios-tab-icon {
  width: 28px;
  height: 28px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ios-tab-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* iOS List Items */
.ios-list {
  background-color: var(--paper, #FBF4E6);
  border-radius: 10px;
  overflow: hidden;
  margin: 16px;
  box-shadow: 0 1px 3px var(--shadow-soft, rgba(120, 85, 50, 0.1));
}

.ios-list-item {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 0.5px solid rgba(127, 106, 79, 0.15);
}

.ios-list-item:last-child {
  border-bottom: none;
}

.ios-list-item-content {
  flex: 1;
}

.ios-list-item-title {
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 17px;
  font-weight: 400;
  color: var(--ink, #2E2114);
  margin-bottom: 2px;
}

.ios-list-item-subtitle {
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--muted, #6E5A40);
}

.ios-list-item-accessory {
  color: var(--accent, #B87333);
  margin-left: 8px;
}

/* iOS Switch */
.ios-switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ios-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--switch-off, #E5E5E5);
  transition: .4s;
  border-radius: 31px;
}

.ios-switch-slider:before {
  position: absolute;
  content: "";
  height: 27px;
  width: 27px;
  left: 2px;
  bottom: 2px;
  background-color: var(--switch-thumb, white);
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.15);
}

.ios-switch input:checked + .ios-switch-slider {
  background-color: var(--accent, #B87333);
}

.ios-switch input:checked + .ios-switch-slider:before {
  transform: translateX(20px);
}

/* iOS Button */
.ios-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  background-color: var(--accent, #B87333);
  color: var(--paper-soft, #F8EFDE);
  border: none;
  border-radius: 12px;
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 17px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}

.ios-button:active {
  background-color: var(--accent-dark, #8A551F);
  transform: scale(0.98);
}

.ios-button.outline {
  background-color: transparent;
  color: var(--accent, #B87333);
  border: 1px solid var(--accent, #B87333);
}

.ios-button.outline:active {
  background-color: var(--accent-soft, rgba(184, 115, 51, 0.1));
}

.ios-button.destructive {
  background-color: var(--danger, #B5482E);
  color: var(--paper-soft, #F8EFDE);
}

.ios-button.destructive:active {
  background-color: var(--danger-dark, #8B3824);
}

/* iOS Segmented Control */
.ios-segmented-control {
  display: inline-flex;
  background-color: rgba(127, 106, 79, 0.1);
  border-radius: 12px;
  padding: 4px;
}

.ios-segmented-button {
  padding: 8px 16px;
  background: none;
  border: none;
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted, #6E5A40);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
  text-align: center;
}

.ios-segmented-button.active {
  background-color: var(--paper, #FBF4E6);
  color: var(--ink, #2E2114);
  box-shadow: 0 1px 3px var(--shadow-medium, rgba(120, 85, 50, 0.15));
}

/* iOS Card */
.ios-card {
  background-color: var(--paper, #FBF4E6);
  border-radius: 16px;
  padding: 20px;
  margin: 16px;
  box-shadow: 0 4px 12px var(--shadow-soft, rgba(120, 85, 50, 0.1));
}

.ios-card-title {
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink, #2E2114);
  margin-bottom: 8px;
}

.ios-card-content {
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 15px;
  color: var(--muted, #6E5A40);
  line-height: 1.5;
}

/* iOS Modal */
.ios-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--overlay, rgba(0, 0, 0, 0.3));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.ios-modal {
  background-color: var(--paper, #FBF4E6);
  border-radius: 16px;
  width: 90%;
  max-width: 350px;
  overflow: hidden;
  box-shadow: 0 20px 40px var(--shadow-strong, rgba(120, 85, 50, 0.2));
  transform: translateY(50px);
  opacity: 0;
  animation: modalAppear 0.3s forwards;
}

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

.ios-modal-header {
  padding: 20px;
  text-align: center;
  border-bottom: 0.5px solid rgba(127, 106, 79, 0.15);
}

.ios-modal-title {
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink, #2E2114);
}

.ios-modal-content {
  padding: 20px;
}

.ios-modal-actions {
  display: flex;
  border-top: 0.5px solid rgba(127, 106, 79, 0.15);
}

.ios-modal-button {
  flex: 1;
  padding: 16px;
  background: none;
  border: none;
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 17px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.ios-modal-button:active {
  background-color: rgba(127, 106, 79, 0.05);
}

.ios-modal-button.primary {
  color: var(--accent, #B87333);
  font-weight: 600;
}

.ios-modal-button.destructive {
  color: var(--danger, #B5482E);
}

.ios-modal-button:not(:last-child) {
  border-right: 0.5px solid rgba(127, 106, 79, 0.15);
}

/* Safe Area Insets for iOS */
.ios-safe-area-top {
  padding-top: env(safe-area-inset-top);
}

.ios-safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

/* iOS-style input fields */
.ios-input-group {
  margin-bottom: 20px;
}

.ios-input-label {
  display: block;
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink, #2E2114);
  margin-bottom: 8px;
}

.ios-input {
  width: 100%;
  padding: 14px 16px;
  background-color: var(--paper, #FBF4E6);
  border: 0.5px solid var(--border, rgba(127, 106, 79, 0.3));
  border-radius: 12px;
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 17px;
  color: var(--ink, #2E2114);
  transition: border-color 0.2s ease;
}

.ios-input:focus {
  outline: none;
  border-color: var(--accent, #B87333);
}

/* iOS-style picker */
.ios-picker {
  width: 100%;
  padding: 14px 16px;
  background-color: var(--paper, #FBF4E6);
  border: 0.5px solid var(--border, rgba(127, 106, 79, 0.3));
  border-radius: 12px;
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 17px;
  color: var(--ink, #2E2114);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236E5A40' d='M1,2 L6,7 L11,2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

/* iOS-style toast notification */
.ios-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background-color: var(--ink-translucent, rgba(46, 33, 20, 0.9));
  color: var(--paper-soft, #F8EFDE);
  padding: 14px 24px;
  border-radius: 20px;
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 15px;
  font-weight: 500;
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 90%;
  text-align: center;
}

.ios-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* iOS-style action sheet */
.ios-action-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--paper, #FBF4E6);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding: 20px;
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  max-height: 80vh;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
}

.ios-action-sheet.show {
  transform: translateY(0);
}

.ios-action-sheet-title {
  text-align: center;
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 15px;
  color: var(--muted, #6E5A40);
  margin-bottom: 20px;
  padding: 0 20px;
}

.ios-action-sheet-item {
  padding: 16px;
  text-align: center;
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 17px;
  font-weight: 400;
  color: var(--accent, #B87333);
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.ios-action-sheet-item:active {
  background-color: var(--accent-soft, rgba(184, 115, 51, 0.1));
}

.ios-action-sheet-item.destructive {
  color: var(--danger, #B5482E);
}

.ios-action-sheet-item.cancel {
  font-weight: 600;
  color: var(--ink, #2E2114);
  margin-top: 16px;
}

.ios-action-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--overlay, rgba(0, 0, 0, 0.3));
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ios-action-sheet-overlay.show {
  opacity: 1;
}

/* iOS-style progress indicator */
.ios-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--accent-border, rgba(184, 115, 51, 0.3));
  border-top: 3px solid var(--accent, #B87333);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

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

/* iOS-style refresh control */
.ios-refresh-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ios-refresh-control.show {
  opacity: 1;
}

.ios-refresh-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--accent-border, rgba(184, 115, 51, 0.3));
  border-top: 2px solid var(--accent, #B87333);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 8px;
}

.ios-refresh-text {
  font-family: 'The Seasons', Cochin, 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  color: var(--muted, #6E5A40);
}
