/* ========================================
   BADGE COMPONENTS
   Reusable badge styles across the app
   ======================================== */

/* ========================================
   CATEGORY BADGE
   Used to display question categories in:
   - exam-test.html (question card)
   - practice-mode.html (question card)
   - dashboard.html (selected filters)
   ======================================== */

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #f6f6f6;
    color: #333;
    padding: 0.3rem 0.3rem;
    border: 1.5px solid #333;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.7rem;
    line-height: 1.2;
    transition: all 0.2s ease;
}

.category-badge i {
    font-size: 0.85em;
    opacity: 0.9;
    color: #333;
}

/* Category Badge Variants */
.category-badge.badge-primary {
    background: #f6f6f6;
    color: #333;
    border-color: #333;
}

.category-badge.badge-selected {
    background: #f6f6f6;
    color: #333;
    border-color: var(--primary);
    ;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.category-badge.badge-selected i {
    color: #333;
    opacity: 0.9;
}

.category-badge.badge-unselected {
    background: #ffffff;
    color: #8d8d8d;
    border-color: #8d8d8d;
    opacity: 0.85;
}

.category-badge.badge-unselected i {
    color: #8d8d8d;
    opacity: 0.85;
}

/* Hover state (for interactive badges) */
.category-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 120, 235, 0.2);
    color: #333;
    border-color: #333;
}

.category-badge:hover i {
    transform: translateY(-1px);
    color: #333;
}

/* Small variant (for compact spaces) */
.category-badge.badge-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
}

/* Large variant (for emphasis) */
.category-badge.badge-lg {
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
}

/* ========================================
   USER ANSWER LABEL BADGE
   Shows "Η Απάντηση σου" with pointing hand icon
   Used in:
   - exam-results.html (after user's selected answer)
   - practice-mode.html (after user's selected answer)
   ======================================== */

.user-answer-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #856404;
}

.user-answer-label i {
    font-size: 0.9rem;
}

/* User Answer Label Tooltip (for mobile) */
.user-answer-tooltip {
    position: absolute;
    top: -45px;
    right: 0;
    background: #fff3cd;
    color: #856404;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 100;
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.user-answer-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 15px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #fff3cd;
}

.user-answer-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   ΠΡΟΕΛΕΥΣΗ BADGE
   Shows the source/origin of a question
   Used in:
   - exam-test.html (question header)
   - practice-mode.html (question header)
   ======================================== */

.proelefsi-badge {
    display: inline-block;
    background-color: #fafaf8;
    color: #6c757d;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.15rem 0.4rem;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    margin-left: auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ========================================
   CHECKBOX ICON STYLING (Practice Mode Modal Only)
   Used in dashboard practice mode category selection
   ======================================== */

/* Style checkbox icons to be larger with white background */
.category-badge i.fa-check,
.category-badge i.fa-square {
    font-size: 1.2em;
    width: 15px;
    height: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid #333;
    border-radius: 3px;
    padding: 2px;
}

/* Checked state - black tick on white background */
.category-badge.badge-selected i.fa-check {
    color: #616161;
    background: white;
    border-color: #616161;
}

/* Unchecked state - empty white box */
.category-badge.badge-unselected i.fa-square {
    color: transparent;
    background: white;
    border-color: #616161;
}

/* ========================================
   RESPONSIVE DESIGN - MEDIA QUERIES
   ======================================== */

/* Tablet and below (992px) */
@media (max-width: 992px) {
    .category-badge {
        font-size: 0.85rem;
        padding: 0.45rem 0.9rem;
    }

    .category-badge.badge-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.7rem;
    }
}

/* Mobile (768px and below) */
@media (max-width: 768px) {
    .category-badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    .category-badge.badge-sm {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }

    .category-badge i {
        font-size: 0.8em;
    }
}

/* Very Small Mobile (576px and below) */
@media (max-width: 576px) {

    /* User Answer Label - Icon only, floating top-right */
    .user-answer-label {
        position: absolute;
        top: -12px;
        right: -8px;
        width: 36px;
        height: 36px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
        z-index: 10;
        cursor: pointer;
        gap: 0;
        font-size: 0;
        overflow: hidden;
    }

    .user-answer-label i {
        font-size: 1.1rem;
        margin: 0;
    }

    /* Hide source badge on very small screens */
    .proelefsi-badge {
        display: none !important;
    }

    /* Show info icon button instead */
    .source-info-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        background: #f0f0f0;
        border: 1px solid #d0d0d0;
        border-radius: 50%;
        color: #6c757d;
        font-size: 0.9rem;
        cursor: pointer;
        margin-left: auto;
        transition: all 0.2s ease;
    }

    .source-info-btn:active {
        background: #e0e0e0;
        transform: scale(0.95);
    }
}

