:root {
    --bg-color: #f5f5f5;
    --text-color: #333;
    --card-bg: #fff;
    --card-shadow: 0 2px 5px rgba(0,0,0,0.1);
    --primary-color: #4a6fa5;
    --secondary-color: #6b8cae;
    --border-color: #ddd;
}

.dark-theme {
    --bg-color: #1a1a1a;
    --text-color: #f0f0f0;
    --card-bg: #2a2a2a;
    --card-shadow: 0 2px 5px rgba(0,0,0,0.3);
    --primary-color: #9dcbf4;
    --secondary-color: #7d9dff;
    --border-color: #444;
}

.slogan {
  text-align: center;
  position: relative;
  padding: .5em 0;
  animation: sioFadeUp 1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes sioFadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.slogan::before,
.slogan::after {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg, transparent, #e63946, transparent);
  margin: 0 auto;
  width: 0;
}
.slogan::before { margin-top: 1.5rem;  margin-bottom: .5rem; animation: sioLine 0.8s 0.2s ease forwards; }
.slogan::after  { margin-top: 1.5rem;  margin-bottom: 1.5rem;   animation: sioLine 0.8s 0.7s ease forwards; }

@keyframes sioLine { to { width: 100px; } }

.slogan b i {
  font-size: 1.6rem;
  line-height: 1.9;
  font-style: italic;
  display: inline-block;
  animation: sioFadeUp 0.8s 0.3s both;
}

.slogan a {
  text-decoration: none;
  display: inline-block;
  vertical-align: baseline;
}

.slogan button {
  font-size: 1rem;
  padding: 0.5em 1.2em;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: color 0.35s, transform 0.25s;
  animation: sioGlow 3s 1.2s ease-in-out infinite;
  z-index: 1;
}

@keyframes sioGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(230,57,70,0.3); }
  50%      { box-shadow: 0 0 18px 3px rgba(230,57,70,0.3); }
}

.slogan button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #e63946;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: -1;
  border-radius: 7px;
}

.slogan button:hover  { color: #fff; transform: translateY(-2px); }
.slogan button:hover::before { transform: scaleX(1); }
.slogan button:active { transform: scale(0.97); }

.slogan .second-line {
  display: inline-block;
  opacity: 0.6;
  animation: sioFadeUp 0.8s 0.8s both;
}

.word-tag {
  font-size:13px;
}
h2{
    font-size:15px;
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
}

header {
    text-align: center;
    margin-bottom: 0px;
    padding-bottom: 0px;
}

header h1 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

#search {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-width: 250px;
    background-color: var(--card-bg);
    color: var(--text-color);
}

button {
    padding: 5px 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: var(--secondary-color);
}

.filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--primary-color);
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
}

#results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 10px;
}

.card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 15px;
    box-shadow: var(--card-shadow);
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: scale(1.10); /* Aumenta la scala al 105% */
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}


.card img {
    width: 77px;
    height: 180px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
    background-color: var(--border-color);
    float: left;
    margin-right: 17px;
	border-radius:10px; 

	}

.card h3 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    color: var(--primary-color);
}

.card .school {
    font-size: 0.9em;
    color: var(--secondary-color);
    margin: 5px 0;
}

.card .rank {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8em;
    margin-bottom: 5px;
}

.card .motivation {
    font-size: 0.85em;
    color: var(--text-color);
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card .author {
    font-size: 0.8em;
    color: var(--text-color);
    margin-top: 5px;
    font-style: italic;
}

.opml{
	padding: 5px 10px;
	background-color:orange;
	color:white;
	border-radius:20px;
}

.favorite-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: none;
    border: none;
    font-size: 1.3em;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.7;
    transition: opacity 0.2s;
}

.favorite-btn:hover {
    opacity: 1;
}

.favorite-btn.active {
    color: gold;
    opacity: 1;
}

.card .links {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.hidden{
	display:none;
}

.card .links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.8em;
    padding: 3px 6px;
    background-color: rgba(74, 111, 165, 0.1);
    border-radius: 3px;
    transition: background-color 0.2s;
}

.card .links a:hover {
    background-color: rgba(74, 111, 165, 0.3);
}

@media (max-width: 768px) {
    #results {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 480px) {
    #results {
        grid-template-columns: 1fr;
    }
    .controls, .filters {
        xxxxflex-direction: column;
        align-items: center;
    }
    #search {
        width: 50%;
       min-width: 100px;
        margin:2px;
    }
}


/* Popup */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.popup {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideUp 0.3s ease-out;
}

.popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5em;
    color: var(--text-color);
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.popup-close:hover {
    color: var(--primary-color);
}

.popup-content {
    padding-right: 20px; /* Spazio per il pulsante di chiusura */
}

.popup-cover {
    width: 250px;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    margin: 15px 0;
    background-color: var(--border-color);
}

.popup-school, .popup-author {
    color: var(--secondary-color);
    font-size: 0.95em;
    margin: 5px 0;
}

.popup-motivation {
    margin: 15px 0;
    line-height: 1.6;
}

.popup-motivation strong {
    display: block;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.popup-links {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.popup-link {
    display: inline-block;
    padding: 8px 12px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.popup-link:hover {
    background-color: var(--secondary-color);
}

/* Animazioni */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stile per la motivazione cliccabile */
.motivation.clickable {
    cursor: pointer;
    color: var(--primary-color);
    transition: color 0.2s;
}

.motivation.clickable:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Responsive per popup */
@media (max-width: 600px) {
    .popup {
        width: 95%;
        padding: 15px;
    }

    .popup-cover {
        width: 100%;
        max-width: 100%;
    }
}



