/* =========================================================
   fpl-database.css — FPL Players & Teams Database
========================================================= */

/* ---------- Controls ---------- */
.fpl-controls{
    display:flex;
    flex-direction:column;
    gap:10px;
    background:linear-gradient(135deg, #22154a 0%, #180e36 100%);
    border:2px solid #3d2666;
    border-radius:16px;
    padding:14px;
    margin-bottom:14px;
    box-shadow:0 4px 15px rgba(0,0,0,.3);
}

.fpl-view-toggle{
    display:flex;
    justify-content:center;
    gap:6px;
    background:rgba(0,0,0,.25);
    padding:4px;
    border-radius:50px;
}

.fpl-view-btn{
    flex:1;
    padding:9px 18px;
    background:transparent;
    color:#a89cc8;
    border:none;
    border-radius:50px;
    font-size:12px;
    font-weight:900;
    letter-spacing:1.5px;
    text-transform:uppercase;
    cursor:pointer;
    transition:all .25s ease;
    font-family:inherit;
}

.fpl-view-btn.active{
    background:linear-gradient(135deg, #00e5ff 0%, #7c4dff 100%);
    color:#fff;
    box-shadow:0 4px 12px rgba(0,229,255,.35);
}

.fpl-search-row{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
}

.fpl-search{
    flex:1;
    min-width:160px;
    padding:11px 16px;
    background:#180e36;
    border:2px solid #3d2666;
    border-radius:50px;
    color:#fff;
    font-size:13px;
    font-weight:600;
    outline:none;
    font-family:inherit;
    transition:all .25s ease;
    direction:rtl;
    text-align:right;
}

.fpl-search::placeholder{ color:#7a6b9c; }
.fpl-search:focus{
    border-color:#00e5ff;
    box-shadow:0 0 0 3px rgba(0,229,255,.15);
}

.fpl-select{
    padding:11px 30px 11px 14px;
    background:#180e36;
    border:2px solid #3d2666;
    border-radius:50px;
    color:#fff;
    font-size:12px;
    font-weight:800;
    outline:none;
    cursor:pointer;
    font-family:inherit;
    appearance:none;
    -webkit-appearance:none;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2300e5ff' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
    background-repeat:no-repeat;
    background-position:right 12px center;
    transition:border-color .25s ease;
}

.fpl-select:focus{ border-color:#00e5ff; }
.fpl-select option{ background:#2d0a3d; color:#fff; }

.fpl-filter-row{
    display:flex;
    gap:8px;
    align-items:center;
    flex-wrap:wrap;
}

.fpl-position-filters{
    display:flex;
    gap:5px;
    flex:1;
    min-width:200px;
}

.fpl-pos-btn{
    flex:1;
    padding:8px 6px;
    background:#180e36;
    color:#a89cc8;
    border:2px solid #3d2666;
    border-radius:50px;
    font-size:11px;
    font-weight:900;
    letter-spacing:.5px;
    cursor:pointer;
    transition:all .2s ease;
    font-family:inherit;
    outline:none;
}

.fpl-pos-btn.active{
    background:linear-gradient(135deg, #00e5ff 0%, #7c4dff 100%);
    color:#fff;
    border-color:#00e5ff;
    box-shadow:0 4px 12px rgba(0,229,255,.3);
}

/* ---------- Summary ---------- */
.fpl-summary{
    text-align:center;
    padding:10px;
    margin-bottom:12px;
    background:rgba(0,229,255,.08);
    border:1px solid rgba(0,229,255,.25);
    border-radius:12px;
    color:#00e5ff;
    font-size:12px;
    font-weight:800;
    letter-spacing:1px;
}

.fpl-summary span{
    color:#fff;
    margin:0 4px;
}

/* ---------- Players list ---------- */
.fpl-content{
    display:flex;
    flex-direction:column;
    gap:8px;
}

.fpl-player-row{
    display:grid;
    grid-template-columns:44px 44px 1fr 52px 60px;
    gap:10px;
    align-items:center;
    padding:10px 12px;
    background:linear-gradient(135deg, #22154a 0%, #180e36 100%);
    border:1px solid #3d2666;
    border-radius:12px;
    cursor:pointer;
    transition:all .2s ease;
}

.fpl-player-row:hover{
    border-color:#00e5ff;
    transform:translateX(-4px);
    box-shadow:0 6px 18px rgba(0,229,255,.2);
}

.fpl-player-photo{
    width:44px;
    height:44px;
    border-radius:50%;
    background:#0f0a2e;
    overflow:hidden;
    position:relative;
    flex-shrink:0;
}

.fpl-player-photo img{
    position:absolute;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    width:100%;
    height:100%;
    object-fit:cover;
    object-position:top center;
}

.fpl-player-photo-empty{
    width:100%;
    height:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    color:#a89cc8;
    font-size:14px;
    font-weight:900;
}

.fpl-player-team-badge{
    width:44px;
    height:44px;
    display:flex;
    align-items:center;
    justify-content:center;
    flex-shrink:0;
}

.fpl-player-team-badge img{
    max-width:100%;
    max-height:100%;
    object-fit:contain;
    filter:drop-shadow(0 2px 4px rgba(0,0,0,.5));
}

.fpl-player-names{
    min-width:0;
    overflow:hidden;
    text-align:right;
}

.fpl-player-name{
    font-size:13px;
    font-weight:900;
    color:#fff;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    line-height:1.2;
}

.fpl-player-sub{
    font-size:10px;
    color:#a89cc8;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    line-height:1.2;
    margin-top:2px;
}

.fpl-pos-badge{
    display:inline-block;
    padding:2px 6px;
    border-radius:4px;
    font-size:9px;
    font-weight:900;
    letter-spacing:.5px;
    margin-left:4px;
}

.fpl-pos-GK{ background:rgba(255,183,0,.2); color:#ffb700; }
.fpl-pos-DEF{ background:rgba(0,180,255,.2); color:#00b4ff; }
.fpl-pos-MID{ background:rgba(0,230,118,.2); color:#00e676; }
.fpl-pos-FWD{ background:rgba(255,82,82,.2); color:#ff5252; }

.fpl-player-price{
    text-align:center;
    font-size:13px;
    font-weight:900;
    color:#ffd700;
    letter-spacing:.5px;
}

.fpl-player-points{
    text-align:center;
    font-size:15px;
    font-weight:900;
    color:#00e5ff;
    letter-spacing:.5px;
}

.fpl-player-points small{
    display:block;
    font-size:8px;
    color:#7a6b9c;
    font-weight:800;
    letter-spacing:1px;
    margin-top:2px;
}

/* ---------- Teams Grid ---------- */
.fpl-teams-grid{
    display:grid;
    grid-template-columns:repeat(auto-fill, minmax(140px, 1fr));
    gap:10px;
}

.fpl-team-card{
    background:linear-gradient(135deg, #22154a 0%, #180e36 100%);
    border:2px solid #3d2666;
    border-radius:14px;
    padding:16px 10px;
    text-align:center;
    cursor:pointer;
    transition:all .25s ease;
}

.fpl-team-card:hover{
    border-color:#00e5ff;
    transform:translateY(-4px);
    box-shadow:0 8px 22px rgba(0,229,255,.25);
}

.fpl-team-card-badge{
    width:60px;
    height:60px;
    margin:0 auto 10px;
    display:flex;
    align-items:center;
    justify-content:center;
}

.fpl-team-card-badge img{
    max-width:100%;
    max-height:100%;
    object-fit:contain;
    filter:drop-shadow(0 3px 6px rgba(0,0,0,.5));
}

.fpl-team-card-name{
    font-size:13px;
    font-weight:900;
    color:#fff;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    margin-bottom:4px;
}

.fpl-team-card-count{
    font-size:10px;
    font-weight:800;
    color:#00e5ff;
    letter-spacing:1px;
}

/* ---------- Modal ---------- */
#fplModal{
    display:none;
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.85);
    z-index:99999;
    align-items:center;
    justify-content:center;
    padding:16px;
    backdrop-filter:blur(6px);
    opacity:0;
    transition:opacity .25s ease;
}

#fplModal.show{
    display:flex;
    opacity:1;
}

.fpl-modal-box{
    background:linear-gradient(135deg, #22154a 0%, #180e36 100%);
    border:3px solid #00e5ff;
    border-radius:20px;
    width:100%;
    max-width:420px;
    max-height:88vh;
    overflow-y:auto;
    padding:22px 20px;
    position:relative;
    animation:fplModalIn .3s cubic-bezier(.4,0,.2,1);
    box-shadow:0 20px 60px rgba(0,229,255,.25);
}

@keyframes fplModalIn{
    from{opacity:0;transform:translateY(20px) scale(.95);}
    to{opacity:1;transform:translateY(0) scale(1);}
}

.fpl-modal-close{
    position:absolute;
    top:12px;
    right:12px;
    width:32px;
    height:32px;
    border-radius:50%;
    background:rgba(255,255,255,.1);
    border:none;
    color:#fff;
    font-size:16px;
    font-weight:900;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
    transition:all .2s ease;
    z-index:5;
}

.fpl-modal-close:hover{
    background:#ff5252;
    transform:scale(1.1) rotate(90deg);
}

.fpl-modal-header{
    display:flex;
    align-items:center;
    gap:14px;
    margin-bottom:16px;
}

.fpl-modal-photo{
    width:80px;
    height:80px;
    border-radius:50%;
    background:#0f0a2e;
    overflow:hidden;
    position:relative;
    flex-shrink:0;
    border:3px solid #00e5ff;
}

.fpl-modal-photo img{
    position:absolute;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    width:100%;
    height:100%;
    object-fit:cover;
    object-position:top center;
}

.fpl-modal-info{
    flex:1;
    min-width:0;
    text-align:right;
}

.fpl-modal-name{
    font-size:20px;
    font-weight:900;
    color:#fff;
    line-height:1.1;
    margin-bottom:4px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.fpl-modal-realname{
    font-size:11px;
    color:#a89cc8;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    margin-bottom:6px;
}

.fpl-modal-tags{
    display:flex;
    gap:6px;
    flex-wrap:wrap;
    justify-content:flex-end;
}

.fpl-modal-tag{
    padding:3px 10px;
    border-radius:50px;
    font-size:10px;
    font-weight:900;
    letter-spacing:.5px;
    border:1px solid;
}

.fpl-modal-team-tag{
    display:inline-flex;
    align-items:center;
    gap:5px;
    padding:3px 10px;
    background:rgba(255,255,255,.08);
    border:1px solid rgba(255,255,255,.15);
    border-radius:50px;
    color:#fff;
    font-size:10px;
    font-weight:900;
}

.fpl-modal-team-tag img{
    width:16px;
    height:16px;
    object-fit:contain;
}

.fpl-modal-stats{
    display:grid;
    grid-template-columns:1fr 1fr 1fr;
    gap:8px;
    margin-bottom:16px;
}

.fpl-stat-box{
    background:rgba(0,0,0,.25);
    border:1px solid rgba(0,229,255,.2);
    border-radius:12px;
    padding:11px 6px;
    text-align:center;
}

.fpl-stat-label{
    font-size:9px;
    font-weight:800;
    color:#a89cc8;
    letter-spacing:1px;
    text-transform:uppercase;
    margin-bottom:5px;
}

.fpl-stat-value{
    font-size:18px;
    font-weight:900;
    color:#00e5ff;
    line-height:1;
}

.fpl-stat-value.gold{ color:#ffd700; }
.fpl-stat-value.green{ color:#00e676; }
.fpl-stat-value.red{ color:#ff5252; }

.fpl-modal-details{
    display:flex;
    flex-direction:column;
    gap:6px;
    border-top:1px solid rgba(124,77,255,.2);
    padding-top:14px;
}

.fpl-detail-row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:7px 12px;
    background:rgba(0,0,0,.2);
    border-radius:8px;
    font-size:12px;
    direction:rtl;
}

.fpl-detail-label{
    color:#a89cc8;
    font-weight:700;
}

.fpl-detail-value{
    color:#fff;
    font-weight:900;
    font-size:13px;
}

/* ---------- Loading/Error ---------- */
.fpl-loading, .fpl-error{
    text-align:center;
    padding:50px 20px;
    background:linear-gradient(135deg, #22154a 0%, #180e36 100%);
    border-radius:14px;
    border:2px solid #3d2666;
    color:#00e5ff;
    font-size:13px;
    font-weight:800;
    letter-spacing:1px;
}

.fpl-error{
    color:#ff5252;
    border-color:rgba(255,82,82,.4);
}

.fpl-loading .spinner{
    display:inline-block;
    width:36px;
    height:36px;
    border:4px solid rgba(0,229,255,.15);
    border-top-color:#00e5ff;
    border-radius:50%;
    animation:spin .8s linear infinite;
    margin-bottom:12px;
}

.fpl-empty{
    text-align:center;
    padding:40px 20px;
    color:#7a6b9c;
    font-size:13px;
    font-weight:700;
}

/* ---------- Responsive ---------- */
@media(max-width:480px){
    .fpl-player-row{
        grid-template-columns:38px 38px 1fr 44px 52px;
        gap:8px;
        padding:9px 10px;
    }
    .fpl-player-photo,
    .fpl-player-team-badge{
        width:38px;
        height:38px;
    }
    .fpl-player-name{ font-size:12px; }
    .fpl-player-points{ font-size:14px; }
    .fpl-player-price{ font-size:12px; }
    .fpl-teams-grid{
        grid-template-columns:repeat(auto-fill, minmax(110px, 1fr));
        gap:8px;
    }
    .fpl-team-card-badge{ width:48px; height:48px; }
    .fpl-team-card-name{ font-size:12px; }
    .fpl-modal-name{ font-size:17px; }
    .fpl-modal-photo{ width:70px; height:70px; }
    .fpl-stat-value{ font-size:16px; }
}
