/* Container */
.tag-wrapper { max-width: 1200px; margin: 40px auto; padding: 0 15px; font-family: sans-serif; }

/* Centralized Controls */
.tag-controls { 
    display: flex; 
    justify-content: center; 
    align-items: center;
    gap: 15px; 
    margin-bottom: 40px; 
    flex-wrap: wrap; 
}

/* Search Wrapper & Icons */
.tag-search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.tag-icon-search {
    position: absolute;
    left: 12px;
    color: #888;
    font-size: 18px;
    pointer-events: none;
}

.tag-icon-clear {
    position: absolute;
    right: 12px;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s;
}

.tag-icon-clear:hover { color: #cc0000; }

#tag-search { 
    width: 240px; 
    padding: 10px 35px 10px 40px !important; 
    border: 1px solid #ddd; 
    border-radius: 30px; 
    font-size: 14px;
    outline: none;
    height: 44px;
    box-sizing: border-box;
}

#tag-filter {
    padding: 0 20px;
    border: 1px solid #ddd;
    border-radius: 30px;
    height: 44px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    min-width: 180px;
}

/* Grid & Cards */
.tag-grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 30px; 
}

.tag-card { 
    position: relative; 
    aspect-ratio: 4 / 5; 
    display: flex;
    flex-direction: column;
    justify-content: flex-end; 
    background-color: #f5f5f5;
    overflow: hidden;
    border-radius: 15px; 
}

.tag-image-area { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    background-size: cover; background-position: center; 
    z-index: 1;
}

.tag-info { 
    position: relative;
    z-index: 2;
    background: #04140C; 
    color: #ffffff; 
    text-align: center; 
    padding: 18px 10px;
    width: 100%;
    box-sizing: border-box;
}

p.tag-name { 
    margin: 0 !important; 
    font-size: 18px !important; 
    font-weight: 800 !important; 
    text-transform: uppercase;
    line-height: 1.1;
}

.tag-role { 
    font-size: 11px; 
    text-transform: uppercase; 
    margin-top: 5px; 
    letter-spacing: 1px;
    opacity: 0.8;
}

/* Pagination */
.tag-pagination { display: flex; justify-content: center; gap: 10px; margin-top: 40px; }
.tag-page-btn { 
    border: 1px solid #eee; 
    background: #fff; 
    cursor: pointer; 
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    font-weight: bold;
}
.tag-page-btn.active { background: #04140C; color: #fff; border-color: #04140C; }

/* Mobile View Fixes */
@media (max-width: 768px) {
    .tag-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .tag-info { padding: 12px 5px; }
    p.tag-name { font-size: 14px !important; }
    .tag-role { font-size: 10px; }
}

@media (max-width: 480px) {
    .tag-controls { flex-direction: column; }
    .tag-search-container, #tag-filter { width: 100%; max-width: 280px; }
    #tag-search { width: 100%; }
}