/* Badge Grid Layout */
.tbm-badge-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 20px 0;
}

/* Badge Flex Layout */
.tbm-badge-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
}

/* Basic Badge Styles */
.badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    border-style: solid;
    border-width: 0;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    
    /* Default color variables */
    --badge-color: #4285f4;
    --badge-text-color: #ffffff;
    --badge-star-color: #FFD700;
    --badge-issuer-color: #ffffff;
    
    /* Background color */
    background-color: var(--badge-color, #4285f4);
}

.badge:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.badge-inner {
    padding: 15px;
    text-align: center;
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Ensure text colors are inherited by inner elements */
    color: var(--badge-text-color, #ffffff);
}

/* Badge Sizes */
.badge-small {
    width: 80px;
    height: 80px;
    font-size: 10px;
}

.badge-medium {
    width: 120px;
    height: 120px;
    font-size: 12px;
}

.badge-large {
    width: 160px;
    height: 160px;
    font-size: 14px;
}

/* Badge Shapes */
.badge-circular {
    border-radius: 50%;
}

.badge-square {
    border-radius: 8px;
}

.badge-hexagonal {
    -webkit-clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.badge-shield {
    -webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 75%, 50% 100%, 0% 75%);
    clip-path: polygon(0% 0%, 100% 0%, 100% 75%, 50% 100%, 0% 75%);
}

/* Badge Content Elements - Explicit color declarations */
.badge .badge-stars {
    margin-bottom: 5px;
    color: var(--badge-star-color, #FFD700) !important;
    font-size: 110%;
    letter-spacing: 2px;
    display: block;
}

.badge .badge-title {
    font-weight: bold;
    margin: 5px 0;
    font-size: 110%;
    line-height: 1.2;
    color: var(--badge-text-color, #ffffff) !important;
    display: block;
}

.badge .badge-issuer {
    font-size: 80%;
    opacity: 0.8;
    color: var(--badge-issuer-color, #ffffff) !important;
    display: block;
}

/* Fix for the stars showing correctly */
.badge .badge-stars .star {
    color: var(--badge-star-color, #FFD700) !important;
    display: inline-block;
}

/* Badge Style Templates */
.badge-template-default {
    background-color: var(--badge-color, #4285f4) !important;
}

.badge-template-gradient {
    background: linear-gradient(to bottom right, var(--badge-color, #4285f4), rgba(0, 0, 0, 0.7)) !important;
}

.badge-template-metallic {
    background: linear-gradient(45deg, 
                             rgba(255, 255, 255, 0.2) 0%, 
                             var(--badge-color, #4285f4) 50%, 
                             rgba(0, 0, 0, 0.2) 100%) !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.badge-template-flat {
    background-color: var(--badge-color, #4285f4) !important;
    box-shadow: none !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
}

.badge-template-neon {
    background-color: #22252f !important;
    box-shadow: 0 0 10px var(--badge-color, #4285f4), 
            0 0 20px var(--badge-color, #4285f4), 
            inset 0 0 15px rgba(255, 255, 255, 0.5) !important;
}

.badge-template-vintage {
    background-color: var(--badge-color, #4285f4) !important;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.badge-template-vintage:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(45deg, rgba(0,0,0,0.05), rgba(0,0,0,0.05) 2px, transparent 2px, transparent 4px);
    pointer-events: none;
    opacity: 0.5;
}

.badge-template-modern {
    background-color: var(--badge-color, #4285f4) !important;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Ensure badge preview in settings shows correct colors */
#tbm-settings-badge-preview .badge-stars {
    color: var(--badge-star-color, #FFD700) !important;
}

#tbm-settings-badge-preview .badge-title {
    color: var(--badge-text-color, #ffffff) !important;
}

#tbm-settings-badge-preview .badge-issuer {
    color: var(--badge-issuer-color, #ffffff) !important;
}

/* Button Styles */
.tbm-view-all-button-container {
    margin-top: 15px;
    text-align: center;
}

.tbm-view-all-button {
    background-color: #4285f4;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s, transform 0.2s;
}

.tbm-view-all-button:hover {
    background-color: #3367d6;
    transform: translateY(-2px);
}

/* Popup Styles */
.tbm-badges-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.tbm-badges-popup-overlay.active {
    display: flex;
}

.tbm-badges-popup-content {
    background: #fff;
    border-radius: 5px;
    padding: 30px;
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.tbm-badges-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.tbm-badges-popup-title {
    margin: 0;
    font-size: 20px;
}

.tbm-badges-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
}

.tbm-badges-popup-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Responsive styles */
@media (max-width: 768px) {
    .tbm-badge-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .tbm-badges-popup-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .tbm-badge-grid {
        grid-template-columns: repeat(1, 1fr) !important;
    }
}

/* Prevent body scroll when popup is open */
body.tbm-popup-open {
    overflow: hidden;
}

/* Fix for admin color picker */
.wp-picker-container {
    display: inline-block;
}

.wp-color-result {
    margin: 0 6px 0 0 !important;
}