/* Basic Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
}

body {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: transparent;
}

/* Variables */
:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --dark-bg: rgba(20, 20, 20, 0.85);
    --card-bg: rgba(30, 30, 30, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --hover-bg: rgba(255, 255, 255, 0.05);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    --radius: 10px;
}

/* Main Container */
#gang-selection-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#gang-selection-container.active {
    display: block;
    opacity: 1;
    animation: fadeIn 0.3s ease forwards;
}

/* Background */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: -1;
}

/* Main Panel */
.panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 1100px;
    background-color: rgba(15, 15, 15, 0.85);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header {
    padding: 20px 25px;
    background-color: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
}

.main-logo {
    width: 40px;
    height: 40px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    margin-right: 15px;
}

.header-text {
    display: flex;
    flex-direction: column;
}

.panel-header h1 {
    color: white;
    font-size: 1.8rem;
    font-weight: 600;
    line-height: 1;
    margin-bottom: 5px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 100; /* Ensure it's clickable */
}

.close-btn:hover {
    background: rgba(231, 76, 60, 0.7);
}

.panel-subtitle {
    padding: 15px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-subtitle p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    /* Force text to always be visible */
    opacity: 1;
    visibility: visible;
}

/* Gang Grid */
.gang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 25px;
    max-height: 65vh;
    overflow-y: auto;
}

/* Gang Card */
.gang-card {
    background: rgba(30, 30, 30, 0.7);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.gang-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.card-banner {
    height: 80px;
    background-color: var(--gang-color);
    position: relative;
    overflow: hidden;
}

.card-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom right, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.5));
}

.card-content {
    padding: 20px;
    position: relative;
}

.card-logo {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    border: 3px solid white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    position: absolute;
    top: -50px;
    left: 20px;
}

.card-name {
    margin-top: 40px;
    font-size: 1.4rem;
    font-weight: 600;
    color: white;
    margin-bottom: 5px;
}

.card-tag {
    display: inline-block;
    padding: 3px 8px;
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 15px;
}

.card-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.view-btn {
    padding: 8px 15px;
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.view-btn:hover {
    background-color: var(--gang-color);
}

/* Details Modal */
.details-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.details-modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background-color: rgba(25, 25, 25, 0.95);
    width: 90%;
    max-width: 700px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.details-modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 20px;
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.modal-logo {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    margin-right: 15px;
    border: 2px solid white;
}

.modal-title {
    flex: 1;
}

.modal-title h2 {
    color: white;
    font-size: 1.6rem;
    margin-bottom: 5px;
}

.gang-tag {
    display: inline-block;
    padding: 3px 8px;
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    font-size: 0.8rem;
}

.close-modal-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.close-modal-btn:hover {
    background: rgba(231, 76, 60, 0.7);
}

.modal-body {
    padding: 20px;
    color: white;
}

.description-box {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.description-box h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
}

.description-box p {
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
}

.action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

/* Confirmation Modal */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.confirm-modal.active {
    opacity: 1;
    pointer-events: all;
}

.confirm-content {
    background-color: rgba(25, 25, 25, 0.95);
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.confirm-modal.active .confirm-content {
    transform: scale(1);
}

.confirm-header {
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.confirm-header h3 {
    color: white;
    font-size: 1.3rem;
}

.close-confirm-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.close-confirm-btn:hover {
    background: rgba(231, 76, 60, 0.7);
}

.confirm-body {
    padding: 20px;
    color: white;
}

.confirm-body p {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.warning {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(231, 76, 60, 0.1);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
}

.warning i {
    color: #e74c3c;
    font-size: 1.1rem;
}

.confirm-footer {
    padding: 15px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-back {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-back:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.btn-join {
    background-color: var(--gang-color, #3498db);
    color: white;
}

.btn-join:hover {
    filter: brightness(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-cancel {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-cancel:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.btn-confirm {
    background-color: #2ecc71;
    color: white;
}

.btn-confirm:hover {
    background-color: #27ae60;
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
