/* --- Custom Design Settings --- */
:root {
    --glow-color: #38bdf8;
    --bg-dark: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --pitch-line: rgba(255, 255, 255, 0.2);
}

body {
    background-color: var(--bg-dark);
    color: #e2e8f0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-color: rgba(255, 255, 255, 0.1);
}

#editor-view .glass-panel {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(15, 23, 42, 0.98);
}

/* Sidebar Item Styles */
.nav-item {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.nav-item.active {
    background: rgba(56, 189, 248, 0.15);
    color: var(--glow-color);
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.25);
}

.nav-item:not(.active):hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1);
}

.nav-item.inactive {
    color: #64748b;
}

/* Das Spielfeld */
.pitch-container {
    position: relative;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border: 2px solid var(--pitch-line);
    border-radius: 8px;
    overflow: hidden;
    perspective: 1000px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    cursor: default;
}

/* Spielfeld Linien */
.pitch-lines {
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 10px;
    right: 10px;
    border: 2px solid var(--pitch-line);
    pointer-events: none;
}

.pitch-center-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--pitch-line);
    transform: translateY(-50%);
}

.pitch-center-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    border: 2px solid var(--pitch-line);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.pitch-box-top {
    position: absolute;
    top: 0;
    left: 50%;
    width: 40%;
    height: 15%;
    border: 2px solid var(--pitch-line);
    border-top: none;
    transform: translateX(-50%);
}

.pitch-box-bottom {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 40%;
    height: 15%;
    border: 2px solid var(--pitch-line);
    border-bottom: none;
    transform: translateX(-50%);
}

/* Spieler Knoten */
.position-node {
    position: absolute;
    width: 4.5rem;
    height: 3.5rem;
    transform: translate(-50%, -50%);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid #475569;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.position-node:hover {
    transform: translate(-50%, -50%) scale(1.1);
    border-color: var(--glow-color);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.5);
    z-index: 50;
}

.position-node.filled {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.position-node.active {
    border-color: var(--glow-color);
    box-shadow: 0 0 20px var(--glow-color);
    background: rgba(56, 189, 248, 0.2);
    z-index: 20;
}

/* Vertical Toggle Switch */
.vertical-toggle {
    width: 14px;
    height: 32px;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-right: 12px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Available State */
.vertical-toggle.available {
    background-color: rgba(16, 185, 129, 0.2);
    /* Green tint */
    border-color: rgba(16, 185, 129, 0.5);
}

/* Unavailable State */
.vertical-toggle.unavailable {
    background-color: rgba(239, 68, 68, 0.1);
    /* Red tint */
    border-color: rgba(239, 68, 68, 0.3);
}

.toggle-knob {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: white;
    position: absolute;
    left: 1px;
    transition: top 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.vertical-toggle.available .toggle-knob {
    top: 2px;
    background-color: #34d399;
    /* Bright Green */
}

.vertical-toggle.unavailable .toggle-knob {
    top: 18px;
    /* Bottom position */
    background-color: #f87171;
    /* Bright Red */
}


/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Custom Tooltip Styling */
#tactical-tooltip {
    max-width: 280px;
    font-size: 0.8rem;
    line-height: 1.4;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Header Controls Styles */
.header-control {
    transition: all 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
}

.header-control:hover {
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

.header-control:hover .control-label {
    color: #fff;
    text-shadow: 0 0 5px var(--glow-color);
}

/* System Select specific styles */
.system-select {
    background-color: transparent;
    color: #38bdf8;
    font-weight: bold;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    outline: none;
    padding-right: 1.5rem;
    /* space for custom arrow if needed */
    text-align: right;
    appearance: none;
    /* Remove default arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2338bdf8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 0 top 50%;
    background-size: 0.65em auto;
}

/* --- SQUAD EDITOR STYLES --- */
.sticky-col-delete,
.sticky-col-0,
.sticky-col-1,
.sticky-col-2 {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.sticky-col-delete {
    position: sticky;
    left: 0;
    z-index: 26;
    background: #0f172a;
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.2);
    width: 40px;
    text-align: center;
}

.sticky-col-0 {
    position: sticky;
    left: 40px;
    z-index: 25;
    background: #0f172a;
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.2);
    width: 50px;
}

.sticky-col-1 {
    position: sticky;
    left: 90px;
    z-index: 24;
    background: #0f172a;
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.2);
    width: 120px;
}

.sticky-col-2 {
    position: sticky;
    left: 210px;
    z-index: 23;
    background: #0f172a;
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.2);
    width: 120px;
    border-right: 1px solid #1e293b;
}

.sticky-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #0f172a;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.sticky-corner {
    z-index: 40 !important;
    background: #0f172a;
}

/* Rating Dots 1-5 */
.rating-container {
    display: flex;
    gap: 2px;
    cursor: pointer;
}

.rating-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.rating-dot:hover {
    transform: scale(1.4);
    z-index: 10;
    border-color: rgba(255, 255, 255, 0.8);
}

.rating-dot.blue:hover {
    background-color: #38bdf8;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.8);
}

.rating-dot.red:hover {
    background-color: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.8);
}

.rating-dot.green:hover {
    background-color: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.8);
}

