:root {
    --primary: #4361ee;
    --success: #2ec4b6;
    --warning: #f72585; /* Ny färg för edit/uppmärksamhet */
    --danger: #ef233c;
    --dark: #2b2d42;
    --light: #f8f9fa;
    --white: #ffffff;
    --gray: #8d99ae;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #edf2f4;
    color: var(--dark);
    line-height: 1.5;
    padding-bottom: 50px;
}

header {
    background: linear-gradient(135deg, var(--dark), #1a1c29);
    color: var(--white);
    padding: 1.5rem 1rem;
    text-align: center;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 15px 20px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.03);
}

h2 {
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--gray);
}

input[type="text"], select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid transparent;
    background-color: var(--light);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
}

input[type="text"]:focus, select:focus {
    outline: none;
    background-color: var(--white);
    border-color: var(--primary);
}

/* Custom Slider / Blocks */
.rating-row {
    margin-bottom: 10px;
}

.rating-label {
    font-size: 0.85rem;
    margin-bottom: 3px;
    font-weight: 600;
    display: block;
}

.rating-blocks {
    display: flex;
    gap: 0; /* Kloss an */
    border-radius: 6px;
    overflow: hidden;
    background-color: #e9ecef;
}

.rating-block {
    flex: 1;
    height: 20px;
    background-color: #e9ecef;
    cursor: pointer;
    transition: background-color 0.1s;
    border-right: 1px solid #fff; /* Vit kant mellan rutorna */
}

.rating-block:last-child {
    border-right: none;
}

/* Buttons */
.btn {
    display: block;
    width: 100%;
    padding: 12px 15px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    color: white;
    margin-top: 10px;
}

.btn-sm {
    width: auto;
    padding: 8px 16px;
    font-size: 0.9rem;
    margin-top: 0;
}

.btn:hover {
    opacity: 0.9;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary { background-color: var(--primary); }
.btn-success { background-color: var(--success); }
.btn-warning { background-color: var(--warning); }
.btn-danger { background-color: var(--danger); }
.btn-dark { background-color: var(--dark); }
.btn-text { 
    background: none; 
    color: var(--gray); 
    font-size: 0.8rem; 
    margin-top: 10px;
    border: none;
}

/* Button Group (Method) */
.button-group {
    display: flex;
    gap: 10px;
}

.btn-option {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--light);
    background: var(--white);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--gray);
    transition: all 0.2s;
}

.btn-option.active {
    border-color: var(--primary);
    background-color: #eef2ff; /* Ljusblå tint */
    color: var(--primary);
}

/* Player List */
.player-list {
    list-style: none;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--light);
}

.player-left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
}

.player-select {
    margin-top: 5px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.player-info {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.player-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.player-stats-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.stat-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #ddd;
    white-space: nowrap;
    margin-right: 4px; /* Fristående */
}

.player-actions {
    display: flex;
    gap: 5px;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 8px;
    color: var(--gray);
    transition: color 0.2s;
}

.edit-btn:hover { color: var(--primary); }
.delete-btn:hover { color: var(--danger); }

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.number-input {
    display: flex;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.item-list {
    list-style: none;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--light);
    border-radius: 8px;
    margin-bottom: 8px;
}

.item-name {
    font-weight: 600;
    cursor: pointer;
    flex-grow: 1;
}
.item-name:hover {
    color: var(--primary);
}

.number-input button {
    width: 40px;
    background: var(--primary);
    color: white;
    border: none;
    font-weight: bold;
    cursor: pointer;
    border-radius: 6px;
}

.number-input input {
    width: 50px;
    border: none;
    text-align: center;
    background: transparent;
    font-size: 1.2rem;
    font-weight: bold;
    -moz-appearance: textfield;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--light);
    padding-bottom: 5px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    background: #fff;
    border: 1px solid var(--light);
    padding: 6px 12px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
}

/* Results */
.hidden {
    display: none;
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.group-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.group-header {
    background: var(--primary);
    color: var(--white);
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-avg {
    font-size: 0.8rem;
    font-weight: bold;
    background: rgba(255,255,255,0.2);
    padding: 3px 8px;
    border-radius: 4px;
}

.group-players {
    list-style: none;
    padding: 15px;
}

.group-player-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--light);
}

.group-player-score {
    font-weight: bold;
    color: var(--primary);
}

/* Responsive */
@media (max-width: 600px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* Sort Menu */
.sort-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--white);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 100;
    min-width: 140px;
    overflow: hidden;
    margin-top: 5px;
}

.sort-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 15px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--dark);
    transition: background 0.1s;
}

.sort-option:hover {
    background-color: var(--light);
    color: var(--primary);
}

/* Header Link */
.header-link {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    background-color: rgba(255,255,255,0.15);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.2);
}

.header-link:hover {
    background-color: rgba(255,255,255,0.25);
    color: var(--white);
}

@media (max-width: 600px) {
    .header-link span {
        display: none;
    }

    .header-link {
        left: 10px;
        padding: 8px 12px;
    }

    header h1 {
        font-size: 1.3rem;
        padding: 0 45px;
    }
}