/* Village Communities & Badges System Styles */
/* css/village-communities.css */

/* Village Selector */
.village-selector-header {
    text-align: center;
    margin-bottom: 2rem;
}

.village-selector-header h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.village-selector-header p {
    color: #6c757d;
    font-size: 0.9rem;
}

.village-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.village-option {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.village-option:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.village-option.active {
    border-color: var(--village-primary, #667eea);
    transform: translateY(-2px);
}

.village-banner {
    height: 100px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.village-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 3s infinite;
}

.village-emoji {
    font-size: 2.5rem;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}

.village-members {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    backdrop-filter: blur(10px);
}

.village-info {
    padding: 1.5rem;
}

.village-info h4 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 1.2rem;
}

.village-info p {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.village-specialties {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.specialty-tag {
    background: #f8f9ff;
    color: #667eea;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    border: 1px solid #e3e8ff;
}

.village-badges-preview {
    border-top: 1px solid #e0e6ed;
    padding-top: 1rem;
}

.village-badges-preview small {
    color: #6c757d;
    display: block;
    margin-bottom: 0.5rem;
}

.badge-preview {
    display: flex;
    gap: 0.25rem;
}

.mini-badge {
    display: inline-block;
    font-size: 1.2rem;
    padding: 0.25rem;
    background: #f8f9ff;
    border-radius: 8px;
    border: 1px solid #e3e8ff;
}

/* Village Welcome Modal */
.village-welcome-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.welcome-content {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    max-width: 500px;
    width: 90%;
    position: relative;
    z-index: 1;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.5s ease;
}

.welcome-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.welcome-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: celebrate 2s infinite;
}

.village-emoji-large {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
    filter: drop-shadow(3px 3px 6px rgba(0,0,0,0.3));
    animation: bounce 2s infinite;
}

.welcome-header h2 {
    margin: 0;
    font-size: 1.8rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.welcome-body {
    padding: 2rem;
}

.starter-info {
    background: #f8f9ff;
    border: 2px solid #e3e8ff;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.starter-info h4 {
    color: #667eea;
    margin-bottom: 1rem;
}

.starter-info ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.starter-info li {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.earned-badge, .badge-preview {
    background: #e8f5e8;
    color: #27ae60;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.8rem;
}

.badge-preview {
    background: #fff3cd;
    color: #856404;
}

.village-perks {
    margin-top: 1.5rem;
}

.perks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.perk-item {
    text-align: center;
    padding: 1rem;
    background: #f8f9ff;
    border-radius: 12px;
    border: 1px solid #e3e8ff;
}

.perk-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.perk-name {
    font-size: 0.8rem;
    color: #667eea;
    font-weight: 600;
}

/* Badge System */
.badge-system-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e6ed;
}

.badge-system-header h3 {
    color: #2c3e50;
    margin: 0;
}

.progress-summary {
    font-size: 1.1rem;
    color: #6c757d;
}

.earned-count {
    color: #27ae60;
    font-weight: bold;
    font-size: 1.3rem;
}

.total-count {
    color: #667eea;
    font-weight: bold;
}

.badge-categories {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.badge-category {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e6ed;
}

.category-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2rem;
}

.category-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.category-progress-bar {
    width: 100px;
    height: 8px;
    background: #e0e6ed;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 600;
}

.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.badge-item {
    background: #f8f9ff;
    border: 2px solid #e3e8ff;
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.badge-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
}

.badge-item.earned {
    background: linear-gradient(135deg, #e8f5e8, #f0fff0);
    border-color: #27ae60;
}

.badge-item.earned .badge-icon {
    animation: badgeShine 2s infinite;
}

.badge-item.locked {
    opacity: 0.6;
}

.badge-icon {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 0.75rem;
    display: block;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.1));
}

.badge-icon.grayscale {
    filter: grayscale(100%) opacity(0.5);
}

.badge-info h5 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 1rem;
}

.badge-info p {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.earned-date {
    color: #27ae60;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-requirements {
    color: #6c757d;
    font-size: 0.8rem;
}

.badge-progress-bar {
    width: 100%;
    height: 4px;
    background: #e0e6ed;
    border-radius: 2px;
    margin: 0.5rem 0;
    overflow: hidden;
}

.legendary-effect {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.2rem;
    animation: sparkle 1.5s infinite;
}

/* Role Progression */
.role-progression {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.role-progression h4 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    text-align: center;
}

.roles-timeline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.role-step {
    background: #f8f9ff;
    border: 2px solid #e3e8ff;
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    opacity: 0.6;
}

.role-step.active {
    opacity: 1;
    border-color: #667eea;
}

.role-step.current {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    transform: scale(1.05);
    animation: currentRoleGlow 2s infinite;
}

.role-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
}

.role-info h5 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.role-info p {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.role-info small {
    font-size: 0.7rem;
    opacity: 0.7;
}

.current-role-indicator {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #27ae60;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
}

/* Village UI Integration */
.village-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    margin-left: auto;
}

.village-indicator .village-emoji {
    font-size: 1.2rem;
}

.village-indicator .village-name {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.village-post {
    position: relative;
    overflow: hidden;
}

.village-post::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--village-primary), var(--village-secondary));
}

.village-badge-overlay {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--village-primary);
}

/* Badge Notifications */
.badge-earned-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10005;
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: badgeEarnedAnimation 0.6s ease;
}

.badge-celebration {
    position: relative;
    margin-bottom: 1.5rem;
}

.badge-icon-large {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
    animation: celebrationBounce 0.8s ease;
}

.celebration-effects {
    font-size: 1.5rem;
    animation: sparkleRotate 2s infinite;
}

.badge-details h3 {
    color: #27ae60;
    margin-bottom: 0.5rem;
}

.badge-details h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.badge-details p {
    color: #6c757d;
    margin-bottom: 1rem;
}

/* User Badge Display */
.earned-badges-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.earned-badges-section h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.badges-showcase {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.earned-badge-item {
    font-size: 1.5rem;
    padding: 0.5rem;
    background: #f8f9ff;
    border: 2px solid #e3e8ff;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.earned-badge-item:hover {
    transform: scale(1.1);
}

.more-badges {
    background: #667eea;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Animations */
@keyframes shimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

@keyframes modalSlideIn {
    from { transform: translate(-50%, -60%) scale(0.8); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes celebrate {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(90deg); }
    50% { transform: scale(1) rotate(180deg); }
    75% { transform: scale(1.1) rotate(270deg); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes badgeShine {
    0%, 100% { filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.1)); }
    50% { filter: drop-shadow(2px 2px 8px rgba(39, 174, 96, 0.5)); }
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
    50% { transform: scale(1.2) rotate(180deg); opacity: 0.7; }
}

@keyframes currentRoleGlow {
    0%, 100% { box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3); }
    50% { box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5); }
}

@keyframes badgeEarnedAnimation {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes celebrationBounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0) scale(1); }
    40% { transform: translateY(-20px) scale(1.1); }
    60% { transform: translateY(-10px) scale(1.05); }
}

@keyframes sparkleRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .village-grid {
        grid-template-columns: 1fr;
    }
    
    .badge-grid {
        grid-template-columns: 1fr;
    }
    
    .roles-timeline {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .category-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .badge-system-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .roles-timeline {
        grid-template-columns: 1fr;
    }
    
    .perks-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .welcome-content {
        margin: 1rem;
    }
    
    .badge-earned-notification {
        margin: 1rem;
        padding: 1.5rem;
    }
}
