* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

:root {
  --primary-color: #265278;
  --primary-dark: #1f374c;
  --primary-light: #4a7ca5;
  --accent-color: #ff6b6b;
  --border-radius: 10px;
}

/* Light theme variables - более яркий фон */
.light-theme {
  --bg-main: linear-gradient(135deg, #f0f5ff 0%, #e6f0ff 100%);
  --card-bg: rgba(255, 255, 255, 0.98);
  --text-main: #1a1a2e;
  --text-secondary: #4a4a6e;
  --text-gray: #7a7a9d;
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --border-color: rgba(0, 0, 0, 0.08);
  --stat-bg: rgba(255, 255, 255, 0.8);
  --glass-effect: rgba(255, 255, 255, 0.92);
  --hover-effect: rgba(38, 82, 120, 0.1);
}

.dark-theme {
  --bg-main: linear-gradient(135deg, #0f1720 0%, #1d2b3d 100%);
  --card-bg: rgba(36, 45, 58, 0.97);
  --text-main: #f0f6ff; /* More memorable text */
  --text-secondary: #d0d8e0; /* Improved contrast */
  --text-gray: #9aa5b5;
  --border-color: rgba(240, 246, 252, 0.15); /* More visible boundaries */
}

body {
  background: var(--bg-main);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 30px 15px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  background-size: cover;
  background-attachment: fixed;
}

.container {
  width: 100%;
  max-width: 800px;
}

/* Modified header */
header {
  text-align: center;
  margin-bottom: 30px;
  position: relative;
}

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

.header-content {
  position: relative;
  z-index: 1;
}

h1 {
  font-size: 2.2rem;
  margin-bottom: 5px;
  color: var(--primary-color);
  position: relative;
  display: inline-block;
}

h1::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  border-radius: 2px;
  display: none;
}

.subtitle {
  color: var(--text-gray);
  font-size: 1.1rem;
  margin-top: 8px;
  display: block;
  font-weight: 400;
  text-align: center;
  width: 100%;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.
}

.theme-toggle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  padding: 0;
  box-sizing: border-box; 
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  transform: none !important;
  transition: box-shadow 0.3s ease;
  
  min-width: auto !important;
  min-height: auto !important;
  flex-shrink: 0;
}

.theme-toggle * {
  box-sizing: inherit;
}

.theme-toggle i {
  font-size: 1.3rem;
  transform: none !important;
  transition: color 0.3s ease;
  display: block;
  text-align: center;
  width: 100%;
}

.search-container {
  display: flex;
  margin-bottom: 30px;
  gap: 10px;
  position: relative;
}

input[type="text"] {
  flex: 1;
  padding: 14px 18px;
  font-size: 1.05rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  background-color: var(--glass-effect);
  color: var(--text-main);
  outline: none;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

input[type="text"]:focus {
  box-shadow: 0 0 0 3px rgba(38, 82, 120, 0.3);
  border-color: var(--primary-light);
}

button {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: var(--border-radius);
  padding: 0 24px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  min-width: 100px;
  box-shadow: var(--shadow-md);
}

button:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

#profile-container {
  background-color: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 25px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 25px;
  margin-bottom: 25px;
}

#avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-color);
}

.profile-info {
  flex: 1;
}

#name {
  font-size: 1.5rem;
  margin-bottom: 5px;
  color: var(--text-main);
}

#username {
  color: var(--primary-color);
  margin-bottom: 10px;
  font-weight: 600;
}

#bio {
  color: var(--text-gray);
  margin-bottom: 15px;
  line-height: 1.5;
}

.location-date {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 15px;
  color: var(--text-gray);
  font-size: 0.9rem;
}

.location-date i {
  color: var(--primary-color);
  margin-right: 5px;
}

.btn {
  display: inline-block;
  padding: 8px 16px;
  background-color: var(--primary-color);
  color: #fff;
  text-decoration: none;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background-color 0.3s, transform 0.2s;
}

.btn:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
}

/* Stats */
.stats {
  display: flex;
  gap: 15px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.stat {
  background-color: var(--stat-bg);
  border-radius: var(--border-radius);
  padding: 12px;
  text-align: center;
  flex: 1;
  min-width: 120px;
  transition: transform 0.2s;
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  box-shadow: 0 0 0 1px var(--border-color) inset;
}

.stat:hover {
  transform: translateY(-3px);
}

.stat i {
  color: var(--primary-color);
  margin-right: 5px;
}

#error-container {
  background-color: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  padding: 15px;
  border-radius: var(--border-radius);
  text-align: center;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.hidden {
  display: none;
}

.additional-info {
  margin-top: 25px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-gray);
  font-size: 0.9rem;
  background: var(--glass-effect);
  padding: 10px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  box-shadow: 0 0 0 1px var(--border-color) inset;
}

.info-item i {
  color: var(--primary-color);
  width: 20px;
  text-align: center;
}

.info-item a {
  color: var(--text-secondary);
  text-decoration: none;
  word-break: break-all;
}

.info-item a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

