/* ============================
   GLOBAL RESET & BASE
============================ */

body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f3f4f6;
    color: #111827;
    padding-top: 110px;
}

a {
    text-decoration: none;
    color: inherit;
}

h1, h2, h3 {
    margin: 0 0 16px;
    font-weight: 600;
    color: #111827;
}

/* ============================
   NAVIGATION
============================ */

.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 99999;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    height: 80px;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-title {
    font-size: 24px;
    font-weight: 700;
}

.logo-subtitle {
    font-size: 13px;
    color: #6b7280;
}

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

.nav-link {
    font-size: 15px;
    color: #374151;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: 0.15s;
}

.nav-link:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.nav-link.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
    font-weight: 600;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-box {
    position: relative;
    cursor: pointer;
}

.user-name {
    font-size: 15px;
    font-weight: 600;
}

.user-name small {
    font-size: 12px;
    color: #6b7280;
}

.user-menu {
    display: none;
    position: absolute;
    top: 110%;
    right: 0;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.user-box:hover .user-menu {
    display: block;
}

.user-menu a {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
}

.user-menu a:hover {
    background: #f3f4f6;
}

/* ============================
   DASHBOARD LAYOUT
============================ */

.dashboard-wrapper {
    max-width: 1200px;
    margin: 0 auto 40px auto;
    padding: 0 10px;
}

.dashboard-columns {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.dashboard-left {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.dashboard-right {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (max-width: 900px) {
    .dashboard-left {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .dashboard-left {
        grid-template-columns: 1fr;
    }
}

/* ============================
   HEADER CARD
============================ */

.tournament-header-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 22px;
    border-radius: 12px;
    margin: 20px auto 25px auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    max-width: 1200px;
}

.t-header-status {
    font-size: 14px;
    opacity: 0.75;
    margin-bottom: 6px;
}

.t-header-title {
    font-size: 26px;
    font-weight: 700;
}

.t-header-row {
    display: flex;
    gap: 15px;
    font-size: 15px;
    margin-top: 6px;
    color: #374151;
}

/* ============================
   DASHBOARD CARDS
============================ */

.dash-card {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 18px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.dash-stat-row {
    display: flex;
    justify-content: space-between;
    margin: 6px 0;
}

/* ============================
   PLAYER LIST
============================ */

.player-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #e5e7eb;
}

.player-name {
    flex-grow: 1;
}

.remove-btn {
    background: #4b5563;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.remove-btn:hover {
    background: #b91c1c;
}

/* ============================
   AUTOCOMPLETE
============================ */

.autocomplete-wrapper {
    position: relative;
    margin-top: 8px;
}

.autocomplete-wrapper input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 14px;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #111827;
    border: 1px solid #374151;
    border-radius: 0 0 6px 6px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 99999;
    display: none;
}

.autocomplete-item {
    padding: 8px 10px;
    cursor: pointer;
    color: #f9fafb;
    font-size: 14px;
}

.autocomplete-item:hover {
    background: #1f2937;
}

.autocomplete-item.add-new {
    font-weight: 600;
    background: #e0f2fe;
}

/* ============================
   SUPERADMIN ACTION BUTTONS
============================ */

.admin-actions {
    display: flex;
    gap: 8px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    color: white;
    white-space: nowrap;
    transition: 0.15s ease;
}

.admin-btn.info {
    background: #2563eb;
}
.admin-btn.info:hover {
    background: #1d4ed8;
}

.admin-btn.warn {
    background: #f59e0b;
}
.admin-btn.warn:hover {
    background: #d97706;
}

.admin-btn.danger {
    background: #dc2626;
}
.admin-btn.danger:hover {
    background: #b91c1c;
}

.admin-btn.delete {
    background: #7f1d1d;
}
.admin-btn.delete:hover {
    background: #641515;
}

/* ============================
   PLAYER HOVER CARD
============================ */

.player-hover-card {
    position: absolute;
    background: #1f2937;
    color: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
    z-index: 999999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
/* GRID KORTEILLE */
.tournament-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin: 20px 0 40px;
}

/* KOKO KORTTI */
.tournament-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 14px 14px 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

/* KÄYNNISSÄ / PÄÄTTYNYT VÄRIRAITA */
.tournament-card.ongoing {
    border-left: 4px solid #16a34a;
}
.tournament-card.finished {
    border-left: 4px solid #6b7280;
}

/* KORTIN RUNKO */
.t-card-body {
    display: grid;
    grid-template-columns: 1fr;
    row-gap: 6px;
    font-size: 14px;
}

/* RIVIT KORTIN SISÄLLÄ */
.t-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* LABEL + VALUE */
.t-label {
    width: 20px;
    flex-shrink: 0;
    text-align: center;
}
.t-value {
    flex: 1;
}

/* FOOTER (NAPIT) */
.t-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.t-card-footer form {
    margin: 0;
}

.t-card-footer button,
.signup-btn,
.cancel-btn {
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

/* STATUS-BADGE KORTIN ALALAIDASSA */
.tournament-status {
    margin-top: 6px;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 8px;
    background: #ecfdf3;
}
.tournament-status.finished {
    background: #f3f4f6;
}
.btn {
    padding: 8px 16px;
    background: #2563eb;
    color: white;
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #1d4ed8;
    transition: 0.15s ease;
}

.btn:hover {
    background: #1d4ed8;
}
/* Modal overlay */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Modal box */
.modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    width: 350px;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.autocomplete-results {
    position: absolute;
    background: white;
    border: 1px solid #d1d5db;
    width: 100%;
    z-index: 999999999;
    max-height: 250px;
    overflow-y: auto;
}
.autocomplete-wrapper {
    position: relative;
}

