/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f4f4f4;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Navbar */
nav {
  background-color: #2c3e50;
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav h1 {
  font-size: 1.8rem;
  color: #3498db;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 2rem;
  align-items: center;
}

.language-switcher {
    display: flex;
    list-style: none;
    gap: 1rem;
    align-items: center;
}

.language-switcher a {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 5px;
    transition: all 0.3s;
}

.language-switcher a:hover {
    border-color: #3498db;
}

.language-switcher .active a {
    background-color: #3498db;
    color: white;
}

nav a {
  color: white;
  text-decoration: none;
  transition: color 0.3s;
}

nav a:hover {
  color: #3498db;
}

nav .btn {
  background-color: #3498db;
  padding: 0.5rem 1rem;
  border-radius: 5px;
}

nav .btn:hover {
  background-color: #2980b9;
}

/* Main Content */
main {
  min-height: calc(100vh - 200px);
  padding: 2rem 0;
}

h2 {
  font-size: 2.5rem;
  margin: 2rem 0 1rem 0;
  color: #2c3e50;
  text-align: center;
}

.subtitle {
  text-align: center;
  color: #7f8c8d;
  margin-bottom: 2rem;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 8px;
  margin-bottom: 3rem;
}

.hero h2 {
  color: white;
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

/* Stats Grid */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: white;
  padding: 2rem;
  text-align: center;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-card h3 {
  color: #3498db;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

/* Grid Layout */
.universities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.card h3 {
  color: #2c3e50;
  margin-bottom: 0.5rem;
}

.card-header {
  background: #3498db;
  color: white;
  padding: 1rem;
  border-radius: 8px 8px 0 0;
  margin: -1.5rem -1.5rem 1rem -1.5rem;
}

.rank-badge {
  display: inline-block;
  background: #e74c3c;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #2c3e50;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #bdc3c7;
  border-radius: 5px;
  font-size: 1rem;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: background-color 0.3s;
  text-decoration: none;
  display: inline-block;
  margin-right: 0.5rem;
}

.btn-primary {
  background-color: #3498db;
  color: white;
}

.btn-primary:hover {
  background-color: #2980b9;
}

.btn-success {
  background-color: #27ae60;
  color: white;
}

.btn-success:hover {
  background-color: #229954;
}

.btn-danger {
  background-color: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background-color: #c0392b;
}

.btn-secondary {
  background-color: #95a5a6;
  color: white;
}

.btn-secondary:hover {
  background-color: #7f8c8d;
}

.btn-info {
  background-color: #16a085;
  color: white;
}

.btn-info:hover {
  background-color: #138d75;
}

.btn-block {
  width: 100%;
}

/* Search Form */
.search-form {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 2rem;
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  margin-bottom: 2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

table thead {
  background-color: #2c3e50;
  color: white;
}

table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
}

table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #ecf0f1;
}

table tbody tr:hover {
  background-color: #f8f9fa;
}

/* University Details */
.university-details {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Ensure detail view inherits the same font as the rest of the site */
.university-details,
.university-details * {
  font-family: inherit;
}

.university-header {
  border-bottom: 3px solid #3498db;
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

.university-header h2 {
  text-align: left;
}

.university-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.info-block {
  background: #ecf0f1;
  padding: 1rem;
  border-radius: 5px;
}

.info-block strong {
  color: #2c3e50;
  display: block;
  margin-bottom: 0.5rem;
}

/* Alerts */
.alert {
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-radius: 5px;
  border-left: 4px solid;
}

.alert-success {
  background-color: #d4edda;
  border-color: #28a745;
  color: #155724;
}

.alert-danger {
  background-color: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.alert-info {
  background-color: #d1ecf1;
  border-color: #bee5eb;
  color: #0c5460;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Footer */
footer {
  background-color: #2c3e50;
  color: white;
  text-align: center;
  padding: 2rem;
  margin-top: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
  nav .container {
    flex-direction: column;
    gap: 1rem;
  }

  nav ul {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .universities-grid {
    grid-template-columns: 1fr;
  }

  .search-grid {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 0.9rem;
  }

  table th, table td {
    padding: 0.5rem;
  }

  .hero {
    padding: 2rem;
  }

  .hero h2 {
    font-size: 1.8rem;
  }
}

/* Hidden by default */
.hidden {
  display: none;
}
