body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: #222;
  color: #fff;
  font-family: sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
}
.login-container {
  margin: 0 auto;
  min-height: 400px; /* Ensure enough space for error messages */
}
.language-selector {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 50;
}
.lang-dropdown {
  background: #333;
  color: #ccc;
  border: 1px solid #666;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border 0.3s;
}
.lang-dropdown:hover,
.lang-dropdown:focus {
  border-color: #e53e3e;
  outline: none;
  box-shadow: 0 0 0 2px #e53e3e33;
}
.card {
  background: #222;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 16px #0008;
  border: 1px solid #444;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
h2 {
  color: #e53e3e;
  margin-bottom: 12px;
  font-size: 2rem;
}
.subtitle {
  color: #aaa;
  margin-bottom: 16px;
  font-size: 1rem;
}
.logo {
  max-width: 100px;
  max-height: 100px;
  margin-bottom: 16px;
  background: #eee;
  padding: 16px;
  border-radius: 50%;
  object-fit: contain;
}
label {
  display: block;
  text-align: left;
  color: #ccc;
  margin-bottom: 4px;
  font-weight: 500;
  font-size: 0.95rem;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
select {
  width: 100%;
  padding: 8px;
  border: 1px solid #666;
  border-radius: 6px;
  font-size: 0.95rem;
  color: #ccc;
  background: #333;
  transition: border 0.3s, background 0.3s, box-shadow 0.3s;
}
input:focus, select:focus {
  outline: none;
  border-color: #e53e3e;
  background: #222;
  box-shadow: 0 0 0 2px #e53e3e33;
}
input[type="submit"] {
  width: 100%;
  padding: 8px;
  margin-top: 16px;
  background: #e53e3e;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}
input[type="submit"]:hover {
  background: #c53030;
}
input[type="submit"]:active {
  background: #9b2c2c;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.form-row.phone-row {
  grid-template-columns: 0.7fr 1.3fr;
}
.form-group {
  margin-bottom: 12px;
  text-align: left;
}
.checkbox-group {
  margin: 16px 0;
  text-align: left;
}
.checkbox-item {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
input[type="checkbox"] {
  margin-right: 8px;
  width: 16px;
  height: 16px;
}
.checkbox-label {
  cursor: pointer;
  font-size: 0.95rem;
  color: #ccc;
}
.form-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 16px;
}
.btn-cancel {
  background: #666;
  color: #ccc;
  padding: 12px;
  border-radius: 6px;
  text-align: center;
  display: inline-block;
  transition: background 0.3s;
}
.btn-cancel:hover {
  background: #444;
}


/* Links */
.register-link, .login-link {
  margin-top: 12px;
  font-size: 0.95rem;
  text-align: center;
  color: #aaa;
}
.register-link a, .login-link a {
  color: #e53e3e;
  font-weight: 600;
  text-decoration: none;
}
.register-link a:hover, .login-link a:hover {
  text-decoration: underline;
}

/* Messages */
.error, .alert.error {
  color: #e53e3e;
  background: #2a2a2a;
  border-left: 4px solid #e53e3e;
  padding: 8px;
  border-radius: 6px;
  margin: 8px 0 16px 0;
  font-size: 0.95rem;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}
.success {
  background: #22543d;
  color: #d3f9df;
  border-left: 4px solid #38a169;
  padding: 12px;
  border-radius: 6px;
  margin: 8px 0;
  font-size: 0.95rem;
  text-align: center;
}

/* Responsive styles */
@media (max-width: 520px) {
  body {
    padding: 8px;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 80px;
  }
  .language-selector {
    top: 8px;
    right: 8px;
  }
  .lang-dropdown {
    padding: 4px 8px;
    font-size: 0.85rem;
  }
  .card {
    padding: 16px;
    border-radius: 10px;
  }
  .login-container, .register-container {
    max-width: 100%;
    width: 100%;
  }
  h2 {
    font-size: 1.25rem;
    margin-bottom: 16px;
  }
  .logo {
    max-width: 80px;
    max-height: 80px;
    padding: 12px;
    margin-bottom: 16px;
  }
  label {
    font-size: 0.9rem;
    margin-bottom: 4px;
  }
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  select {
    padding: 12px;
    font-size: 1rem;
  }
  input[type="submit"] {
    padding: 12px;
    font-size: 1rem;
    margin-top: 20px;
  }
  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .form-group {
    margin-bottom: 16px;
  }
  .checkbox-group {
    margin: 20px 0;
  }
  .checkbox-item {
    margin-bottom: 12px;
  }
  .checkbox-label {
    font-size: 0.9rem;
    padding-left: 8px;
  }
  .register-link, .login-link {
    margin-top: 16px;
    font-size: 0.95rem;
    line-height: 1.6;
  }
  .error, .alert.error,
  .success {
    padding: 16px;
    margin: 12px 0;
    font-size: 0.95rem;
  }
}

/* Phone Country Selector Custom Dropdown */
.phone-country-selector {
  position: relative;
}

.phone-country-display {
  display: flex;
  align-items: center;
  padding: 10px;
  background: #1a1a1a;
  border: 1px solid #404040;
  border-radius: 4px;
  color: #e0e0e0;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  box-sizing: border-box;
  line-height: 1.4;
}

.phone-country-display:hover {
  background: #252525;
  border-color: #505050;
}

.phone-country-display.open {
  border-color: #cb1533;
  background: #252525;
}

.phone-country-display .flag-icon {
  width: 20px;
  height: 15px;
  flex-shrink: 0;
}

.phone-country-display .country-code {
  margin-left: auto;
  font-weight: 600;
  color: #e0e0e0;
}

.phone-country-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  width: calc((100% + 10px) * (2.0 / 0.7) - 25px);
  max-height: 300px;
  overflow-y: auto;
  background: #1a1a1a;
  border: 1px solid #404040;
  border-radius: 4px;
  margin-top: 4px;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.phone-country-dropdown.open {
  display: block;
}

.phone-country-option {
  display: flex;
  align-items: center;
  padding: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.phone-country-option:hover {
  background: #252525;
}

.phone-country-option .flag-icon {
  width: 20px;
  height: 15px;
  flex-shrink: 0;
}

.phone-country-option .country-name {
  flex: 1;
  margin-left: 8px;
  color: #e0e0e0;
}

.phone-country-option .country-code {
  margin-left: auto;
  color: #808080;
  font-weight: 500;
  font-size: 13px;
}

.phone-country-search {
  position: sticky;
  top: 0;
  background: #1a1a1a;
  padding: 8px;
  border-bottom: 1px solid #404040;
}

.phone-country-search input {
  width: 100%;
  padding: 8px;
  background: #252525;
  border: 1px solid #404040;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 13px;
}

.phone-country-search input:focus {
  outline: none;
  border-color: #cb1533;
}

/* Ensure consistent stroke width for all SVG icons */
.nav-icon {
    stroke-width: 2;
}

.nav-item.active .nav-icon {
    stroke-width: 2;
}

/* Styles for Stats and Tournaments */
.nav-item.active {
    background-color: #2a2a2a;
    border-left: 3px solid #cb1533;
}

.nav-item.active .nav-icon {
    stroke: #cb1533;
}

.nav-item:hover {
    background-color: #333333;
}

/* Adjust profile page layout */
.profile-form-container {
    max-width: 100%;
    margin: 0 auto;
}