/* GitHub Analytics */
.analytics-section {
  margin-top: 30px;
  padding: 25px;
  border-radius: var(--border-radius);
  background: var(--glass-effect);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.analytics-section h3 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  color: var(--text-main);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.analytics-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
}

.analytic {
  background: var(--glass-effect);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 0 1px var(--border-color) inset;
}

.analytic:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 10px rgba(0,0,0,0.1);
  background: var(--hover-effect);
}

.analytic i {
  font-size: 1.8rem;
  color: var(--primary-color);
}

.analytic-info h4 {
  font-size: 1.5rem;
  margin-bottom: 5px;
  color: var(--primary-light);
}

.analytic-info p {
  color: var(--text-gray);
  font-size: 0.9rem;
}

.repos-section {
  margin-top: 30px;
  padding: 25px;
  border-radius: var(--border-radius);
  background: var(--glass-effect);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.repos-section h3 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  color: var(--text-main);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.repos-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
}

.repo-card {
  background-color: var(--glass-effect);
  border-radius: var(--border-radius);
  padding: 15px;
  border: 1px solid var(--border-color);
  transition: transform 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 0 1px var(--border-color) inset;
}

.repo-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
  background: var(--hover-effect);
}

.repo-name {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--primary-light);
  text-decoration: none;
  display: block;
  font-size: 1.1rem;
}

.repo-name:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.repo-description {
  color: var(--text-gray);
  font-size: 0.9rem;
  margin-bottom: 12px;
  overflow: hidden;
  min-height: 35px;
  line-height: 1.4;
}

.repo-meta {
  display: flex;
  gap: 15px;
  font-size: 0.85rem;
  color: var(--text-gray);
  flex-wrap: wrap;
}

.repo-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.repo-meta-item i {
  color: var(--primary-color);
}

.loading-repos {
  color: var(--text-gray);
  text-align: center;
  padding: 20px;
  grid-column: 1 / -1;
}

.no-repos {
  color: var(--text-gray);
  text-align: center;
  padding: 30px;
  grid-column: 1 / -1;
  border: 1px dashed var(--border-color);
  border-radius: var(--border-radius);
}

/* Responsive design for mobile devices */
@media (max-width: 768px) {
  body {
    padding: 20px 12px;
  }
  
  .header-top {
    flex-direction: row;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
  }
  
  .theme-toggle {
    width: 40px;
    height: 40px;
    align-self: center;
  }

  h1 {
    font-size: 1.8rem;
    margin-bottom: 3px;
  }
  
  .subtitle {
    font-size: 1rem;
    padding: 0 15px;
  }

  .search-container {
    flex-direction: column;
    margin-bottom: 25px;
  }
  
  input[type="text"] {
    padding: 14px;
    width: 100%;
    font-size: 1rem;
  }
  
  button {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
  }

  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
    margin-bottom: 20px;
  }

  #avatar {
    width: 100px;
    height: 100px;
  }

  .location-date {
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
  }

  .stats {
    flex-direction: column;
    gap: 12px;
  }
  
  .stat {
    min-width: 100%;
    padding: 15px;
  }
  
  .additional-info {
    grid-template-columns: 1fr;
    gap: 12px;
    padding-top: 15px;
  }
  
  .repos-section, 
  .analytics-section {
    padding: 20px 15px;
    margin-top: 20px;
  }
  
  .analytics-container {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .repos-container {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .analytic {
    padding: 15px 12px;
  }
  
  .repo-card {
    padding: 18px 15px;
  }
  
  .repo-name {
    font-size: 1.05rem;
  }
}

@media (max-width: 480px) {
  .header-top {
    flex-wrap: wrap;
    position: relative; /* To position the button */
    padding-right: 50px; /* Place for button */
  }
  
  .header-content {
    text-align: left; /* Move the text to the left */
    width: 100%;
  }
  
  h1 {
    font-size: 1.7rem;
    padding-right: 40px; /* Protect from overlapping the button */
  }
  
  .subtitle {
    font-size: 0.9rem;
    padding: 0;
    text-align: left; /* Protect from overlapping the button */
    line-height: 1.4;
  }
  
  .theme-toggle {
    width: 40px;
    height: 40px;
    position: absolute; /* Absolute positioning */
    top: 0;
    right: 0;
  }

  .profile-info {
    width: 100%;
  }
  
  .analytic {
    flex-direction: row;
    text-align: left;
    gap: 15px;
  }
  
  .analytic i {
    font-size: 1.6rem;
    margin-bottom: 0;
  }
  
  .location-date {
    flex-direction: column;
    gap: 8px;
  }
  
  .repo-meta {
    gap: 10px;
    justify-content: flex-start; 
  }
  
  .repo-meta-item {
    font-size: 0.8rem;
  }
  
  #error-container {
    padding: 12px;
    font-size: 0.9rem;
  }
}

@media (max-width: 420px) {
  .header-top {
    flex-direction: row !important; 
    align-items: flex-start !important; 
    gap: 0 !important;
  }
  
  h1 {
    font-size: 1.6rem !important; 
  }
  
  .subtitle {
    font-size: 0.88rem !important;
  }
  
  .theme-toggle {
    top: 5px; 
  }
}