/* Import Google Font Fredoka */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&display=swap');

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

body {
    font-family: 'Fredoka', sans-serif;
    background: linear-gradient(135deg, #00d2ff, #3a7bd5, #ff7e5f, #feb47b);
    background-size: 400% 400%;
    animation: gradientBG 12s ease infinite;
    color: #ffffff;
    min-height: 100vh;
    padding: 15px;
    overflow-x: hidden;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 120px; 
}

.header-title {
    text-align: center;
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 15px;
    margin-top: 15px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.3);
}

.domain-text {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    background: rgba(0,0,0,0.2);
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    margin-bottom: 25px;
    letter-spacing: 1px;
}

.center-box {
    text-align: center;
}

/* =========================================
   KAD PASUKAN (GLASSMORPHISM)
========================================= */
.glass-card {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 20px;
    margin-bottom: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--team-color, transparent);
    opacity: 0.15;
    z-index: -1;
    border-radius: 20px;
}

.glass-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.3);
}

.team-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.rank {
    font-size: 1.2rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.3);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.team-logo {
    font-size: 2.5rem;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}

.team-name {
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.2;
}

.team-score {
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.4);
    text-align: right;
    transition: 0.3s ease;
}

/* Effect butang untuk markah yang boleh diklik */
.team-score.clickable {
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    padding: 5px 15px;
    border-radius: 15px;
    border: 2px dashed rgba(255,255,255,0.6);
}

.team-score.clickable:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
    border-style: solid;
}

.pts {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.9;
}

/* =========================================
   POP-UP MODAL (MARKAH TERPERINCI)
========================================= */
.modal-overlay {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100vw !important; height: 100vh !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999999 !important;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    display: flex !important;
    opacity: 1;
}

.modal-content {
    background: rgba(30, 40, 60, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.5);
    padding: 30px;
    border-radius: 25px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.6);
    transform: translateY(50px) scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-overlay.show .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    padding-bottom: 15px;
    color: white;
}

.score-row {
    display: flex;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.15);
    padding: 15px 20px;
    border-radius: 15px;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 1.1rem;
    color: white;
    transition: 0.2s;
}

.score-row:hover {
    background: rgba(255,255,255,0.3);
    transform: translateX(5px);
}

.close-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 15px;
    font-family: inherit;
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 25px;
    cursor: pointer;
    transition: 0.3s;
}

.close-btn:hover {
    background: #ff6b81;
    transform: translateY(-2px);
}

/* =========================================
   GAYA ADMIN PANEL
========================================= */
.admin-tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-bottom: 25px; }
.tab-btn { background: rgba(255, 255, 255, 0.2); color: white; text-decoration: none; padding: 10px 18px; border-radius: 20px; font-weight: 600; backdrop-filter: blur(5px); transition: 0.3s; font-size: 0.95rem; }
.tab-btn.active, .tab-btn:hover { background: #ff7e5f; box-shadow: 0 4px 15px rgba(255, 126, 95, 0.5); transform: translateY(-2px); }

.admin-card { display: block; }
.admin-card .team-info { justify-content: center; margin-bottom: 20px; }
.admin-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.input-group { display: flex; flex-direction: column; align-items: center; width: 100%; }
.input-group label { font-size: 0.8rem; font-weight: 600; margin-bottom: 6px; text-align: center; width: 100%; white-space: normal; word-wrap: break-word; line-height: 1.1; min-height: 28px; display: flex; align-items: center; justify-content: center; }

input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

.admin-grid input[type="number"], .form-input { width: 100%; padding: 10px; border-radius: 12px; border: none; background: rgba(255, 255, 255, 0.9); font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 1.2rem; color: #222; outline: none; transition: 0.3s; text-align: center; }
input:focus { background: #ffffff; box-shadow: 0 0 10px rgba(255, 255, 255, 0.8); }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.settings-group { display: flex; flex-direction: column; }
.settings-group label { font-weight: 600; margin-bottom: 5px; font-size: 0.9rem; }

.crud-form { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 10px; align-items: center; }
input[type="color"] { width: 100%; height: 45px; border: none; border-radius: 12px; cursor: pointer; background: transparent; }

.btn { padding: 12px 15px; border: none; border-radius: 12px; font-family: 'Fredoka', sans-serif; font-weight: 700; cursor: pointer; transition: 0.3s; font-size: 1rem; width: 100%; }
.btn-primary { background: linear-gradient(45deg, #ff9a9e, #fecfef); color: #d8345f; box-shadow: 0 5px 15px rgba(0,0,0,0.2); }
.btn-danger { background: #ff4757; color: white; }
.btn-success { background: #2ed573; color: white; }
.btn-submit-large { display: block; width: 100%; padding: 18px; border-radius: 15px; font-size: 1.3rem; margin-top: 25px; }

.alert-box { background: rgba(46, 204, 113, 0.9); color: white; padding: 15px; border-radius: 15px; text-align: center; font-weight: 600; margin-bottom: 25px; }
.nav-link { display: inline-block; color: white; text-decoration: none; font-weight: 600; border-bottom: 2px dashed rgba(255,255,255,0.5); padding-bottom: 2px; }

/* =========================================
   RESPONSIF MOBILE
========================================= */
@media (max-width: 600px) {
    .glass-card { padding: 15px; }
    .glass-card:not(.admin-card) { flex-direction: column; text-align: center; }
    .team-info { flex-direction: column; gap: 8px; }
    .admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .crud-form { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .header-title { font-size: 1.8rem; }
    .tab-btn { width: 100%; text-align: center; }
}