/*
 * Badge Card Styles
 * All visual styling for badge cards rendered by badge_card_template.php.
 * Covers card layout, rarity-based colors and hover effects, icon sizing,
 * progress bars, feature buttons, and responsive breakpoints.
 * Link this file in layout_head.php or your main stylesheet include.
 */

/* ============================================
   BADGE CARDS - BASE
   ============================================ */

.badge-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: visible;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.06);
    border: 2px solid var(--border-color);
    position: relative;
    cursor: pointer;
}

.badge-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15), 0 4px 8px rgba(0,0,0,0.1);
}

/* Locked state */
.badge-card.locked {
    opacity: 0.65;
    border: 2px dashed var(--border-color);
    background: var(--bg-secondary);
}

.badge-card.locked:hover {
    transform: translateY(-4px) scale(1.01);
    opacity: 0.75;
}

/* Placeholder */
.badge-card.placeholder {
    border: 2px dashed var(--border-color);
    background: var(--bg-secondary);
}

.badge-card.placeholder:hover {
    transform: translateY(-4px);
}

/* ============================================
   LEGENDARY GLOW EFFECT
   ============================================ */

.legendary-glow {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #f39c12, #e74c3c, #9b59b6, #3498db);
    background-size: 400% 400%;
    border-radius: 14px;
    z-index: -1;
    animation: legendaryPulse 3s ease-in-out infinite;
    opacity: 0;
    transition: opacity 0.3s;
}

@keyframes legendaryPulse {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ============================================
   RARITY-BASED HOVER EFFECTS
   ============================================ */

.badge-card.rarity-common,
.badge-card.rarity-rare,
.badge-card.rarity-epic,
.badge-card.rarity-legendary {
    background: var(--bg-card) !important;
}

.badge-card.rarity-common.earned:hover  { border-color: #95a5a6; box-shadow: 0 12px 24px rgba(149, 165, 166, 0.3); }
.badge-card.rarity-rare.earned:hover    { border-color: #3498db; box-shadow: 0 12px 24px rgba(52, 152, 219, 0.4); }
.badge-card.rarity-epic.earned:hover    { border-color: #9b59b6; box-shadow: 0 12px 24px rgba(155, 89, 182, 0.4); }
.badge-card.rarity-legendary.earned:hover { border-color: #f39c12; box-shadow: 0 12px 24px rgba(243, 156, 18, 0.3); }

/* ============================================
   HEADER BARS
   ============================================ */

.badge-header {
    padding: 6px 15px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Shimmer sweep on hover */
.badge-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.badge-card:hover .badge-header::before {
    left: 100%;
}

.badge-header-common     { background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%); }
.badge-header-rare       { background: linear-gradient(135deg, #3498db 0%, #2980b9 100%); }
.badge-header-epic       { background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%); }
.badge-header-placeholder { background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%); }

/* Legendary header pulses brightness */
.badge-header-legendary {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

.badge-rarity-label {
    color: white;
    font-weight: 900;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.badge-header-placeholder .badge-rarity-label {
    color: #a0aec0;
    text-shadow: none;
}

/* ============================================
   CONTENT AREA
   ============================================ */

.badge-content {
    padding: 20px 15px 15px 15px;
    text-align: center;
}

/* ============================================
   ICON STYLING
   ============================================ */

.badge-icon-container { margin-bottom: 12px; }

.badge-icon-wrapper {
    position: relative;
    display: inline-block;
    transition: all 0.3s;
}

/* Earned badges pulse icon on hover */
.badge-card.earned:hover .badge-icon-wrapper {
    animation: iconPulse 2.5s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.badge-icon-small  { font-size: 40px; transition: all 0.3s; }
.badge-icon-medium { font-size: 56px; transition: all 0.3s; }
.badge-icon-large  { font-size: 72px; transition: all 0.3s; }

/* Icon colors by rarity */
.badge-card.rarity-common.earned i    { color: #95a5a6; }
.badge-card.rarity-rare.earned i      { color: #3498db; }
.badge-card.rarity-epic.earned i      { color: #9b59b6; }
.badge-card.rarity-legendary.earned i { color: #f39c12; }

.badge-icon-wrapper .empty    { opacity: 0.25; color: #cbd5e0; }
.badge-icon-wrapper .grayscale { filter: grayscale(100%) brightness(0.8); opacity: 0.4; }

/* Lock overlay for locked badges */
.locked-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.75);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ============================================
   TEXT ELEMENTS
   ============================================ */

.badge-name        { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; line-height: 1.3; }
.badge-description { font-size: 12px; color: var(--text-primary); margin: 8px 0; line-height: 1.5; }
.badge-date        { font-size: 11px; color: var(--text-muted); margin-top: 8px; font-weight: 500; }
.badge-date i      { margin-right: 4px; }
.badge-placeholder-text { font-size: 12px; color: #a0aec0; font-style: italic; }

/* ============================================
   PROGRESS BARS
   ============================================ */

.badge-progress { margin-top: 12px; }

.progress-bar-container {
    width: 100%;
    height: 10px;
    background: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 6px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db 0%, #2ecc71 100%);
    transition: width 0.5s ease-out;
    position: relative;
    overflow: hidden;
}

/* Animated shine on progress bar */
.progress-bar-fill::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text { font-size: 11px; color: var(--text-muted); font-weight: 700; }

/* ============================================
   SIZES
   ============================================ */

.badge-card-small  { min-width: 110px; max-width: 140px; }
.badge-card-medium { min-width: 160px; max-width: 190px; }
.badge-card-large  { min-width: 220px; max-width: 250px; }
.badge-card-header { min-width: 130px; max-width: 160px; }

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

.feature-badge-btn,
.featured-badge-btn {
    margin-top: 12px;
    width: 100%;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.feature-badge-btn {
    border: 2px solid var(--accent);
    color: var(--accent);
    background: transparent;
}

.feature-badge-btn:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
}

.featured-badge-btn {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    border: none;
    color: white;
    cursor: not-allowed;
}

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

@media (max-width: 576px) {
    .badge-card-medium { min-width: 130px; max-width: 160px; }
    .badge-icon-medium  { font-size: 48px; }
    .badge-icon-small   { font-size: 36px; }
    .badge-name         { font-size: 13px; }
}
