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

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes progressBar {
    from { width: 0; }
    to { width: var(--scroll-width, 0%); }
}

@keyframes highlightText {
    0% { background-position: -100% 0; }
    100% { background-position: 100% 0; }
}

/* Reading Progress Bar */
.reading-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(221, 38, 41, 0.1);
    z-index: 9999;
}

.reading-progress-bar {
    height: 100%;
    background: var(--fenix-red);
    width: 0;
    transition: width 0.1s ease;
    animation: progressBar 0.3s ease-out;
}

/* Page Header */
.page-header {
    animation: fadeIn 1s ease-out;
}

.page-header h1 {
    animation: fadeInUp 0.8s ease-out;
}

.page-header p {
    animation: fadeInUp 0.8s ease-out 0.2s;
    opacity: 0;
    animation-fill-mode: forwards;
}

/* Search Widget */
.search-widget {
    animation: slideInLeft 0.8s ease-out;
    transition: all 0.3s ease;
}

.search-widget:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.search-form {
    position: relative;
    overflow: hidden;
}

.search-form input {
    transition: all 0.3s ease;
}

.search-form input:focus {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.search-form button {
    transition: all 0.3s ease;
}

.search-form button:hover {
    transform: scale(1.1);
    color: var(--fenix-red);
}

/* Terms Navigation */
.terms-nav {
    animation: slideInLeft 0.8s ease-out;
    transition: all 0.3s ease;
}

.terms-nav:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.terms-nav ul li {
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
}

.terms-nav ul li:nth-child(1) { animation-delay: 0.1s; }
.terms-nav ul li:nth-child(2) { animation-delay: 0.2s; }
.terms-nav ul li:nth-child(3) { animation-delay: 0.3s; }
.terms-nav ul li:nth-child(4) { animation-delay: 0.4s; }
.terms-nav ul li:nth-child(5) { animation-delay: 0.5s; }
.terms-nav ul li:nth-child(6) { animation-delay: 0.6s; }
.terms-nav ul li:nth-child(7) { animation-delay: 0.7s; }
.terms-nav ul li:nth-child(8) { animation-delay: 0.8s; }

.terms-nav a {
    transition: all 0.3s ease;
}

.terms-nav a:hover {
    color: var(--fenix-red);
    transform: translateX(10px);
}

/* Terms Sections */
.terms-section {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
    animation-delay: calc(var(--section-index, 0) * 0.2s);
    transition: all 0.3s ease;
}

.terms-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.terms-section h2 {
    position: relative;
    padding-left: 20px;
}

.terms-section h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: var(--fenix-red);
    transition: height 0.3s ease;
}

.terms-section:hover h2::before {
    height: 100%;
}

.terms-section h2::after {
    transition: width 0.3s ease;
}

.terms-section:hover h2::after {
    width: 100px;
}

/* List Items */
.terms-section ul li {
    opacity: 0;
    animation: slideInRight 0.5s ease-out forwards;
    transition: all 0.3s ease;
}

.terms-section ul li:nth-child(1) { animation-delay: 0.1s; }
.terms-section ul li:nth-child(2) { animation-delay: 0.2s; }
.terms-section ul li:nth-child(3) { animation-delay: 0.3s; }
.terms-section ul li:nth-child(4) { animation-delay: 0.4s; }
.terms-section ul li:nth-child(5) { animation-delay: 0.5s; }

.terms-section ul li:hover {
    transform: translateX(10px);
    color: var(--fenix-red);
}

/* Print Button */
.print-btn {
    animation: fadeIn 1s ease-out;
    transition: all 0.3s ease;
}

.print-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.print-btn i {
    transition: all 0.3s ease;
}

.print-btn:hover i {
    transform: rotate(360deg);
    color: var(--fenix-red);
}

/* Search Highlight */
.highlight {
    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(221, 38, 41, 0.2) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: highlightText 1s ease-in-out;
}

/* Responsive Animations */
@media (max-width: 768px) {
    .terms-section {
        animation-delay: calc(var(--section-index, 0) * 0.1s);
    }
    
    .terms-nav ul li {
        animation-delay: calc(var(--item-index, 0) * 0.1s);
    }
    
    .terms-section ul li {
        animation-delay: calc(var(--item-index, 0) * 0.1s);
    }
}
