/* === RESET Y BASE === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #f8f9fa;
  color: #2c3e50;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  padding: 20px;
  transition: background-color 0.3s, color 0.3s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.dark {
  background-color: #121212;
  color: #e0e0e0;
}

/* === HEADER === */
.header-container {
  text-align: center;
  margin: 30px 0;
  position: relative;
}

h1 {
  color: #2c3e50;
  font-size: 2.5rem;
  margin-bottom: 10px;
  display: inline-block;
  position: relative;
  padding-right: 50px;
}

body.dark h1 {
  color: #e0e0e0;
}

.subtitle {
  color: #666;
  font-size: 1rem;
  margin-bottom: 20px;
}

body.dark .subtitle {
  color: #999;
}

.theme-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: inherit;
  transition: transform 0.3s;
}

.theme-toggle:hover {
  transform: translateY(-50%) rotate(180deg);
}

.admin-link {
  position: absolute;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  text-decoration: none;
  transition: transform 0.3s;
}

.admin-link:hover {
  transform: translateY(-50%) scale(1.2);
}

/* === MAIN CONTENT === */
.main-content {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.controls-container {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
  padding: 0 30px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.search-bar {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
  padding: 10px 15px;
  border: 2px solid #e1e8ed;
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.3s;
  background: white;
  color: #333;
}

body.dark .search-bar {
  background: #2d2d2d;
  border-color: #444;
  color: #e0e0e0;
}

.search-bar:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.filter-buttons {
  display: flex;
  gap: 10px;
}

.filter-btn {
  padding: 8px 16px;
  border: 2px solid #e1e8ed;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 14px;
  color: #666;
}

body.dark .filter-btn {
  background: #2d2d2d;
  border-color: #444;
  color: #aaa;
}

.filter-btn.active {
  background: #3498db;
  color: white;
  border-color: #3498db;
}

.filter-btn:hover:not(.active) {
  border-color: #3498db;
  color: #3498db;
}

.project-counter {
  text-align: center;
  margin-bottom: 20px;
  font-size: 14px;
  color: #666;
}

body.dark .project-counter {
  color: #999;
}

/* === WEBSITE GRID === */
.website-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 25px;
  padding: 30px;
}

.website-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 20px;
  text-decoration: none;
  color: inherit;
  background: white;
  border: 2px solid #e1e8ed;
  border-radius: 16px;
  transition: all 0.3s ease;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease forwards;
}

body.dark .website-card {
  background: #1e1e1e;
  color: #fff;
  border-color: #333;
}

.website-card.hidden {
  display: none;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.website-card[data-category="tool"] {
  border-top: 4px solid #3498db;
}
.website-card[data-category="map"] {
  border-top: 4px solid #9b59b6;
}
.website-card[data-category="fun"] {
  border-top: 4px solid #e67e22;
}

.website-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  border-color: #3498db;
}

body:not(.dark) .website-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
  pointer-events: none;
  border-radius: 16px;
}

body:not(.dark) .website-card:hover::before {
  transform: translateX(100%);
}

.favicon {
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  border-radius: 12px;
  object-fit: cover;
  transition: all 0.3s ease;
}

.website-name {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.3;
  margin-bottom: 8px;
}

.website-description {
  font-size: 12px;
  color: #666;
  line-height: 1.4;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
}

body.dark .website-description {
  color: #bbb;
}

.website-card:hover .website-description {
  opacity: 1;
  max-height: 100px;
  margin-top: 8px;
}

.status {
  font-size: 10px;
  margin-top: 8px;
  color: #666;
  font-style: italic;
}

body.dark .status {
  color: #aaa;
}

/* === MODAL === */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  justify-content: center;
  align-items: center;
}

body:not(.dark) .modal {
  backdrop-filter: blur(5px);
}

.modal.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: white;
  padding: 40px;
  border-radius: 20px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  transform: scale(0.8);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

body.dark .modal-content {
  background: #2d2d2d;
  color: #e0e0e0;
  border: 1px solid #444;
}

.modal.active .modal-content {
  transform: scale(1);
}

.modal-icon {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  margin-bottom: 20px;
  object-fit: cover;
}

.modal-title {
  font-size: 24px;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 15px;
}

body.dark .modal-title {
  color: #e0e0e0;
}

.modal-description {
  font-size: 16px;
  color: #555;
  line-height: 1.6;
  margin-bottom: 30px;
}

body.dark .modal-description {
  color: #ccc;
}