/* ========================================
   ACHIEVEMENT BADGES (DASHBOARD)
   Grid and card styles for the accomplishments gallery
   ======================================== */

.achievements-container {
    padding-bottom: 50px;
}

/* Badge Gallery Grid */
.badge-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 30px;
}

/* Badge Item Card */
.badge-item {
    background: #fff;
    border-radius: 24px;
    padding: 30px 20px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.badge-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border-color: rgba(40, 120, 235, 0.1);
}

/* Badge Icon Wrapper */
.badge-icon-container {
    width: 100px;
    height: 100px;
    background: #f8faff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 45px;
    transition: all 0.4s ease;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.03);
}

.badge-item:hover .badge-icon-container {
    transform: scale(1.1) rotate(5deg);
}

/* Unlocked State */
.badge-item.unlocked {
    background: linear-gradient(135deg, #fffdeb 0%, #ffeaa7 100%);
    border: 2px solid #f1c40f;
    box-shadow: 0 10px 30px rgba(241, 196, 15, 0.25);
    overflow: hidden;
}

/* Subtle glow behind the icon */
.badge-item.unlocked::after {
    content: "";
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(241, 196, 15, 0.3) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

/* Subtle sparkle pattern for unlocked badges */
.badge-item.unlocked::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(#d4af37 0.8px, transparent 0.8px);
    background-size: 18px 18px;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

.badge-item.unlocked .badge-icon-container {
    background: #fff;
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
    border: 4px solid #fff;
    position: relative;
    z-index: 1;
}

.badge-item.unlocked .badge-name,
.badge-item.unlocked .badge-requirement,
.badge-item.unlocked .badge-success {
    position: relative;
    z-index: 1;
}

/* Darker text for readability on gold background */
.badge-item.unlocked .badge-name {
    color: #5d4037;
}

.badge-item.unlocked .badge-requirement {
    color: #795548;
}

/* More vibrant success badge */
.badge-item.unlocked .badge-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(40, 167, 69, 0.2);
}

.badge-item.unlocked:hover {
    border-color: #d4af37;
    background: linear-gradient(135deg, #ffffff 0%, #fff4cc 100%);
    box-shadow: 0 18px 40px rgba(212, 175, 55, 0.35);
}

/* Locked State */
.badge-item.locked {
    background: #fdfdfd;
    cursor: default;
}

.badge-item.locked:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border-color: transparent;
}

.badge-item.locked .badge-icon-container {
    opacity: 0.3;
    background: #f0f0f0;
    position: relative;
}

/* Locker Overlay */
.badge-locker-overlay {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    z-index: 10;
    background: url(../../img/icons/locker-icon.png) no-repeat center center;
    background-size: contain;
    opacity: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.badge-item.locked .badge-name {
    color: #aaa;
}

.badge-item.locked .badge-requirement {
    color: #bbb;
}

/* Badge Text Content */
.badge-name {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--dark);
    margin-bottom: 10px;
    line-height: 1.2;
}

.badge-requirement {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.4;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Progress Section for Locked Badges */
.badge-progress-wrapper {
    width: 100%;
    margin-top: 20px;
}

.badge-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--primary);
}

.badge-progress-bar {
    height: 10px;
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
}

.badge-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #5da2ff);
    border-radius: 10px;
    transition: width 1s ease-out;
}

/* Unlocked Animation */
@keyframes badgePop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    70% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.badge-item.just-unlocked {
    animation: badgePop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ========================================
   RESPONSIVE DESIGN - MEDIA QUERIES
   ======================================== */

/* Tablet & Mobile (992px and below) */
@media (max-width: 992px) {
    .badge-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 20px;
    }

    .badge-icon-container {
        width: 80px;
        height: 80px;
        font-size: 35px;
    }

    .badge-name {
        font-size: 1rem;
    }
}

/* Small Mobile (576px and below) */
@media (max-width: 576px) {
    .badge-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }

    .badge-item {
        padding: 20px 10px;
    }

    .badge-icon-container {
        width: 70px;
        height: 70px;
        font-size: 30px;
    }
}