/* Reset e Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Palette colori GeoSciencesIR */
    --primary-color: #DACA8E;
    --secondary-color: #5D7A65;
    --accent-color: #DACA8E;
    --text-dark: #000000;
    --text-light: #000000;
    --title-color: #5D7A65;
    --bg-light: #ffffff;
    --bg-white: #ffffff;
    --border-color: #dddddd;
    --hover-color: #c4b77d;
    --success-color: #28a745;
    --error-color: #dc3545;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.logo-container {
    flex-shrink: 0;
}

.logo {
    height: 60px;
    width: auto;
}

.header-title h1 {
    font-size: 2rem;
    font-weight: 600;
    color: #000000;
    font-family: sans-serif;
}

.citation {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.citation-lg {
    flex-shrink: 0;
}

.citation-lg img {
    height: 50px;
    width: auto;
    transition: transform 0.3s ease;
}

.citation-lg img:hover {
    transform: scale(1.05);
}

/* Navigation Menu */
.main-nav {
    background-color: var(--secondary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    gap: 0;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 1rem 1.5rem;
    display: inline-block;
    transition: background-color 0.3s ease;
    font-weight: 500;
    font-size: 0.95rem;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-link:first-child {
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-link:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

.nav-link.active {
    background-color: rgba(0, 0, 0, 0.3);
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.page-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-family: sans-serif;
}

.page-description {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* Controls */
.controls {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-container {
    flex: 1;
    min-width: 250px;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-container label {
    font-weight: 500;
    color: var(--text-dark);
}

.sort-select {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.sort-select:focus {
    outline: none;
    border-color: var(--secondary-color);
}

/* API Count */
.api-count {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-white);
    border-left: 4px solid var(--secondary-color);
    border-radius: 4px;
}

.api-count p {
    font-size: 1.1rem;
    color: var(--text-dark);
    font-weight: 500;
}

#apiCount {
    color: var(--secondary-color);
    font-weight: 600;
}

/* Loading and Error */
.loading {
    text-align: center;
    padding: 3rem;
    font-size: 1.2rem;
    color: var(--text-light);
}

.progress-container {
    width: 100%;
    max-width: 500px;
    height: 30px;
    background-color: #e0e0e0;
    border-radius: 15px;
    margin: 1.5rem auto;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
    border-radius: 15px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    margin-top: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.error-message {
    padding: 1rem;
    background-color: #f8d7da;
    border: 1px solid var(--error-color);
    color: var(--error-color);
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* API List */
.api-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* API Card */
.api-card {
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.api-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 61, 122, 0.15);
}

.api-card h3 {
    font-size: 1.3rem;
    color: var(--title-color);
    margin-bottom: 0.75rem;
    font-weight: 300;
    font-family: sans-serif;
}

.api-format {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--accent-color);
    color: rgb(0, 0, 0);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.api-description {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    flex-grow: 1;
    line-height: 1.5;
}

.read-more-link {
    display: inline-block;
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.read-more-link:hover {
    color: var(--hover-color);
    text-decoration: underline;
}

.api-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--secondary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    text-align: center;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border: none;
    cursor: pointer;
}

.api-button:hover {
    background-color: var(--hover-color);
    transform: scale(1.02);
}

.api-button:active {
    transform: scale(0.98);
}

/* Footer */
.main-footer {
    background-color: var(--primary-color);
    color: #000000;
    padding: 2rem 0 1rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.footer-section p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.footer-section a {
    color: #000000;
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

.footer-section a:hover {
    color: #000000;
    text-decoration: underline;
}

.footer-logos {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.footer-logo {
    height: 50px;
    width: auto;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.footer-logo:hover {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .citation {
        justify-content: center;
    }

    .citation-lg img {
        height: 40px;
    }

    .page-title {
        font-size: 2rem;
    }

    .controls {
        flex-direction: column;
        gap: 1rem;
    }

    .sort-container {
        width: 100%;
        justify-content: space-between;
    }

    .api-list {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-logos {
        gap: 1rem;
    }

    .footer-logo {
        height: 40px;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.empty-state p {
    font-size: 1.2rem;
}