:root {
  /* Colors */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #64748b;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Backgrounds */
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-dark: #0f172a;
  --bg-card: rgba(255, 255, 255, 0.1);
  --bg-card-solid: #1e293b;

  /* Text */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Borders */
  --border-color: rgba(255, 255, 255, 0.1);
  --border-radius: 16px;
  --border-radius-sm: 8px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Glass Card Effect */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

/* Loading State */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: var(--space-md);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Views */
.view {
  min-height: 100vh;
  padding: var(--space-md);
  padding-bottom: 100px;
}

/* Login View */
.login-card {
  max-width: 400px;
  margin: 0 auto;
  margin-top: 20vh;
  padding: var(--space-xl);
  text-align: center;
}

.logo {
  margin-bottom: var(--space-lg);
}

.logo-icon {
  font-size: 48px;
  display: block;
  margin-bottom: var(--space-sm);
}

.logo h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
}

.login-hint {
  margin-top: var(--space-lg);
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Form Elements */
.form-group {
  margin-bottom: var(--space-md);
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--space-xs);
  color: var(--text-secondary);
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.input-group {
  display: flex;
  gap: var(--space-sm);
}

.input-group input {
  flex: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--border-radius-sm);
  transition: background 0.2s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-google {
  background: white;
  color: #333;
  font-weight: 500;
}

.btn-google:hover {
  background: #f0f0f0;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-google svg {
  margin-right: 8px;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  margin-bottom: var(--space-md);
  padding: var(--space-md);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-xs);
  margin-bottom: var(--space-md);
}

.tab-btn {
  flex: 1;
  padding: 12px var(--space-sm);
  font-size: 0.875rem;
  font-weight: 500;
  background: none;
  border: none;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
}

.tab-btn:not(.active):hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Tab Content */
.tab-content {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Section Headers */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.section-header h2,
.section-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

/* Card List */
.card-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Doctor Card */
.doctor-card {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.doctor-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.doctor-name {
  font-size: 1.125rem;
  font-weight: 600;
}

.doctor-specialty {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.doctor-status {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.75rem;
  color: var(--success);
}

.doctor-status.inactive {
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.doctor-url {
  font-size: 0.75rem;
  color: var(--text-muted);
  word-break: break-all;
}

.doctor-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-xl);
}

.empty-icon {
  font-size: 48px;
  display: block;
  margin-bottom: var(--space-md);
}

.empty-state p {
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
}

.empty-state small {
  color: var(--text-muted);
}

/* Appointment Card */
.appointment-card {
  padding: var(--space-md);
}

.appointment-date {
  font-size: 1.125rem;
  font-weight: 600;
}

.appointment-doctor {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.appointment-actions {
  margin-top: var(--space-md);
}

/* Member Card */
.member-card {
  padding: var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.member-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.member-name {
  font-weight: 500;
}

.member-phone {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Info Card */
.info-card {
  padding: var(--space-md);
  margin-top: var(--space-lg);
  font-size: 0.875rem;
}

.info-card p {
  color: var(--text-secondary);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-lg);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.modal-actions .btn {
  flex: 1;
}

/* Settings */
.settings-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.user-info-card {
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius-sm);
}

.user-info-card p {
  margin-bottom: var(--space-xs);
}

.user-info-card .label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Responsive */
@media (min-width: 768px) {
  .modal-content {
    border-radius: var(--border-radius);
    margin: var(--space-lg);
  }

  .modal {
    align-items: center;
  }

  @keyframes slideUp {
    from {
      opacity: 0;
      transform: scale(0.95);
    }

    to {
      opacity: 1;
      transform: scale(1);
    }
  }
}

/* Safe Area for iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .view {
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
  }
}