/**
 * Animation Styles
 *
 * Magical ink fade-in effects for text appearing as if
 * written by an invisible quill.
 */

/* Form Styling */
.character-form {
    max-width: 500px;
    margin: 0 auto;
}

.form-row {
    margin-bottom: 1.25rem;
}

.form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-ornate);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--ink-brown);
    background: rgba(255, 255, 255, 0.9);
    box-shadow:
        0 0 0 3px rgba(61, 41, 20, 0.25),
        0 2px 8px rgba(44, 24, 16, 0.15);
}

.form-group select {
    cursor: pointer;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

/* Form divider between sections */
.form-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0 1rem;
}

.form-divider::before,
.form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-ornate), transparent);
}

.form-divider span {
    padding: 0 1rem;
    font-family: var(--font-medieval);
    font-size: 0.9rem;
    color: var(--ink-brown);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Form hints */
.form-hint {
    font-size: 0.85rem;
    color: var(--ink-faded);
    margin-top: 0.5rem;
    font-style: italic;
}

/* Scenario description */
.scenario-description {
    background: rgba(61, 41, 20, 0.08);
    border: 1px solid var(--border-ornate);
    border-radius: 4px;
    padding: 1rem;
    margin-top: 0.5rem;
}

.scenario-description strong {
    display: block;
    color: var(--ink-brown);
    margin-bottom: 0.25rem;
}

.scenario-description .scenario-tone {
    font-size: 0.85rem;
    color: var(--ink-faded);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.scenario-description p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-image: url('/static/images/button-bg.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    color: var(--parchment-light);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: none;
}

.btn:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(44, 24, 16, 0.4);
    transform: translateY(-1px);
}

.btn:active {
    filter: brightness(0.85);
    transform: translateY(1px) scale(0.98);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.05s ease;
}

.btn-primary {
    /* Uses default button-bg */
}

.btn-secondary {
    background-image: none;
    background: transparent;
    color: var(--ink-brown);
    border: 1px solid var(--border-ornate);
    text-shadow: none;
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(139, 115, 85, 0.1);
    filter: none;
    box-shadow: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Ink Appear Animation - subtle ink bleeding effect */
@keyframes inkAppear {
    0% {
        opacity: 0;
        filter: blur(1px);
        transform: translateY(1px);
    }
    100% {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
    }
}

/* Fade in from bottom */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Gentle pulse for pending items */
@keyframes gentlePulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Character appearing animation class */
.char-appear {
    display: inline;
    animation: inkAppear 0.3s ease-out forwards;
}

/* Hide markdown syntax during typing (asterisks, underscores) */
.md-syntax {
    font-size: 0;
    opacity: 0;
    width: 0;
    display: inline;
}

/* Legacy word-appear for compatibility */
.word-appear {
    display: inline;
}

/* Typing indicator - subtle pulsing dot */
.typing-indicator::after {
    content: '\2022';  /* bullet point */
    display: inline-block;
    margin-left: 2px;
    animation: typingPulse 0.8s ease-in-out infinite;
    color: var(--ink-faded);
}

@keyframes typingPulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.7;
    }
}

/* Message entry animation */
.message-entry {
    animation: fadeInUp 0.4s ease-out;
}

/* Player message slides in from left */
.message-entry.player-message {
    animation: slideInLeft 0.3s ease-out;
}

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

/* Roll panel pulses gently to draw attention */
.roll-panel {
    animation: gentlePulse 2s ease-in-out infinite;
}

/* Typing cursor effect - disabled */
.typing-cursor {
    display: none;
}

/* Loading dots animation */
.loading-dots::after {
    content: '';
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

/* Modal animations */
.modal {
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Status bar item hover */
.status-item {
    transition: transform 0.2s ease;
}

.status-item:hover {
    transform: translateY(-1px);
}

/* Input focus glow */
.player-input:focus {
    animation: inputGlow 0.3s ease-out;
}

@keyframes inputGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(139, 115, 85, 0.3);
    }
    100% {
        box-shadow: 0 0 0 4px rgba(139, 115, 85, 0);
    }
}

/* Save item hover effect */
.save-item {
    transition: all 0.2s ease;
}

.save-item:hover {
    transform: translateX(5px);
    box-shadow: -3px 0 0 var(--ink-brown);
}

/* Drop cap animation on DM messages */
.drop-cap-image {
    animation: dropCapAppear 0.5s ease-out;
}

.drop-cap-image.no-animation {
    animation: none;
}

@keyframes dropCapAppear {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Oracle badge pop-in */
.oracle-badge {
    animation: badgePopIn 0.3s ease-out;
}

@keyframes badgePopIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Discover Meaning reveal */
.discover-meaning {
    animation: meaningReveal 0.5s ease-out;
}

@keyframes meaningReveal {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Screen transitions */
.page-section {
    transition: opacity 0.3s ease;
}

.page-section.fade-out {
    opacity: 0;
}

/* Responsive form adjustments */
@media (max-width: 768px) {
    .form-row-2col {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}
