/* Reusable Components - PuzzelLog */

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
  min-width: 44px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.875rem;
  min-height: 32px;
}

.btn-block {
  width: 100%;
  display: block;
}

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

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text);
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s;
  min-height: 44px;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-error {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 1px 3px var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card-header {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.card-body {
  margin-bottom: 1rem;
}

/* Navigation */
.nav {
  background: var(--surface);
  box-shadow: 0 1px 3px var(--shadow);
  padding: 1rem 0;
  position: relative;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.nav-menu {
  display: flex;
  gap: 1rem;
  list-style: none;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: background 0.2s;
}

.nav-link:hover {
  background: var(--background);
}

.nav-link.active {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
}

/* Responsive navigation */
@media (max-width: 1024px) {
  .nav-menu {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .nav-link {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
  }
}

/* Hamburger menu button - only visible on mobile */
.nav-hamburger {
  display: none;
}

@media (max-width: 768px) {
  .nav {
    padding: 0.75rem 0;
  }

  .nav-container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
  }

  .nav-hamburger {
    display: block;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text);
    z-index: 1001;
  }

  .nav-menu {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--surface);
    flex-direction: column;
    gap: 0;
    box-shadow: 0 4px 6px var(--shadow);
    padding: 0.5rem 0;
    z-index: 1000;
    margin: 0;
  }

  .nav-menu.active {
    display: flex !important;
  }

  .nav-menu li {
    margin: 0;
    width: 100%;
  }

  .nav-link {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    width: 100%;
    text-align: left;
    border-radius: 0;
  }

  .nav-link:hover {
    background: var(--background);
  }

  .nav-link.active {
    background: rgba(37, 99, 235, 0.1);
  }
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

.alert-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

/* Loading */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Badge */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  background: var(--secondary);
  color: white;
}

.badge-primary { background: var(--primary); }
.badge-success { background: var(--success); }
.badge-danger { background: var(--danger); }
.badge-warning { background: var(--warning); }
.badge-secondary { background: var(--secondary); }

/* Invite Code Display */
.invite-code {
  font-size: 1.2rem;
  padding: 0.5rem;
  background: var(--bg-secondary);
  border-radius: 4px;
}

/* Member List Item */
.member-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.modal-close:hover {
  background: var(--background);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
