* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  color: #333;
  width: 100%;
  overflow-x: hidden;
}

.container {
  flex: 1;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Special styling for login page container */
body:not(.dashboard) .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
}

h1 {
  text-align: center;
  color: white;
  margin-bottom: 10px;
  font-size: 2.5rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

h2 {
  color: white;
  margin-bottom: 20px;
  font-size: 1.8rem;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.login-btn {
  background-color: #7289da;
  color: white;
  padding: 15px 30px;
  text-decoration: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(114, 137, 218, 0.3);
}

.login-btn:hover {
  background-color: #5b6fd8;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(114, 137, 218, 0.4);
}

header {
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: flex-end;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.profile-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: transform 0.3s ease;
}

.profile-avatar:hover {
  transform: scale(1.1);
}

.user-details {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.username {
  font-weight: bold;
  font-size: 1.1rem;
}

.user-id {
  font-size: 0.9rem;
  opacity: 0.8;
}

.logout-btn {
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 5px;
  transition: all 0.3s ease;
}

.logout-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.welcome-section {
  text-align: center;
  margin-bottom: 40px;
}

.welcome-section p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.2rem;
  margin: 0;
}

.profile-section {
  margin-bottom: 40px;
}

.profile-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 30px;
  display: flex;
  align-items: center;
  gap: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.large-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.3);
  transition: transform 0.3s ease;
}

.large-avatar:hover {
  transform: scale(1.05);
}

