:root {
    --pool-columns: 4;
    --bg-color: #0b1326;
    --surface: #171f33;
    --surface-glass: rgba(23, 31, 51, 0.6);
    --text-primary: #dae2fd;
    --text-secondary: #aeb9d0;
    --accent: #fbbf24;
    --border-color: rgba(255, 255, 255, 0.1);
    
    --tier-s: #eab308; /* Metallic Gold */
    --tier-a: #0ea5e9; /* Electric Blue */
    --tier-b: #ec4899; /* VNL Fuchsia */
    --tier-c: #10b981; /* Neon Green */
    --tier-d: #94a3b8; /* Silver */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: var(--surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: -1px;
    color: var(--accent);
}

.filters {
    display: flex;
    gap: 16px;
    align-items: center;
}

select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

select option {
    background: var(--surface);
    color: var(--text-primary);
}

.btn-primary {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #402d00;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(251, 191, 36, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.5);
}

.container {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.tier-list-board {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-color);
    padding: 10px;
    border-radius: 8px;
}

.tier-row {
    display: flex;
    min-height: 160px;
    background: var(--surface-glass);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.tier-label {
    width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 900;
    color: #111;
    border-right: 1px solid var(--bg-color);
    flex-shrink: 0;
    outline: none;
    user-select: none;
    cursor: default;
    text-shadow: 0 1px 2px rgba(255,255,255,0.2);
}

.tier-label.tier-S { background-color: var(--tier-s); }
.tier-label.tier-A { background-color: var(--tier-a); }
.tier-label.tier-B { background-color: var(--tier-b); }
.tier-label.tier-C { background-color: var(--tier-c); }
.tier-label.tier-D { background-color: var(--tier-d); }

.tier-content {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    min-height: 100%;
}

.pool-container {
    background: var(--surface-glass);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    backdrop-filter: blur(16px);
}

.pool-container h3 {
    margin-bottom: 20px;
    font-size: 18px;
    color: var(--text-secondary);
    font-weight: 600;
}


.player-pool {
    flex: 1;
    overflow-y: auto;
    max-height: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-content: start;
    padding: 10px;
}


.player-pool::-webkit-scrollbar { width: 8px; }
.player-pool::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 4px; }
.player-pool::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

/* Player Cards - Bigger */
.player-card {
    width: 80px;
    height: 80px;
    
    position: relative;
    cursor: grab;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.player-card:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 15px rgba(0,0,0,0.5);
    z-index: 10;
}

.player-card:active {
    cursor: grabbing;
}

.player-card > img:not(.emoji) {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background-color: #ffffff;
}

.player-flag {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 16px;
    z-index: 2;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.8));
    pointer-events: none;
}

.player-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.75); /* Best practice: html2canvas hates linear-gradients, solid semi-transparent works perfectly */
    padding: 4px;
    text-align: center;
    pointer-events: none;
    z-index: 2;
}

.player-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 1px 1px 2px #000;
}

/* Hover Overlay for Extra Info */
.player-hover-info {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 3;
    padding-bottom: 20px; /* Leave space for the name */
}

.player-card:hover .player-hover-info {
    opacity: 1;
}

.hover-pos {
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 4px;
}

.hover-team {
    color: #fff;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sortable-ghost {
    opacity: 0.4;
    background-color: var(--surface);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(11, 19, 38, 0.9);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--surface-glass);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #fff;
}

#modalImg {
    width: 380px;
    height: 380px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    background-color: #ffffff;
}

.modal-info {
    width: 100%;
}

#modalName {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
}

.modal-details {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
}

.modal-badge {
    background: rgba(255,255,255,0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

.zoom-icon {
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.8;
}

.player-hover-info {
    cursor: pointer;
}

.modal-stats {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
    width: 100%;
}

.stat-label {
    color: var(--accent);
    font-weight: 700;
    margin-right: 5px;
}

.search-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
    width: 250px;
    backdrop-filter: blur(10px);
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.2);
}

