/* TavernKeep Styles */
/* Extracted from index.html - organized by feature */

/* ============================================
   TYPOGRAPHY & FONTS
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600&family=Crimson+Text:wght@400;600&display=swap');

.fantasy-header {
    font-family: 'Cinzel', serif;
}

.chat-text {
    font-family: 'Crimson Text', serif;
    font-size: 1.1rem;
}

/* ============================================
   BUTTONS & INTERACTIONS
   ============================================ */
button {
    min-height: 44px;
    cursor: pointer;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

button:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.touch-manipulation {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================
   ANIMATIONS
   ============================================ */
.glow {
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 30px rgba(239, 68, 68, 0.8); }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.torch {
    animation: flicker 3s ease-in-out infinite;
}

.torch-flicker {
    animation: flicker 2s ease-in-out infinite alternate;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

@keyframes flicker {
    0% { opacity: 1; }
    100% { opacity: 0.5; }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* ============================================
   UTILITIES
   ============================================ */
.inline-block {
    display: inline-block;
}

.line-clamp-2 {
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.group:hover .group-hover\:opacity-100 {
    opacity: 1;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
input[type="checkbox"] {
    accent-color: #f59e0b;
}

/* ============================================
   SCROLLBARS
   ============================================ */
.overflow-y-auto {
    scrollbar-width: thin;
    scrollbar-color: #4b5563 #1f2937;
}

.overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

.overflow-y-auto::-webkit-scrollbar-track {
    background: #1f2937;
}

.overflow-y-auto::-webkit-scrollbar-thumb {
    background-color: #4b5563;
    border-radius: 3px;
}

/* ============================================
   MODALS & OVERLAYS
   ============================================ */
.modal-backdrop {
    backdrop-filter: blur(2px);
}

.delete-confirmation-modal {
    backdrop-filter: blur(4px);
}

/* ============================================
   EMOJI PICKER
   ============================================ */
#emojiPicker {
    max-width: 300px;
    z-index: 1000;
}

#emojiPicker button:hover {
    transform: scale(1.1);
    transition: transform 0.1s;
}

/* ============================================
   NPC COMPONENTS
   ============================================ */
#npcDetailsModal .bg-gray-700 {
    border-left: 3px solid #4B5563;
}

/* NPC Portrait Frames */
.npc-frame {
    padding: 3px;
    border-radius: 0.5rem;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.25),
        inset 0 -1px 0 rgba(0,0,0,0.45),
        0 2px 6px rgba(0,0,0,0.6);
}

.npc-frame img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 0.35rem;
    background: #1f2937;
    cursor: pointer;
}

/* Thicker frame only for the NPC edit/create modal preview */
.npc-frame--modal-thick {
    padding: 7px;
    border-radius: 0.85rem;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.28),
        inset 0 -1px 0 rgba(0,0,0,0.55),
        0 6px 16px rgba(0,0,0,0.75);
}

.npc-frame--modal-thick img {
    border-radius: 0.65rem;
}

/* Frame Variants - Metals */
.npc-frame--bronze {
    background: linear-gradient(135deg, #f5e6b8 0%, #c9a24d 20%, #8b6a2b 55%, #5e4418 80%, #3b2a0f 100%);
}

.npc-frame--gold {
    background: linear-gradient(135deg, #fff6c7 0%, #ffd24a 25%, #c98c00 60%, #7a5200 100%);
}

.npc-frame--iron {
    background: linear-gradient(135deg, #e5e7eb 0%, #9ca3af 35%, #4b5563 70%, #111827 100%);
}

.npc-frame--obsidian {
    background: linear-gradient(135deg, #3a3a3a 0%, #151515 40%, #000 100%);
}

/* Frame Variants - Colors */
.npc-frame--red {
    background: linear-gradient(135deg, #ffd1d1 0%, #e03131 30%, #9b111e 70%, #3b0a0a 100%);
}

.npc-frame--blue {
    background: linear-gradient(135deg, #dbeafe 0%, #2563eb 35%, #1e3a8a 75%, #0b1220 100%);
}

.npc-frame--violet {
    background: linear-gradient(135deg, #ede9fe 0%, #7c3aed 35%, #4c1d95 75%, #140a2a 100%);
}

.npc-frame--green {
    background: linear-gradient(135deg, #dcfce7 0%, #16a34a 35%, #14532d 75%, #071a0f 100%);
}

/* ============================================
   CHARACTER COMPONENTS
   ============================================ */
.character-card {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.character-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.character-card.selected {
    background: linear-gradient(145deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    border-color: rgb(239, 68, 68);
}

.character-action-btn {
    backdrop-filter: blur(8px);
    transform: scale(0.9);
    transition: all 0.2s ease;
}

.character-action-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#createCharacterForm {
    max-height: 80vh;
    overflow-y: auto;
    padding-left: 5px;
    padding-right: 5px;
}

#createCharacterForm button {
    transition: all 0.2s ease;
}

#createCharacterForm button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ============================================
   CHAT COMPONENTS
   ============================================ */
.chat-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    margin: 6px 0;
}

.chat-bubble--npc {
    background: #35383f;
    color: #e8e8e8;
    align-self: flex-start;
}

.chat-bubble--user {
    background: #6b21a8;
    color: #fff;
    align-self: flex-end;
    margin-left: auto;
}

.chat-bubble__text {
    white-space: pre-wrap;
    word-wrap: break-word;
}

#messages {
    overflow-y: auto;
    max-height: 60vh;
}

/* ============================================
   USAGE BANNER
   ============================================ */
.usage-banner {
    position: sticky;
    top: 0;
    z-index: 40;
    background: linear-gradient(180deg, #fffbe6, #fff9d6);
    color: #4a3b00;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 8px 12px;
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 240ms ease, opacity 240ms ease;
}

.usage-banner.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.usage-banner__content {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    max-width: 1000px;
    margin: 0 auto;
}

.usage-banner__text {
    font-size: 14px;
}

.usage-banner__actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.usage-banner__btn {
    font: inherit;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
}

.usage-banner__btn--primary {
    background: #ef4444;
    color: #fff;
    border-color: rgba(0,0,0,0.1);
}

.usage-banner__btn--primary:hover {
    filter: brightness(0.95);
}

.usage-banner__btn--ghost {
    background: transparent;
    color: inherit;
    border-color: rgba(0,0,0,0.15);
}

/* ============================================
   SUBSCRIPTION & BILLING
   ============================================ */
.tier-btn.disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
}

/* ============================================
   ADS
   ============================================ */
.adsbygoogle {
    background-color: #111827;
    padding: 6px;
    border-radius: 8px;
}

#ad-slot-footer::before {
    content: "Sponsored";
    display: block;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 4px;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Larger close buttons on mobile */
    .modal-close-btn {
        width: 44px !important;
        height: 44px !important;
        font-size: 1.25rem !important;
    }

    /* Better modal sizing on mobile */
    .modal-content {
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    .character-card {
        padding: 1rem;
    }

    .character-action-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

@media (max-width: 640px) {
    .mobile-nav-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .usage-banner {
        transition: none;
    }
}