/**
 * =================================================================
 * File: ui-components.css
 * Purpose: Common UI component styles for Living Realms
 * Ticket: TK-20251021-QUEST-034 (UI Polish & Consistency)
 *
 * Provides consistent styles for:
 * - Cards (location, NPC, quest, service, area)
 * - Buttons and interactive elements
 * - Icons and badges
 * - Loading states
 * - Toast notifications
 * - Accessibility features
 *
 * Quality Verification:
 *   Test:   Not Started
 *   Review: 2025-10-30 14:30:00 - APPROVED (see results/code-review-TK-034-ui-polish.md)
 *   Spec:   2025-10-30 14:30:00 - ALIGNED (TK-20251021-QUEST-034-UI-POLISH.md)
 * =================================================================
 */

/* ===========================
   CARD COMPONENTS
   =========================== */

/* Base card style - used for all cards */
.lr-card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.lr-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #d1d5db;
}

/* Card variants */
.lr-card-location {
    background: linear-gradient(to bottom right, #ffffff, #f9fafb);
}

.lr-card-npc {
    background: linear-gradient(to bottom right, #fef3c7, #fef9e7);
}

.lr-card-quest {
    background: linear-gradient(to bottom right, #dbeafe, #eff6ff);
}

.lr-card-service {
    background: linear-gradient(to bottom right, #fce7f3, #fdf2f8);
}

.lr-card-area {
    background: linear-gradient(to bottom right, #d1fae5, #ecfdf5);
}

.lr-card-clickable {
    cursor: pointer;
}

.lr-card-clickable:active {
    transform: translateY(0);
}

/* Card header with icon */
.lr-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.lr-card-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.lr-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.lr-card-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

/* Card body */
.lr-card-body {
    font-size: 0.875rem;
    color: #4b5563;
    line-height: 1.5;
}

/* Card footer with actions/indicators */
.lr-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

/* ===========================
   BADGES & INDICATORS
   =========================== */

/* Base badge style */
.lr-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

/* Quest status badges */
.lr-badge-available {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.lr-badge-available::before {
    content: "❓";
    font-size: 1rem;
}

.lr-badge-turnin {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    animation: pulse-glow 2s ease-in-out infinite;
}

.lr-badge-turnin::before {
    content: "❗";
    font-size: 1rem;
}

.lr-badge-complete {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.lr-badge-complete::before {
    content: "✅";
    font-size: 0.875rem;
}

/* Journal status badges */
.lr-badge-accepted {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.lr-badge-accepted::before {
    content: "📜";
    font-size: 0.875rem;
}

.lr-badge-completed {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.lr-badge-completed::before {
    content: "✅";
    font-size: 0.875rem;
}

.lr-badge-abandoned {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.lr-badge-abandoned::before {
    content: "❌";
    font-size: 0.875rem;
}

/* Quest type badges */
.lr-badge-kill::before {
    content: "⚔️";
}

.lr-badge-gather::before {
    content: "🌿";
}

.lr-badge-find::before {
    content: "🔍";
}

.lr-badge-deliver::before {
    content: "📦";
}

/* ===========================
   LOADING STATES
   =========================== */

/* Loading spinner */
.lr-loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.lr-loading-spinner-sm {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}

.lr-loading-spinner-lg {
    width: 3rem;
    height: 3rem;
    border-width: 4px;
}

/* Loading container */
.lr-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
}

.lr-loading-text {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Skeleton loading */
.lr-skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 0.25rem;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.lr-skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.lr-skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

.lr-skeleton-card {
    height: 10rem;
}

/* Button loading state */
.lr-button-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.lr-button-loading::after {
    content: "";
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ===========================
   TOAST NOTIFICATIONS
   =========================== */

/* Enhanced Toastify styles */
.toastify {
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.875rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.toastify.success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.toastify.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toastify.info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.toastify.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* ===========================
   BUTTONS
   =========================== */

/* Standardized button styles */
.lr-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.lr-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.lr-button:active:not(:disabled) {
    transform: translateY(0);
}

.lr-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Button variants */
.lr-button-primary {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: white;
}

.lr-button-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #4338ca, #3730a3);
}

.lr-button-secondary {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
}

.lr-button-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.lr-button-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.lr-button-outline {
    background: transparent;
    border: 2px solid #d1d5db;
    color: #374151;
}

.lr-button-outline:hover:not(:disabled) {
    border-color: #9ca3af;
    background: #f9fafb;
}

/* ===========================
   ACCESSIBILITY
   =========================== */

/* Focus visible styles (keyboard navigation) */
.lr-card:focus-visible,
.lr-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #4f46e5;
    outline-offset: 2px;
}

/* Skip to main content link */
.lr-skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: #4f46e5;
    color: white;
    padding: 0.5rem 1rem;
    z-index: 9999;
    text-decoration: none;
}

.lr-skip-link:focus {
    top: 0;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ===========================
   RESPONSIVE UTILITIES
   =========================== */

/* Stack cards on mobile */
@media (max-width: 767px) {
    .lr-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .lr-card-icon {
        font-size: 1.5rem;
    }

    .lr-card-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ===========================
   ANIMATIONS
   =========================== */

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    50% {
        opacity: 0.9;
        box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
    }
}

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

.lr-fade-in {
    animation: fade-in 0.3s ease-out;
}

/* ===========================
   ICON STANDARDIZATION
   =========================== */

/* Standard icon sizes */
.lr-icon-sm {
    font-size: 1rem;
}

.lr-icon-md {
    font-size: 1.5rem;
}

.lr-icon-lg {
    font-size: 2rem;
}

.lr-icon-xl {
    font-size: 3rem;
}

/* Service icons - standardized */
.lr-icon-shop::before { content: "🏪"; }
.lr-icon-inn::before { content: "🏠"; }
.lr-icon-blacksmith::before { content: "⚒️"; }
.lr-icon-tavern::before { content: "🍺"; }
.lr-icon-temple::before { content: "⛪"; }
.lr-icon-guild::before { content: "🏛️"; }

/* Area icons - standardized */
.lr-icon-forest::before { content: "🌲"; }
.lr-icon-mine::before { content: "⛏️"; }
.lr-icon-ruins::before { content: "🏚️"; }
.lr-icon-night::before { content: "🌙"; }
.lr-icon-haunted::before { content: "💀"; }
.lr-icon-mountain::before { content: "🗻"; }

/* Quest type icons - standardized */
.lr-icon-quest-kill::before { content: "⚔️"; }
.lr-icon-quest-gather::before { content: "🌿"; }
.lr-icon-quest-find::before { content: "🔍"; }
.lr-icon-quest-deliver::before { content: "📦"; }

/* Quest status icons - standardized */
.lr-icon-quest-available::before { content: "❓"; }
.lr-icon-quest-turnin::before { content: "❗"; }
.lr-icon-quest-complete::before { content: "✅"; }

/* Journal icons - standardized */
.lr-icon-journal-accepted::before { content: "📜"; }
.lr-icon-journal-completed::before { content: "✅"; }
.lr-icon-journal-abandoned::before { content: "❌"; }
