/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f5;
  color: #212121;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 100vw;
}

/* Header */
#header {
  background: #fff;
  color: white;
  padding: max(16px, env(safe-area-inset-top) + 8px) 16px 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}

#header h1 {
  font-size: 20px;
  font-weight: 500;
}

/* Content Area */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px calc(88px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.tab-content {
  display: none;
  animation: fadeIn 0.2s;
}

.tab-content.active {
  display: block;
}

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

.state-view.hidden {
  display: none;
}

/* Cards */
.welcome-card, .user-card {
  background: white;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 16px;
}

.welcome-card h2 {
  font-size: 24px;
  margin-bottom: 8px;
  color: #d32f2f;
}

.welcome-card p {
  color: #757575;
  margin-bottom: 24px;
}

.user-card h3 {
  font-size: 20px;
  margin-bottom: 4px;
}

.user-card p {
  color: #757575;
  font-size: 14px;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-text {
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-height: 48px;
  touch-action: manipulation;
}

.btn-primary {
  background: #d32f2f;
  color: white;
}

.btn-primary:active {
  background: #c62828;
}

.btn-secondary {
  background: #757575;
  color: white;
}

.btn-secondary:active {
  background: #616161;
}

.btn-text {
  background: transparent;
  color: #d32f2f;
  text-transform: none;
}

.btn-text:active {
  background: rgba(211, 47, 47, 0.1);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 16px;
}

.empty-state p {
  color: #757575;
  margin-bottom: 24px;
  font-size: 16px;
}

/* Reviews List */
#reviews-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-item {
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.review-item h4 {
  font-size: 16px;
  margin-bottom: 8px;
  color: #212121;
}

.review-rating {
  color: #ff9800;
  font-weight: 500;
  margin-bottom: 8px;
}

.review-item p {
  color: #757575;
  font-size: 14px;
  line-height: 1.5;
}

.review-date {
  display: block;
  color: #9e9e9e;
  font-size: 12px;
  margin-top: 8px;
}

/* Review History */
.review-history {
  margin-top: 12px;
  border-top: 1px solid #e0e0e0;
  padding-top: 12px;
}

.history-toggle {
  width: 100%;
  padding: 8px 0;
  background: transparent;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #1976d2;
}

.history-icon {
  transition: transform 0.3s;
  color: #757575;
}

.history-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.history-content.open {
  max-height: 1000px;
}

.history-item {
  padding: 12px;
  background: #f5f5f5;
  border-radius: 4px;
  margin-top: 8px;
}

.history-item p {
  font-size: 13px;
  margin-bottom: 4px;
}

/* Bottom Navigation */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  display: flex;
  box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: color 0.2s;
  color: #757575;
  min-height: 72px;
  touch-action: manipulation;
}

.nav-item.active {
  color: #d32f2f;
}

.nav-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.nav-label {
  font-size: 12px;
  font-weight: 500;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 8px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 {
  font-size: 20px;
  margin-bottom: 16px;
  color: #212121;
}

.modal-content p {
  color: #757575;
  margin-bottom: 16px;
  font-size: 14px;
}

/* Full Screen Modal */
.modal-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #f5f5f5;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.modal-fullscreen.hidden {
  display: none;
}

.fullscreen-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.fullscreen-header {
  background: #d32f2f;
  color: white;
  padding: max(16px, env(safe-area-inset-top) + 8px) 16px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.fullscreen-header h2 {
  font-size: 20px;
  font-weight: 500;
  margin: 0;
  color: white;
}

.btn-icon {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  min-height: 40px;
  min-width: 40px;
  touch-action: manipulation;
}

.fullscreen-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

/* Project Section */
.project-section {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.project-info h3 {
  font-size: 22px;
  color: #212121;
  margin-bottom: 12px;
}

.project-info p {
  color: #616161;
  line-height: 1.6;
  margin-bottom: 16px;
}

.project-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: #757575;
}

.project-meta span {
  display: flex;
  align-items: center;
}

/* Accordion */
.accordion {
  background: white;
  border-radius: 8px;
  margin-bottom: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  overflow: hidden;
}

.accordion-header {
  width: 100%;
  padding: 16px 20px;
  background: white;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: #212121;
  transition: background 0.2s;
}

.accordion-header:active {
  background: #f5f5f5;
}

.accordion-icon {
  transition: transform 0.3s;
  color: #757575;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.accordion-content.open {
  max-height: 500px;
}

#team-members-list {
  padding: 0 20px 16px;
}

.team-member {
  padding: 12px 0;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.team-member:last-child {
  border-bottom: none;
}

.member-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.member-info strong {
  color: #212121;
  font-size: 15px;
}

.member-role {
  font-size: 13px;
  color: #757575;
}

.linkedin-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #0077b5;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.linkedin-link:active {
  opacity: 0.7;
}

/* Review Section */
.review-section {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.review-section h3 {
  font-size: 18px;
  color: #212121;
  margin-bottom: 16px;
}

.rating-slider {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rating-slider input[type="range"] {
  flex: 1;
  margin-bottom: 0;
}
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-size: 16px;
  font-family: inherit;
  min-height: 48px;
  -webkit-appearance: none;
  appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #d32f2f;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

label {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  font-size: 14px;
  color: #212121;
  min-height: 24px;
}

label input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
  margin-bottom: 0;
  min-height: 20px;
}

/* Rating Input */
.rating-input {
  margin-bottom: 16px;
}

.rating-input label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

#rating-value {
  display: inline-block;
  min-width: 30px;
  text-align: center;
  font-weight: 500;
  color: #d32f2f;
  font-size: 18px;
}

/* Form Footer */
.form-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e0e0e0;
  text-align: center;
}

