.terms-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.terms-overlay.active {
    display: flex;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.terms-popup {
    position: relative;
    width: min(920px, 96vw);
    max-height: 88vh;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    animation: termsFadeIn 0.35s ease-out;
    background-color: #1e3c72;
}

.terms-popup-inner {
    max-height: 88vh;
    overflow-y: auto;
    padding: 28px 24px 24px;
    background-color: #1e3c72;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(255, 255, 255, 0.72) 100%),
        url('../img/odzadje-cenik.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.terms-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 5;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: #dc3545;
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.terms-close:hover {
    background: #b71c1c;
    transform: scale(1.06);
}

.terms-title {
    margin: 0 0 8px;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: #1e3c72;
    font-family: 'Montserrat', sans-serif;
}

.terms-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-right: 44px;
}

.terms-header-text {
    flex: 1;
    min-width: 0;
}

.terms-logo {
    flex-shrink: 0;
    height: 46px;
    width: auto;
    max-width: 170px;
    object-fit: contain;
    margin-top: 2px;
}

.terms-intro {
    margin: 0 0 16px;
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
}

.terms-body {
    color: #333;
    font-size: 0.95rem;
    line-height: 1.65;
}

.terms-body p {
    margin: 0 0 12px;
}

.terms-body h3,
.terms-body h4 {
    margin: 18px 0 8px;
    color: #1e3c72;
    font-family: 'Montserrat', sans-serif;
}

.terms-body ul,
.terms-body ol {
    margin: 0 0 12px 1.2em;
    padding: 0;
}

.terms-body li {
    margin-bottom: 6px;
}

.terms-body a {
    color: #1e3c72;
    text-decoration: underline;
}

.terms-changelog {
    margin: 20px 10px 0;
    padding-top: 14px;
    border-top: 1px solid rgba(30, 60, 114, 0.18);
}

.terms-changelog-title {
    margin: 0 0 10px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e3c72;
    font-family: 'Montserrat', sans-serif;
}

.terms-changelog-list {
    margin: 0;
    padding-left: 1.2em;
    color: #444;
    font-size: 0.88rem;
    line-height: 1.55;
}

.terms-changelog-list li {
    margin-bottom: 4px;
}

.terms-close-bottom {
    display: block;
    margin: 20px auto 0;
    padding: 10px 32px;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #fff;
    background: linear-gradient(90deg, #1e3c72 0%, #f9d423 100%);
    box-shadow: 0 0 10px 2px rgba(249, 212, 35, 0.45);
}

.terms-close-bottom:hover {
    transform: scale(1.03);
}

@keyframes termsFadeIn {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
    .terms-popup-inner { padding: 22px 14px 16px; }
    .terms-header { flex-wrap: wrap; padding-right: 40px; }
    .terms-logo { height: 38px; max-width: 140px; margin-left: auto; }
    .terms-header-text { width: 100%; }
}
