/* Custom styles and Tailwind 3 shim for production */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.dark {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    --card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
}

.bg-white { background-color: var(--bg-secondary) !important; }
.bg-gray-50 { background-color: var(--bg-primary) !important; }
.bg-gray-100 { background-color: var(--border-color) !important; }
.dark .bg-slate-800 { background-color: #1e293b !important; }
.text-gray-900 { color: var(--text-primary) !important; }
.text-gray-600 { color: var(--text-secondary) !important; }
.text-gray-500 { color: var(--text-secondary) !important; }
.text-gray-400 { color: var(--text-muted) !important; }
.border-gray-200, .border-gray-100 { border-color: var(--border-color) !important; }

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 3px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

/* Arbitrary values and Tailwind 3 features shim */
.z-\[60\] { z-index: 60; }
.text-\[10px\] { font-size: 10px; }
.text-\[9px\] { font-size: 9px; }
.text-\[8px\] { font-size: 8px; }
.text-\[7px\] { font-size: 7px; }
.tracking-\[0\.2em\] { letter-spacing: 0.2em; }
.w-\[63mm\] { width: 63mm; }
.h-\[88mm\] { height: 88mm; }
.leading-\[1\.2\] { line-height: 1.2; }

/* Spell Card Adjustments */
.spell-card, .custom-spell-card {
    background-color: white !important;
    color: #111827 !important;
    border-width: 4px;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

.spell-card .text-gray-800, 
.spell-card .dark\:text-gray-200,
.custom-spell-card .text-gray-800,
.custom-spell-card .dark\:text-gray-200 {
    color: #1f2937 !important;
}

.spell-card .text-gray-500,
.custom-spell-card .text-gray-500 {
    color: #6b7280 !important;
}

/* Ensure no dark mode overrides for cards */
.dark .spell-card, .dark .custom-spell-card {
    background-color: white !important;
    color: #111827 !important;
}

/* Classes override for Light Mode (Always) */
.spell-card.bg-purple-50, .custom-spell-card.bg-purple-50 { background-color: #faf5ff !important; }
.spell-card.bg-amber-50, .custom-spell-card.bg-amber-50 { background-color: #fffbeb !important; }
.spell-card.bg-green-50, .custom-spell-card.bg-green-50 { background-color: #f0fdf4 !important; }
.spell-card.bg-emerald-50, .custom-spell-card.bg-emerald-50 { background-color: #ecfdf5 !important; }
.spell-card.bg-red-50, .custom-spell-card.bg-red-50 { background-color: #fef2f2 !important; }
.spell-card.bg-blue-50, .custom-spell-card.bg-blue-50 { background-color: #eff6ff !important; }
.spell-card.bg-yellow-50, .custom-spell-card.bg-yellow-50 { background-color: #fefce8 !important; }
.spell-card.bg-indigo-50, .custom-spell-card.bg-indigo-50 { background-color: #e0e7ff !important; }

/* Buttons Accent Colors (Fix for invisible "Add" button) */
.bg-purple-600 { background-color: #9333ea !important; }
.bg-indigo-600 { background-color: #4f46e5 !important; }
.bg-amber-500 { background-color: #f59e0b !important; }
.bg-green-600 { background-color: #16a34a !important; }
.bg-emerald-700 { background-color: #047857 !important; }
.bg-red-600 { background-color: #dc2626 !important; }
.bg-blue-600 { background-color: #2563eb !important; }
.bg-yellow-500 { background-color: #eab308 !important; }
.text-white { color: #ffffff !important; }
.text-gray-700 { color: #374151 !important; }
.bg-gray-100 { background-color: #f3f4f6 !important; }
.bg-gray-200 { background-color: #e5e7eb !important; }

/* Custom Card Layout */
.custom-spell-card img.custom-image {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* Alert System */
#alert-container {
    position: fixed;
    bottom: 6rem;
    right: 2rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alert-toast {
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--card-shadow);
    border-left: 4px solid #6366f1;
    animation: slideIn 0.3s ease-out forwards;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    min-width: 250px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--card-shadow);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* Floating button */
#btn-help {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
    background: #6366f1;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
    cursor: pointer;
    z-index: 65;
    transition: all 0.2s;
}

#btn-help:hover {
    transform: scale(1.1);
    background: #4f46e5;
}

/* Floating Donation Button */
#donation-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid #fbbf24; /* yellow border */
    border-radius: 9999px;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: bold;
    font-size: 0.875rem;
    box-shadow: var(--card-shadow);
    z-index: 65;
    text-decoration: none;
    transition: all 0.2s;
}

#donation-button:hover {
    transform: scale(1.05);
    background-color: var(--bg-primary);
}

#donation-button .emoji {
    display: inline-block;
    animation: bounceEmoji 2s infinite ease-in-out;
}

@keyframes bounceEmoji {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Print Grid en pantalla */
.print-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    width: 100%;
}

/* Print Styles */
@media print {
    @page {
        size: A4;
        margin: 5mm;
    }
    body {
        background: white !important;
        color: black !important;
        padding: 0;
        margin: 0;
    }
    .no-print {
        display: none !important;
    }
    .print-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 63mm) !important;
        grid-template-rows: repeat(3, 88mm) !important;
        gap: 0 !important;
        justify-content: center !important;
        align-content: start !important;
        page-break-after: always !important;
        width: 100% !important;
        max-height: 297mm;
    }
    .spell-card, .custom-spell-card {
        width: 63mm !important;
        height: 88mm !important;
        border: 4px solid currentColor !important;
        box-shadow: none !important;
        border-radius: 0 !important; /* Esquinas rectas para corte más fácil si se desea, o mantener rounded-xl si se prefiere */
        margin: 0 !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
        break-inside: avoid;
    }
    .watermark-print {
        opacity: 0.1 !important;
        display: flex !important;
    }
}
