/* 
* animations.css - สไตล์ชีทสำหรับอนิเมชันและเอฟเฟกต์ต่างๆ ของเว็บไซต์โรงเรียนเทพปัญญา
* เวอร์ชัน: 1.0
*/

/* ====================== อนิเมชันพื้นฐาน ====================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideDown {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideLeft {
    from { transform: translateX(30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideRight {
    from { transform: translateX(-30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes zoomOut {
    from { transform: scale(1.2); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    60% { transform: translateY(-10px); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes rotateIn {
    from { transform: rotate(-90deg); opacity: 0; }
    to { transform: rotate(0); opacity: 1; }
}

/* ====================== คลาสอนิเมชัน ====================== */
.animate-fade-in {
    animation: fadeIn 1s ease forwards;
}

.animate-fade-out {
    animation: fadeOut 1s ease forwards;
}

.animate-slide-up {
    animation: slideUp 1s ease forwards;
}

.animate-slide-down {
    animation: slideDown 1s ease forwards;
}

.animate-slide-left {
    animation: slideLeft 1s ease forwards;
}

.animate-slide-right {
    animation: slideRight 1s ease forwards;
}

.animate-zoom-in {
    animation: zoomIn 1s ease forwards;
}

.animate-zoom-out {
    animation: zoomOut 1s ease forwards;
}

.animate-bounce {
    animation: bounce 2s ease infinite;
}

.animate-pulse {
    animation: pulse 2s ease infinite;
}

.animate-rotate-in {
    animation: rotateIn 1s ease forwards;
}

/* ====================== อนิเมชันสำหรับองค์ประกอบต่างๆ ====================== */

/* ลูกศรกระดิกเพื่อดึงดูดความสนใจ */
.arrow-bounce {
    animation: bounce 2s infinite;
}

/* การกระพริบ */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.blink {
    animation: blink 1.5s linear infinite;
}

/* แถบโหลดข้อมูล */
@keyframes loading {
    0% { width: 0%; }
    100% { width: 100%; }
}

.loading-bar {
    height: 4px;
    background-color: var(--primary-color);
    animation: loading 2s ease;
}

/* การเคลื่อนไหวของไอคอน */
@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.float-icon {
    animation: floatIcon 3s ease-in-out infinite;
}

/* เอฟเฟกต์ส่องแสง */
@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(var(--primary-color-rgb), 0.5); }
    50% { box-shadow: 0 0 20px rgba(var(--primary-color-rgb), 0.8); }
}

.glow-effect {
    animation: glow 2s ease-in-out infinite;
}

/* ปุ่มที่มีเอฟเฟกต์คลื่น */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.ripple-button {
    position: relative;
    overflow: hidden;
}

.ripple-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: ripple 1s ease-out;
}

/* เอฟเฟกต์การเลื่อนเข้ามาเมื่อเลื่อนหน้าจอ */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-reveal[data-delay="100"] {
    transition-delay: 0.1s;
}

.scroll-reveal[data-delay="200"] {
    transition-delay: 0.2s;
}

.scroll-reveal[data-delay="300"] {
    transition-delay: 0.3s;
}

.scroll-reveal[data-delay="400"] {
    transition-delay: 0.4s;
}

.scroll-reveal[data-delay="500"] {
    transition-delay: 0.5s;
}

/* เอฟเฟกต์การแสดงผลตัวอักษรแบบพิมพ์ */
@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--primary-color) }
}

.typing-effect {
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--primary-color);
    animation: 
        typing 3.5s steps(40, end),
        blink-caret 0.75s step-end infinite;
}

/* เอฟเฟกต์การเปลี่ยนสี */
@keyframes colorChange {
    0% { color: #0066cc; }
    25% { color: #cc0066; }
    50% { color: #00cc66; }
    75% { color: #cc6600; }
    100% { color: #0066cc; }
}

.color-changing-text {
    animation: colorChange 8s infinite;
}

/* เอฟเฟกต์การเปลี่ยนพื้นหลัง */
@keyframes gradientBackground {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.gradient-bg {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBackground 15s ease infinite;
}

/* เอฟเฟกต์เงาเคลื่อนไหว */
@keyframes shadowMove {
    0% { box-shadow: -5px 5px 15px rgba(0, 0, 0, 0.2); }
    50% { box-shadow: 5px -5px 15px rgba(0, 0, 0, 0.2); }
    100% { box-shadow: -5px 5px 15px rgba(0, 0, 0, 0.2); }
}

.moving-shadow {
    animation: shadowMove 4s ease infinite;
}

/* ลำดับการเลื่อนเข้ามาของรายการ */
.list-item-animation {
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.5s ease;
}

.list-item-animation.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* เอฟเฟกต์การสั่น */
@keyframes shakeEffect {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shakeEffect 0.8s ease-in-out;
}

/* เอฟเฟกต์เน้นความสำคัญ */
@keyframes highlight {
    0% { background-color: transparent; }
    30% { background-color: rgba(var(--primary-color-rgb), 0.2); }
    100% { background-color: transparent; }
}

.highlight-effect {
    animation: highlight 2s ease;
}

/* เอฟเฟกต์กระดิกปุ่ม */
@keyframes buttonWiggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(5deg); }
    75% { transform: rotate(-5deg); }
}

.wiggle-button:hover {
    animation: buttonWiggle 0.5s ease;
}

/* เอฟเฟกต์เลื่อนเข้ามาจากด้านข้าง */
.slide-in-left, .slide-in-right {
    opacity: 0;
    transition: all 0.8s ease;
}

.slide-in-left {
    transform: translateX(-50px);
}

.slide-in-right {
    transform: translateX(50px);
}

.slide-in-left.revealed, .slide-in-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* เอฟเฟกต์เปลี่ยนสีพื้นหลัง */
@keyframes bgPulse {
    0%, 100% { background-color: rgba(var(--primary-color-rgb), 0.05); }
    50% { background-color: rgba(var(--primary-color-rgb), 0.15); }
}

.bg-pulse {
    animation: bgPulse 2.5s infinite;
}

/* เอฟเฟกต์การขยาย */
@keyframes scalePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.scale-pulse {
    animation: scalePulse 2s infinite;
}