.form-footer p {
  color: #757575;
  font-size: 14px;
  margin: 0;
}

.btn-link {
  background: none;
  border: none;
  color: #1976d2;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.btn-link:active {
  color: #c62828;
}

.form-description {
  color: #757575;
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* Registration Steps */
.reg-step.hidden {
  display: none;
}

/* QR Scanner */
.scanner-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  background: black;
  border-radius: 8px;
  overflow: hidden;
}

#qr-video {
  width: 100%;
  display: block;
}

.scanner-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 250px;
  height: 250px;
  border: 2px solid #1976d2;
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
}

.scanner-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-close-btn:active {
  background: rgba(0, 0, 0, 0.9);
}

/* Loading Spinner */
#loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

#loading.hidden {
  display: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Toast */
.toast {
  position: fixed;
  bottom: 88px;
  left: 16px;
  right: 16px;
  background: #323232;
  color: white;
  padding: 16px;
  border-radius: 4px;
  font-size: 14px;
  z-index: 1500;
  animation: slideUp 0.3s;
}

.toast.hidden {
  display: none;
}

.toast.error {
  background: #d32f2f;
}

.toast.success {
  background: #388e3c;
}

@keyframes slideUp {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Responsive */
@media (min-width: 768px) {
  #app {
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 0 16px rgba(0,0,0,0.1);
  }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  .fullscreen-body {
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
  }
  
  input, select, textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Android Chrome specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  select {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23666" d="M6 9L1.5 4.5h9z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
  }
}

/* Achievements Styles */
.achievements-header {
  text-align: center;
  margin-bottom: 24px;
}

.achievements-header h2 {
  font-size: 24px;
  color: #d32f2f;
  margin-bottom: 8px;
}

.achievements-header p {
  color: #757575;
  font-size: 14px;
}

.badge-list-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: white;
  border-radius: 16px;
  padding: 32px 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: transform 0.2s, box-shadow 0.2s;
}

.badge-list-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.badge-icon {
  margin-bottom: 20px;
  padding: 16px;
  background: linear-gradient(135deg, #fff, #fff);
  border-radius: 20px;
}

.badge-icon img {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  display: block;
}

.badge-content {
  width: 100%;
  margin-bottom: 20px;
}

.badge-name {
  font-weight: 700;
  font-size: 20px;
  color: #212121;
  margin-bottom: 12px;
}

.badge-description {
  font-size: 15px;
  color: #616161;
  line-height: 1.5;
  margin-bottom: 12px;
}

.badge-earned {
  font-size: 14px;
  color: #757575;
  font-weight: 500;
}

.badge-actions {
  width: 100%;
}

.share-btn {
  background: #d32f2f;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  min-height: 44px;
  width: 100%;
  touch-action: manipulation;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.share-btn:active {
  background: #c62828;
}
/* Star Rating */
.star-rating {
  display: flex;
  gap: 4px;
  margin: 8px 0;
  flex-wrap: wrap;
}

.star-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.star {
  font-size: 32px;
  color: #e0e0e0;
  transition: color 0.2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.star:hover,
.star.active {
  color: #ffc107;
}

.star:active {
  transform: scale(0.95);
}

.star-number {
  font-size: 14px;
  color: #757575;
  margin-top: 4px;
  font-weight: 500;
}