/* Styles specific to the CSS Animation Snippets Tool */

.snippets-container {
    max-width: 900px;
    margin: 1rem auto;
    padding: 1rem 1.5rem;
    /* background-color: var(--bg-color); Optional: different bg? */
}

.snippets-container h2 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
    color: var(--text-color);
}
.snippets-container .intro {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--label-text);
    font-size: 0.95rem;
}

.snippet-category {
    margin-bottom: 2.5rem;
}

.snippet-category h3 {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border-color);
}

.snippet-card {
    background-color: var(--preview-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem 1.5rem 1.5rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: relative; /* For copy status */
}
body.dark-mode .snippet-card {
    box-shadow: 0 1px 3px rgba(255,255,255,0.05);
}

.snippet-card h4 {
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--accent-color);
}
body.dark-mode .snippet-card h4 {
     color: var(--accent-color-dark);
}

/* Preview Area */
.snippet-preview {
    background-color: var(--bg-color);
    padding: 2rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    min-height: 80px;
    display: flex;
    flex-direction: column; /* Keep column for potential notes */
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    overflow: hidden; /* Prevent content overflow */
    gap: 1rem; /* Space if multiple items were present */
}
.preview-note {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--label-text);
    opacity: 0.8;
    text-align: center;
    /* margin-top: -0.5rem; Remove negative margin */
    margin-bottom: 0rem; /* Reduce bottom margin */
}

/* Styling for the container holding the element to be animated */
.preview-element-container {
     width: 100%; /* Ensure container takes space */
     min-height: 40px; /* Give it some minimum height */
     display: flex;
     align-items: center;
     justify-content: center;
}


/* Generic styling for elements inside preview */
.preview-element {
    padding: 0.6rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    border: none;
    background-color: var(--accent-color);
    color: var(--bg-color-light);
    cursor: default; /* Indicate it's just a preview */
    display: inline-block; /* Ensure inline-block for transforms */
}
body.dark-mode .preview-element {
     color: var(--bg-color-dark);
}

/* Trigger Button Styling REMOVED */
/*
.trigger-btn { ... }
*/

/* Code Area */
.snippet-code {
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Space between HTML and CSS blocks */
}

.code-block {
    position: relative; /* For copy button */
}

.code-block label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--label-text);
    text-transform: uppercase;
}

.code-block pre {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.8rem;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    overflow-x: auto; /* Allow horizontal scrolling */
    white-space: pre; /* Preserve whitespace exactly */
    line-height: 1.5;
    /* Add padding-top to avoid overlapping with copy button */
    padding-top: 2.0rem;
}

.code-block code {
    /* No extra styles needed if using <pre> */
}

/* Copy Button */
.copy-btn {
    position: absolute;
    top: 0; /* Align with label */
    right: 0;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    background-color: var(--label-text);
    color: var(--bg-color);
    border: none;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    z-index: 1; /* Ensure it's above <pre> */
}
.copy-btn:hover {
    opacity: 1;
}

/* Copy Status Message (per card) */
.copy-status {
    position: absolute;
    bottom: 5px;
    right: 10px;
    font-size: 0.8rem;
    color: var(--accent-color);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}
.copy-status.visible {
    opacity: 1;
}


/* --- START: CSS Snippets Definitions --- */

/* --- Hover Effects --- */
.grow-hover {
  display: inline-block;
  transition: transform 0.3s ease-in-out;
}
.grow-hover:hover {
  transform: scale(1.1);
}

.shrink-hover {
  display: inline-block;
  transition: transform 0.3s ease-in-out;
}
.shrink-hover:hover {
  transform: scale(0.9);
}

.fade-hover {
  transition: opacity 0.3s ease-in-out;
  display: inline-block;
  padding: 1rem;
  background-color: var(--accent-color);
  color: var(--bg-color-light);
  border-radius: 4px;
}
body.dark-mode .fade-hover { color: var(--bg-color-dark); }
.fade-hover:hover {
  opacity: 0.7;
}

.color-hover {
  background-color: #007bff;
  color: white;
  transition: background-color 0.3s ease;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 4px;
}
.color-hover:hover {
  background-color: #0056b3;
}
body.dark-mode .color-hover {
    background-color: #66bfff;
    color: #212529;
}
body.dark-mode .color-hover:hover {
     background-color: #80cfff;
}

.slide-up-hover {
  display: inline-block;
  transition: transform 0.2s ease-out;
}
.slide-up-hover:hover {
  transform: translateY(-5px);
}

.shadow-hover {
  transition: box-shadow 0.3s ease-in-out;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  padding: 1rem;
  border-radius: 4px;
  background-color: white;
  display: inline-block;
}
body.dark-mode .shadow-hover {
    background-color: var(--preview-bg-dark);
    box-shadow: 0 2px 4px rgba(255,255,255,0.05);
}
.shadow-hover:hover {
  box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}
body.dark-mode .shadow-hover:hover {
     box-shadow: 0 6px 12px rgba(255,255,255,0.1);
}


/* --- Loading Indicators --- */
.spinner-loader {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 123, 255, 0.2);
  border-top-color: #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  background-color: transparent !important;
  color: inherit !important;
  padding: 0 !important;
}
body.dark-mode .spinner-loader {
    border-color: rgba(102, 191, 255, 0.2);
    border-top-color: #66bfff;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pulsing-dot {
  width: 15px;
  height: 15px;
  background-color: #007bff;
  border-radius: 50%;
  animation: pulse-loader 1.5s ease-in-out infinite;
  color: inherit !important;
  padding: 0 !important;
}
body.dark-mode .pulsing-dot {
     background-color: #66bfff;
}
@keyframes pulse-loader {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.7); opacity: 0.5; }
}