.profile-info h3 {
  color: white;
  margin: 0 0 10px 0;
  font-size: 2rem;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.profile-info p {
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
  font-size: 1.1rem;
}

.dashboard-content {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.dashboard-content p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1rem;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .login-btn {
    width: 100%;
    text-align: center;
    padding: 12px 20px;
  }
  
  .user-info {
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
  }
  
  .profile-avatar {
    width: 35px;
    height: 35px;
  }
  
  .profile-card {
    flex-direction: column;
    text-align: center;
    gap: 20px;
    padding: 20px;
  }
  
  .large-avatar {
    width: 100px;
    height: 100px;
  }
  
  .profile-info h3 {
    font-size: 1.5rem;
  }
}

/* Server Management Styles */
.servers-section, .invite-section {
  margin-bottom: 30px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header h3 {
  color: white;
  margin: 0;
  font-size: 1.5rem;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background-color: #7289da;
  color: white;
  box-shadow: 0 4px 15px rgba(114, 137, 218, 0.3);
}

.btn-primary:hover {
  background-color: #5b6fd8;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(114, 137, 218, 0.4);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.btn-success {
  background-color: #43b581;
  color: white;
  box-shadow: 0 4px 15px rgba(67, 181, 129, 0.3);
}

.btn-success:hover {
  background-color: #3aa374;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(67, 181, 129, 0.4);
}

.btn-danger {
  background-color: #dc3545;
  color: white;
  box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.btn-danger:hover {
  background-color: #c82333;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.servers-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.server-cards-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.server-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.server-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.server-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.server-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.server-info {
  flex: 1;
  min-width: 0;
}

.server-info h4 {
  color: white;
  margin: 0 0 4px 0;
  font-size: 1.1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-info p {
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
  font-size: 0.85rem;
}

.server-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-configured {
  background-color: rgba(67, 181, 129, 0.9);
  color: white;
  border: 2px solid #43b581;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
  box-shadow: 0 2px 4px rgba(67, 181, 129, 0.3);
}

.status-not-configured {
  background-color: rgba(255, 193, 7, 0.9);
  color: #333;
  border: 2px solid #ffc107;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(255,255,255,0.3);
  box-shadow: 0 2px 4px rgba(255, 193, 7, 0.3);
}

.server-actions {
  display: flex;
  justify-content: center;
  margin-top: 16px;
  flex-shrink: 0;
}

.server-actions .btn {
  padding: 8px 6px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  text-align: center;
  transition: all 0.2s ease;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Special handling for single button (configure) */
.server-actions .btn:only-child {
  grid-column: 1 / -1;
}

/* Special handling for three buttons (generate, stats, remove) */
.server-actions .btn:nth-child(3) {
  grid-column: 1 / -1;
}

/* Invite URL display within server cards */
.invite-url-display {
  margin: 12px 0;
  flex-shrink: 0;
}

.invite-url-display label {
  display: block;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.invite-url-container {
  display: flex;
  gap: 8px;
  align-items: center;
}

.invite-url-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 8px 10px;
  color: #43b581;
  font-family: monospace;
  font-size: 0.75rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.invite-url-input:focus {
  border-color: #43b581;
}

.invite-url-input:read-only {
  cursor: default;
}

.btn-copy {
  background: #43b581;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-copy:hover {
  background: #3a9d6f;
  transform: translateY(-1px);
}

.invite-links {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
}

.invite-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
}

.invite-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.invite-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.invite-info {
  flex: 1;
  min-width: 0;
}

.invite-info h4 {
  color: white;
  margin: 0 0 4px 0;
  font-size: 1.1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invite-info p {
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
  font-size: 0.85rem;
}

.invite-url {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 10px;
  margin: 12px 0;
  word-break: break-all;
  font-family: monospace;
  color: #43b581;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.invite-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex-shrink: 0;
}

.invite-actions .btn {
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  text-align: center;
  transition: all 0.2s ease;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading {
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-style: italic;
  padding: 40px;
}

.error {
  background: rgba(220, 53, 69, 0.2);
  border: 1px solid rgba(220, 53, 69, 0.3);
  border-radius: 8px;
  padding: 15px;
  color: #dc3545;
  margin: 20px 0;
}

.success {
  background: rgba(67, 181, 129, 0.9);
  border: 2px solid #43b581;
  border-radius: 8px;
  padding: 15px;
  color: white;
  margin: 20px 0;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
  box-shadow: 0 2px 8px rgba(67, 181, 129, 0.3);
}

.server-addition-card {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 0 15px 0;
  backdrop-filter: blur(10px);
  max-width: 100%;
}

.add-server-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.add-server-header h4 {
  color: white;
  margin: 0;
  font-size: 1rem;
}

.discord-id {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
}

.server-input-section {
  display: flex;
  gap: 6px;
  margin: 6px 0;
  align-items: center;
}

.server-id-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 0.85rem;
  backdrop-filter: blur(5px);
}

.server-id-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.server-id-input:focus {
  outline: none;
  border-color: #7289da;
  box-shadow: 0 0 0 2px rgba(114, 137, 218, 0.3);
}

.help-text {
  margin-top: 4px;
  padding: 4px 6px;
  background: rgba(114, 137, 218, 0.1);
  border-radius: 4px;
  border-left: 2px solid #7289da;
}

.help-text p {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.75rem;
}

.help-text small {
  display: block;
  line-height: 1.3;
}

.server-stats {
  margin: 16px 0;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.stat-label {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  font-weight: 500;
}

.stat-value {
  color: white;
  font-size: 0.9rem;
  font-weight: bold;
  background: rgba(114, 137, 218, 0.2);
  padding: 4px 8px;
  border-radius: 4px;
  min-width: 60px;
  text-align: center;
}

@media (max-width: 768px) {
  .servers-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  .server-cards-grid {
    grid-template-columns: 1fr;
    justify-items: center;
    width: 100%;
    max-width: 100%;
  }
  
  .invite-links {
    grid-template-columns: 1fr;
  }
  
  .server-input-section {
    flex-direction: column;
    align-items: stretch;
  }
  
  .server-id-input {
    margin-bottom: 10px;
  }
  
  .stat-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .stat-value {
    align-self: flex-end;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .server-actions, .invite-actions {
    grid-template-columns: 1fr;
  }
  
  .server-actions .btn:nth-child(3),
  .invite-actions .btn:nth-child(3) {
    grid-column: 1;
  }
  
  .server-card, .invite-card {
    padding: 16px;
  }
  
  .btn {
    width: 100%;
  }
  
  /* Additional mobile optimizations */
  .container {
    padding: 10px;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .main-content {
    padding: 15px;
    box-sizing: border-box;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  .server-card {
    padding: 15px;
    margin: 0 auto;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
  }
  
  .server-header {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
  }
  
  .server-icon {
    width: 40px;
    height: 40px;
  }
  
  .server-info h4 {
    font-size: 1.1rem;
    text-align: center;
    margin: 0;
  }
  
  .server-info p {
    font-size: 0.9rem;
    text-align: center;
    margin: 0;
  }
  
  .invite-url-display {
    margin: 12px 0;
    text-align: center;
  }
  
  .invite-url-display label {
    text-align: center;
    display: block;
    margin-bottom: 8px;
  }
  
  .invite-url-container {
    flex-direction: column;
    gap: 8px;
  }
  
  .invite-url-input {
    font-size: 0.8rem;
    padding: 8px 10px;
  }
  
  .btn-copy {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.9rem;
  }
  
  .server-stats {
    padding: 12px;
    margin: 12px 0;
    text-align: center;
  }
  
  .stat-item {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
  }
  
  .stat-label {
    font-size: 0.8rem;
  }
  
  .stat-value {
    font-size: 0.9rem;
  }
  
  .server-addition-card {
    padding: 10px;
    margin: 0 0 15px 0;
    box-sizing: border-box;
    text-align: center;
  }
  
  .add-server-header {
    flex-direction: column;
    align-items: center;
    gap: 5px;
  }
  
  .add-server-header h4 {
    font-size: 1rem;
  }
  
  .discord-id {
    font-size: 0.8rem;
  }
  
  .server-input-section {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .server-id-input {
    margin-bottom: 0;
    padding: 10px 12px;
    font-size: 0.9rem;
  }
  
  .help-text {
    padding: 6px 8px;
    margin-top: 8px;
  }
  
  .help-text p {
    font-size: 0.75rem;
  }
}