/* Desktop Layout (Split Screen) */
.container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    max-width: 98%; /* Ekranı tam kaplasın */
}

.tier-list-board {
    flex: 2; /* 3'ten 2'ye düşürüldü, havuza yer açıldı */
    width: 100%;
}

.pool-container {
    flex: 1; /* 2:1 oran ile sağ taraf eskisine göre daha geniş */
    position: sticky;
    top: 90px;
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}


.player-pool {
    flex: 1;
    overflow-y: auto;
    max-height: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-content: start;
    padding: 10px;
}


/* Modal Action Buttons */
.modal-actions {
    margin-top: 20px;
    width: 100%;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

.modal-action-title {
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--text-secondary);
}

.tier-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 10px;
}

.btn-tier {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    color: #000;
}

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

.btn-S { background-color: var(--tier-s); }
.btn-A { background-color: var(--tier-a); }
.btn-B { background-color: var(--tier-b); }
.btn-C { background-color: var(--tier-c); }
.btn-D { background-color: var(--tier-d); }
.btn-pool { background-color: #334155; color: #fff; width: 100%; margin-top: 5px; }

/* Mobile Responsive */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }
    
    .pool-container {
        position: static;
        height: auto;
        width: 100%;
    }
    
    
.player-pool {
    flex: 1;
    overflow-y: auto;
    max-height: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-content: start;
    padding: 10px;
}

    
    .topbar {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .filters {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .tier-label {
        width: 80px;
        font-size: 24px;
    }
    
    .player-card {
        width: 100px;
        height: 100px;
    }
    
    #modalImg {
        width: 250px;
        height: 250px;
    }
}

/* Override for flex-fill layout */
.tier-list-board {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.tier-row {
    flex: 1;
    min-height: 100px;
}

.tier-row .player-card {
    width: 110px;
    height: 110px;
}

.player-pool .player-card {
    width: var(--pool-card-size, 80px);
    height: var(--pool-card-size, 80px);
}


/* Twemoji Styles */
img.emoji {
    height: 1em;
    width: 1em;
    margin: 0 .05em 0 .1em;
    vertical-align: -0.1em;
}

/* Export Mode (Desktop override for html2canvas) */
body.export-mode .tier-list-board {
    width: 1200px !important;
    max-width: 1200px !important;
    min-width: 1200px !important;
}
body.export-mode .tier-row {
    min-height: 120px !important;
}
body.export-mode .tier-label {
    width: 100px !important;
    font-size: 48px !important;
}
body.export-mode .tier-row .player-card {
    width: 110px !important;
    height: 110px !important;
}
body.export-mode .player-info {
    font-size: 10px !important;
    padding: 4px !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        gap: 15px;
    }
    .topbar {
        padding: 15px;
        flex-direction: column;
        gap: 15px;
        position: relative;
    }
    .filters {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    .search-input, select, .btn-primary, #resetBtn {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .tier-row {
        min-height: 70px;
    }
    .tier-label {
        width: 60px;
        font-size: 28px;
    }
    .tier-row .player-card {
        width: 60px;
        height: 60px;
    }
    .player-info {
        font-size: 8px;
        padding: 2px;
    }
    
    .pool-container {
        padding-top: 10px;
    }
    .zoom-controls {
        display: none !important; /* Hide zoom on mobile to keep it simple */
    }
}

/* Split Button Dropdown */
.split-btn-group {
    display: flex;
    position: relative;
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(251, 191, 36, 0.3);
}

.split-btn-group .btn-primary {
    box-shadow: none; /* Remove individual shadows */
    margin: 0;
}

#exportBtn {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    padding-right: 16px;
}

#exportDropdownBtn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding: 10px 12px;
    border-left: 1px solid rgba(0,0,0,0.1);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    min-width: 220px;
    z-index: 1000;
    flex-direction: column;
    overflow: hidden;
}

.dropdown-menu.show {
    display: flex;
}

.dropdown-menu a {
    color: var(--text-primary);
    text-decoration: none;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-menu a:hover {
    background: rgba(255,255,255,0.05);
}