.bouncing-dots-loader {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 40px;
  background-color: transparent !important;
  padding: 0 !important;
}
.bouncing-dots-loader div {
  width: 10px;
  height: 10px;
  margin: 0 3px;
  background-color: #007bff;
  border-radius: 50%;
  animation: bounce-dots 1.4s infinite ease-in-out both;
}
body.dark-mode .bouncing-dots-loader div {
   background-color: #66bfff;
}
.bouncing-dots-loader div:nth-child(1) { animation-delay: -0.32s; }
.bouncing-dots-loader div:nth-child(2) { animation-delay: -0.16s; }
.bouncing-dots-loader div:nth-child(3) { animation-delay: 0s; }
@keyframes bounce-dots {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}


/* --- Entrance Effects --- */
/* Base state for elements before animation (applied in HTML/CSS for preview) */
.fade-in-target,
.slide-in-left-target,
.slide-in-right-target,
.zoom-in-target {
    opacity: 0; /* Common starting point */
}
.slide-in-left-target { transform: translateX(-50px); }
.slide-in-right-target { transform: translateX(50px); }
.zoom-in-target { transform: scale(0.8); }

/* Animation classes (add via JS in real use) */
.fade-in-animate { animation: fadeIn 0.8s ease-in forwards; }
.slide-in-left-animate { animation: slideInLeft 0.6s ease-out forwards; }
.slide-in-right-animate { animation: slideInRight 0.6s ease-out forwards; }
.zoom-in-animate { animation: zoomIn 0.5s ease-out forwards; }

/* Keyframes */
@keyframes fadeIn { to { opacity: 1; } }
@keyframes slideInLeft { to { opacity: 1; transform: translateX(0); } }
@keyframes slideInRight { to { opacity: 1; transform: translateX(0); } }
@keyframes zoomIn { to { opacity: 1; transform: scale(1); } }

/* Apply animations directly for preview elements */
.snippet-preview .fade-in-target { animation: fadeIn 0.8s ease-in forwards; }
.snippet-preview .slide-in-left-target { animation: slideInLeft 0.6s ease-out forwards; }
.snippet-preview .slide-in-right-target { animation: slideInRight 0.6s ease-out forwards; }
.snippet-preview .zoom-in-target { animation: zoomIn 0.5s ease-out forwards; }


/* --- Attention Seekers --- */
/* Animation classes (add via JS in real use) */
.shake-animation { animation: shake 0.5s ease-in-out; }
.pulse-attention-animate { animation: pulse-attention 1.5s infinite ease-in-out; }
.wobble-animation { animation: wobble 0.8s ease-in-out; }
.tada-animation { animation: tada 1s ease; }

/* Keyframes */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
  20%, 40%, 60%, 80% { transform: translateX(8px); }
}
@keyframes pulse-attention {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
@keyframes wobble {
  0%, 100% { transform: translateX(0%); }
  15% { transform: translateX(-8%) rotate(-4deg); }
  30% { transform: translateX(6%) rotate(3deg); }
  45% { transform: translateX(-5%) rotate(-2deg); }
  60% { transform: translateX(3%) rotate(1deg); }
  75% { transform: translateX(-2%) rotate(-1deg); }
}
@keyframes tada {
  0% {transform: scale(1);}
  10%, 20% {transform: scale(0.9) rotate(-3deg);}
  30%, 50%, 70%, 90% {transform: scale(1.1) rotate(3deg);}
  40%, 60%, 80% {transform: scale(1.1) rotate(-3deg);}
  100% {transform: scale(1) rotate(0);}
}

/* Apply constant animation for preview elements */
.snippet-preview .shake-target { animation: shake 0.5s ease-in-out infinite; }
.snippet-preview .pulse-attention-target { animation: pulse-attention 1.5s infinite ease-in-out; }
.snippet-preview .wobble-target { animation: wobble 1.2s ease-in-out infinite; } /* Slightly slower for constant */
.snippet-preview .tada-target { animation: tada 1.5s ease infinite; } /* Slightly slower for constant */


/* --- Background Effects --- */
.skeleton-loading {
  background-color: #e0e0e0;
  animation: pulse-bg 1.5s infinite ease-in-out;
  border-radius: 4px;
  width: 80%;
  height: 20px;
  color: inherit !important;
  padding: 0 !important;
  margin-bottom: 10px;
}
body.dark-mode .skeleton-loading {
   background-color: #424242 !important;
}
@keyframes pulse-bg {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.gradient-bg-animate {
  background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  padding: 1rem 1.5rem;
  color: white;
  border-radius: 4px;
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- END: CSS Snippets Definitions --- */


/* Responsive Adjustments */
@media (max-width: 768px) {
    .snippet-card { padding: 1rem; }
    .snippet-code { flex-direction: column; }
}

@media (max-width: 600px) {
    .snippets-container { padding: 1rem; }
    .snippet-category h3 { font-size: 1.1rem; margin-bottom: 1rem;}
    .snippet-card h4 { font-size: 1rem; }
    .code-block pre { font-size: 0.8rem; }
}