.modal-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.modal-btn {
  padding: 12px 30px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-close {
  background: #e74c3c;
  color: white;
}

.btn-visit {
  background: #27ae60;
  color: white;
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* === FOOTER === */
.footer {
  margin-top: 60px;
  padding: 40px 20px 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-align: center;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
}

body.dark .footer {
  background: linear-gradient(135deg, #1e1e1e 0%, #2d2d2d 100%);
  border-top: 1px solid #444;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
}

.footer-name {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 15px;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 20px 0;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: white;
  text-decoration: none;
  transition: all 0.3s;
  backdrop-filter: blur(10px);
}

.social-link:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.social-link svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.footer-info {
  font-size: 14px;
  opacity: 0.9;
  line-height: 1.6;
}

.footer-year {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 13px;
  opacity: 0.8;
}

/* === SCROLL TOP === */
.scroll-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  z-index: 100;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* === VISIT COUNTER === */
.visit-counter-container {
  text-align: center;
  margin: 25px 0;
  opacity: 0.6;
  font-size: 0.85rem;
  color: #999;
  transition: opacity 0.3s;
}

.visit-counter-container:hover {
  opacity: 1;
}

body.dark .visit-counter-container {
  color: #777;
}

/* === NO RESULTS === */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: #666;
  display: none;
}

.no-results.show {
  display: block;
}

body.dark .no-results {
  color: #999;
}

.no-results svg {
  width: 100px;
  height: 100px;
  opacity: 0.3;
  margin-bottom: 20px;
}

/* === ADMIN STYLES === */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: white;
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  max-width: 400px;
  width: 100%;
  text-align: center;
}

body.dark .auth-card {
  background: #1e1e1e;
  border: 1px solid #333;
}

.auth-subtitle {
  color: #666;
  margin-bottom: 30px;
}

body.dark .auth-subtitle {
  color: #999;
}

.auth-form {
  text-align: left;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #2c3e50;
}

body.dark .form-group label {
  color: #e0e0e0;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid #e1e8ed;
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.3s;
  background: white;
  color: #333;
}

body.dark .form-group input,
body.dark .form-group select,
body.dark .form-group textarea {
  background: #2d2d2d;
  border-color: #444;
  color: #e0e0e0;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
  padding: 10px 20px;
  background: #95a5a6;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.3s;
}

.btn-icon:hover {
  transform: scale(1.2);
}

.error-message {
  color: #e74c3c;
  margin-top: 15px;
  font-size: 14px;
  min-height: 20px;
}

.back-link {
  display: inline-block;
  margin-top: 20px;
  color: #3498db;
  text-decoration: none;
  transition: color 0.3s;
}

.back-link:hover {
  color: #2980b9;
}

/* === ADMIN PANEL === */
.admin-panel {
  max-width: 1200px;
  margin: 0 auto;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e1e8ed;
}

body.dark .admin-header {
  border-bottom-color: #333;
}

.admin-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

.admin-section {
  background: white;
  padding: 30px;
  border-radius: 16px;
  margin-bottom: 30px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body.dark .admin-section {
  background: #1e1e1e;
  border: 1px solid #333;
}

.admin-section h2 {
  margin-bottom: 25px;
  color: #2c3e50;
}

body.dark .admin-section h2 {
  color: #e0e0e0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-actions {
  display: flex;
  gap: 15px;
  margin-top: 25px;
}

.form-actions .btn-primary {
  width: auto;
  padding: 12px 30px;
}

/* === PROJECTS LIST === */
.projects-list {
  display: grid;
  gap: 20px;
}

.project-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 2px solid #e1e8ed;
  transition: all 0.3s;
}

body.dark .project-item {
  background: #2d2d2d;
  border-color: #444;
}

.project-item:hover {
  border-color: #3498db;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.project-item-icon {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  object-fit: cover;
}

.project-item-info {
  flex: 1;
}

.project-item-name {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 5px;
  color: #2c3e50;
}

body.dark .project-item-name {
  color: #e0e0e0;
}

.project-item-category {
  display: inline-block;
  padding: 4px 12px;
  background: #3498db;
  color: white;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 8px;
}

.project-item-description {
  color: #666;
  font-size: 14px;
  line-height: 1.4;
}

body.dark .project-item-description {
  color: #aaa;
}

.project-item-actions {
  display: flex;
  gap: 10px;
}

.btn-edit,
.btn-delete {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-edit {
  background: #3498db;
  color: white;
}

.btn-edit:hover {
  background: #2980b9;
}

.btn-delete {
  background: #e74c3c;
  color: white;
}

.btn-delete:hover {
  background: #c0392b;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .website-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    padding: 15px;
  }

  .website-card {
    padding: 20px 15px;
  }

  .favicon {
    width: 50px;
    height: 50px;
  }

  .modal-content {
    padding: 30px 20px;
    margin: 20px;
  }

  .modal-buttons {
    flex-direction: column;
  }

  .controls-container {
    padding: 0 15px;
  }

  .filter-buttons {
    width: 100%;
    justify-content: center;
  }

  h1 {
    font-size: 2rem;
  }

  .footer {
    border-radius: 0;
    margin-top: 40px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .admin-header {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }

  .project-item {
    flex-direction: column;
    text-align: center;
  }

  .project-item-actions {
    width: 100%;
    justify-content: center;
  }
}

@media (hover: none) {
  .website-card:active {
    transform: scale(0.97);
  }
}
