/* ============================================
   Ecardica Custom Styles
   Color Palette:
   - Primary: Deep Purple #6B21A8
   - Accent:  Pink #EC4899
   - Highlight: Gold #F59E0B
   ============================================ */

/* ---- Base ---- */
* { box-sizing: border-box; }

body {
    background-color: #faf8ff;
}

/* ---- Typography ---- */
.font-serif { font-family: 'Playfair Display', Georgia, serif; }
.font-sans  { font-family: 'Inter', system-ui, sans-serif; }

/* ---- Card Hover Effects ---- */
.card-item {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease;
    cursor: pointer;
}

.card-item:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 20px 40px rgba(107, 33, 168, 0.2);
}

.card-item .card-overlay {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-item:hover .card-overlay {
    opacity: 1;
}

/* ---- Category Pills ---- */
.category-pill {
    transition: all 0.2s ease;
    cursor: pointer;
}

.category-pill:hover,
.category-pill.active {
    background: linear-gradient(135deg, #6B21A8, #EC4899);
    color: white;
    box-shadow: 0 4px 12px rgba(107, 33, 168, 0.3);
}

/* ---- Hero Gradient ---- */
.hero-gradient {
    background: linear-gradient(135deg, #3b0764 0%, #6B21A8 40%, #9333ea 70%, #EC4899 100%);
}

/* ---- AI Shimmer Loading ---- */
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.shimmer {
    background: linear-gradient(90deg, #e0d7f0 25%, #f3eeff 50%, #e0d7f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ---- Sparkle / Floating Particles ---- */
@keyframes floatUp {
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(-80px) rotate(20deg); opacity: 0; }
}

.sparkle {
    position: absolute;
    pointer-events: none;
    animation: floatUp 1.2s ease-out forwards;
    font-size: 1.2rem;
}

/* ---- Envelope Open Animation (view.php) ---- */
.envelope-wrapper {
    perspective: 1000px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 350px;
}

.envelope {
    position: relative;
    width: 320px;
    height: 220px;
    transform-style: preserve-3d;
}

/* Envelope body */
.envelope-body {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, #fff9e6, #fef3c7);
    border: 2px solid #F59E0B;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.3);
    overflow: hidden;
}

/* Envelope flap */
.envelope-flap {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(160deg, #fbbf24, #f59e0b);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top center;
    transform: rotateX(0deg);
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 10;
}

.envelope-flap.open {
    transform: rotateX(-160deg);
}

/* Left fold */
.envelope-left {
    position: absolute;
    bottom: 0; left: 0;
    width: 50%; height: 100%;
    background: linear-gradient(135deg, #fde68a, #fbbf24);
    clip-path: polygon(0 0, 0 100%, 100% 100%);
}

/* Right fold */
.envelope-right {
    position: absolute;
    bottom: 0; right: 0;
    width: 50%; height: 100%;
    background: linear-gradient(225deg, #fde68a, #fbbf24);
    clip-path: polygon(100% 0, 0 100%, 100% 100%);
}

/* Bottom fold */
.envelope-bottom {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to top, #f59e0b, #fbbf24);
    clip-path: polygon(0 100%, 50% 0, 100% 100%);
}

/* Card inside envelope */
.card-inside {
    position: absolute;
    top: 10%; left: 10%; right: 10%;
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(20px) scale(0.9);
    opacity: 0;
    transition: transform 1s ease 0.6s, opacity 0.8s ease 0.6s;
    z-index: 5;
    text-align: center;
}

.envelope-flap.open ~ .card-inside,
.card-inside.revealed {
    transform: translateY(-30px) scale(1);
    opacity: 1;
}

/* ---- Full Card Reveal (after envelope) ---- */
@keyframes cardReveal {
    0%   { transform: translateY(60px) scale(0.9); opacity: 0; }
    60%  { transform: translateY(-8px) scale(1.02); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.card-reveal {
    animation: cardReveal 1s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

/* ---- Confetti burst ---- */
@keyframes confettiDrop {
    0%   { transform: translateY(-10px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(80px) rotate(360deg); opacity: 0; }
}

.confetti-piece {
    position: fixed;
    width: 8px; height: 8px;
    pointer-events: none;
    animation: confettiDrop 1.5s ease-out forwards;
    border-radius: 2px;
    z-index: 9999;
}

/* ---- Gradient Button ---- */
.btn-gradient {
    background: linear-gradient(135deg, #6B21A8, #EC4899);
    color: white;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(107, 33, 168, 0.35);
}

.btn-gradient:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(107, 33, 168, 0.45);
}

.btn-gradient:active {
    transform: translateY(0);
}

/* ---- Gold accent button ---- */
.btn-gold {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: white;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
}

.btn-gold:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ---- Form focus ring ---- */
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #6B21A8 !important;
    box-shadow: 0 0 0 3px rgba(107, 33, 168, 0.15);
}

/* ---- Premium badge ---- */
.premium-badge {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 999px;
}

/* ---- AI badge ---- */
.ai-badge {
    background: linear-gradient(135deg, #EC4899, #8B5CF6);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 999px;
}

/* ---- Gradient border card ---- */
.gradient-border {
    position: relative;
    border-radius: 16px;
    background: white;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 18px;
    background: linear-gradient(135deg, #6B21A8, #EC4899, #F59E0B);
    z-index: -1;
}

/* ---- Page transition ---- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.page-fade {
    animation: fadeIn 0.4s ease-out forwards;
}

/* ---- Pulse glow ---- */
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(107, 33, 168, 0.4); }
    50%       { box-shadow: 0 0 0 12px rgba(107, 33, 168, 0); }
}

.pulse-glow {
    animation: pulseGlow 2s infinite;
}

/* ---- Loading spinner ---- */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f3e8ff; }
::-webkit-scrollbar-thumb { background: #a855f7; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #7e22ce; }

/* ---- Message textarea pulse when AI generating ---- */
textarea.ai-active {
    border-color: #EC4899 !important;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.2);
    transition: all 0.3s ease;
}

/* ---- Success checkmark ---- */
@keyframes checkDraw {
    0%   { stroke-dashoffset: 100; }
    100% { stroke-dashoffset: 0; }
}

.check-svg circle {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: checkDraw 0.8s ease forwards;
}

.check-svg path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: checkDraw 0.5s ease 0.4s forwards;
}