.rating-dot.grey:hover {
    background-color: #94a3b8;
    box-shadow: 0 0 12px rgba(148, 163, 184, 0.8);
}

.rating-dot.purple:hover {
    background-color: #a855f7;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.8);
}

.rating-dot.active.blue {
    background-color: #38bdf8;
    border-color: #7dd3fc;
    box-shadow: 0 0 5px rgba(56, 189, 248, 0.4);
}

.rating-dot.active.red {
    background-color: #ef4444;
    border-color: #f87171;
    box-shadow: 0 0 5px rgba(239, 68, 68, 0.4);
}

.rating-dot.active.green {
    background-color: #10b981;
    border-color: #34d399;
    box-shadow: 0 0 5px rgba(16, 185, 129, 0.4);
}

.rating-dot.active.grey {
    background-color: #94a3b8;
    border-color: #cbd5e1;
    box-shadow: 0 0 5px rgba(148, 163, 184, 0.4);
}

.rating-dot.active.purple {
    background-color: #a855f7;
    border-color: #d8b4fe;
    box-shadow: 0 0 5px rgba(168, 85, 247, 0.4);
}

.rating-container:hover .rating-dot {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* JS driven hover classes will be better for "fill up to" */

/* JS driven hover classes will be better for "fill up to" */

.editable-cell {
    background: transparent;
    border: 1px solid transparent;
    color: inherit;
    width: 100%;
    padding: 2px 4px;
    border-radius: 2px;
}

.editable-cell:hover {
    border-color: #475569;
    background: rgba(255, 255, 255, 0.05);
}

.editable-cell:focus {
    outline: none;
    border-color: #38bdf8;
    background: rgba(15, 23, 42, 0.8);
}

.player-name-on-pitch {
    font-size: 0.65rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
    text-align: center;
    margin-top: 2px;
    font-weight: 600;
    text-shadow: 0 1px 2px black;
}

/* Info Modal Animation */
.modal-enter {
    opacity: 0;
    transform: scale(0.95);
}

.modal-enter-active {
    opacity: 1;
    transform: scale(1);
    transition: all 0.2s ease-out;
}

.modal-exit {
    opacity: 1;
    transform: scale(1);
}

.modal-exit-active {
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.2s ease-in;
}

/* Player Detail Modal */
#player-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9000;
    display: none;
}

#player-detail-modal.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

#player-detail-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

#player-detail-panel {
    position: relative;
    z-index: 1;
    width: 720px;
    max-width: 90vw;
    max-height: 85vh;
    background: var(--panel-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.4), 0 25px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.25s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.pdm-header {
    padding: 24px 24px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(15, 23, 42, 0.4);
}

.pdm-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.pdm-footer {
    padding: 18px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: rgba(15, 23, 42, 0.4);
}

.pdm-cat-section {
    margin-bottom: 20px;
}

.pdm-cat-title {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pdm-skill-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.pdm-skill-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.pdm-skill-name {
    font-size: 13px;
    color: #cbd5e1;
    flex: 1;
}

.pdm-rating-container {
    display: flex;
    gap: 5px;
}

.pdm-rating-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(100, 116, 139, 0.5);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.pdm-rating-dot:hover {
    transform: scale(1.2);
}

.pdm-rating-dot.active {
    border-color: transparent;
}

.pdm-rating-dot.blue.active {
    background: #38bdf8;
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.5);
}

.pdm-rating-dot.red.active {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.pdm-rating-dot.green.active {
    background: #34d399;
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.5);
}

.pdm-rating-dot.grey.active {
    background: #94a3b8;
    box-shadow: 0 0 6px rgba(148, 163, 184, 0.5);
}

.pdm-rating-dot.purple.active {
    background: #a855f7;
    box-shadow: 0 0 6px rgba(168, 85, 247, 0.5);
}

.pdm-rating-dot.blue:hover {
    border-color: #38bdf8;
}

.pdm-rating-dot.red:hover {
    border-color: #ef4444;
}

.pdm-rating-dot.green:hover {
    border-color: #34d399;
}

.pdm-rating-dot.grey:hover {
    border-color: #94a3b8;
}

.pdm-rating-dot.purple:hover {
    border-color: #a855f7;
}

.editor-row-selected {
    background: rgba(56, 189, 248, 0.08) !important;
    outline: 1px solid rgba(56, 189, 248, 0.3);
    outline-offset: -1px;
}

.pdm-text-input {
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    width: 100%;
    transition: all 0.2s ease;
}

.pdm-text-input:focus {
    outline: none;
    border-color: #38bdf8;
    background: rgba(15, 23, 42, 0.8);
}

/* Landscape Enforcement */
#landscape-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0f172a;
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

@media (orientation: portrait) {
    #landscape-warning {
        display: flex;
    }
}

.phone-rotate-icon {
    font-size: 4rem;
    color: #38bdf8;
    margin-bottom: 2rem;
    animation: rotatePhone 2s ease-in-out infinite;
}

@keyframes rotatePhone {
    0% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(90deg);
    }

    75% {
        transform: rotate(90deg);
    }

    100% {
        transform: rotate(0deg);
    }
}
