/* =========================
   GLOBAL RESET & VARIABLES
   ========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}



/* =========================
   BODY & DASHBOARD
   ========================= */
body {
  font-family: "Inter", system-ui, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  position: relative;
  z-index: 0;
  
  /* Kolfiber bakgrund */
  background-image:
    linear-gradient(45deg, rgba(255,255,255,0.015) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.015) 75%, rgba(255,255,255,0.015)),
    linear-gradient(45deg, rgba(255,255,255,0.015) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.015) 75%, rgba(255,255,255,0.015)),
    linear-gradient(to right, rgba(227,157,5,0.05), rgba(227,157,5,0) 50%, rgba(227,157,5,0.05));
  background-size: 12px 12px, 12px 12px, 100% 100%;
  background-position: 0 0, 6px 6px, 0 0;
  background-attachment: fixed;
}

/* Glas-effekt över hela sidan */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.08), transparent 60%),
    radial-gradient(circle at 80% 40%, rgba(255,255,255,0.06), transparent 60%),
    radial-gradient(circle at 50% 70%, rgba(255,255,255,0.05), transparent 70%);
  filter: blur(30px);
  opacity: 0.8;
  animation: glassReflections 25s ease-in-out infinite;
}

#appContent {
  width: 100%;
}

@keyframes glassReflections {
  0% { background-position: 0 0, 100% 0, 50% 100%; }
  50% { background-position: 10% 10%, 90% 5%, 55% 95%; }
  100% { background-position: 0 0, 100% 0, 50% 100%; }
}

.dashboard {
  display: flex;
  width: 100%;
  height: 100vh;
  position: relative;
  z-index: 2;
}

/* =========================
   SIDEBAR REMOVED (Legacy)
   ========================= */

/* =========================
   MAIN CONTENT
   ========================= */
.main-content {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
  background-color: transparent;
  position: relative;
  z-index: 2;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

.content-section h2 {
  font-size: 28px;
  margin-bottom: 16px;
  color: var(--accent);
}

.content-section p {
  font-size: 16px;
  color: var(--text-main);
  line-height: 1.6;
}



/* =========================
   EDITOR TOOLBAR (Duplicate removed)
   ========================= */

/* =========================
   LINEUP CONTAINER
   ========================= */
#lineup-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}

#field-container {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  max-width: 800px;
}

#lineup-text-right {
  flex: 1;
  min-width: 250px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin-top: 0;
}

#lineup-text-bottom {
  margin-top: 20px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-main);
  width: 100%;
}

/* =========================
   FIELD & PLAYERS
   ========================= */
#field {
  position: relative;
  width: 800px;
  height: 800px;
  background-color: #a5d6d300;
  border: 2px solid var(--accent);
  margin: 0 auto;
  overflow: hidden;
}

.cone {
  position: absolute;
  width: 15px;
  height: 15px;
  border: 2px solid var(--accent);
  background-color: transparent;
}

#cone1 {
  top: calc(var(--cone-margin) + var(--cone-offset-y));
  left: var(--cone-margin);
}

#cone2 {
  top: calc(var(--cone-margin) + var(--cone-offset-y));
  right: var(--cone-margin);
}

#cone3 {
  bottom: calc(var(--cone-margin) - var(--cone-offset-y));
  left: var(--cone-margin);
}

#cone4 {
  bottom: calc(var(--cone-margin) - var(--cone-offset-y));
  right: var(--cone-margin);
}

.player {
  width: 25px;
  height: 25px;
  font-size: 10px;
  color: var(--text-main);
  background-color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
  position: relative;
  z-index: 10;
  border-radius: 50%;
  pointer-events: auto; /* Gör ikonen klickbar */
}

/* Utökad träffyta för touch (minst 44px) */
.player::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  z-index: -1;
  pointer-events: auto;
}

.player.circle {
  border-radius: 50%;
}

@media (hover: hover) {
  .player:hover {
    transform: scale(1.3);
    background-color: var(--accent-bright);
  }
}

.player-name {
  font-family: 'Inter', sans-serif;
  font-weight: 200;
  font-size: 13px;
  color: var(--accent);
  margin-top: 6px;
  text-align: center;
  width: 100%;
  pointer-events: none;
  user-select: none;
}

.player-tooltip {
  position: absolute;
  background: rgba(0,0,0,0.8);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 1000;
}

.player-wrapper {
  position: absolute;
  width: 0;
  height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: move;
  transition: transform 0.2s ease;
  transform: translate(-50%, -50%); /* Center wrapper on coordinate */
  z-index: 10; /* Ensure player wrapper is above heatmap (z-index 1) */
  pointer-events: none; /* Låt klick gå igenom den osynliga wrappern */
  overflow: visible;
}

.player-wrapper.non-admin {
  cursor: default;
}

.player-wrapper:active {
  cursor: grabbing;
}

.player-area {
  border: 2px dashed rgba(227, 157, 5, 0.5);
  border-radius: 50%;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: none;
  z-index: 5;
  box-sizing: border-box;
}

/* =========================
   FIELD CONTROLS
   ========================= */
#field-controls {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1000;
  display: flex;
  gap: 8px;
}

.field-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(227, 157, 5, 0.3);
  background: rgba(0, 0, 0, 0.7);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.field-btn:hover {
  background: rgba(227, 157, 5, 0.2);
  transform: scale(1.1);
}

.field-btn.active {
  background: rgba(227, 157, 5, 0.3);
  color: var(--text-main);
  border-color: var(--accent);
}

/* =========================
   JS INJECTED STYLES REPLACEMENT
   ========================= */

/* Schedule / Calendar & Upcoming Events styles moved to news-calendar.css */

/* Canvas & Overlays */
.canvas-overlay-full {
  position: absolute; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%; 
  pointer-events: none;
}

/* =========================
   ADMIN PANELS
   ========================= */
.admin-panel {
  display: none;
  margin-top: 10px;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

#chainAdminPanel,
#radiusControlPanel,
#heatmapControls {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.3s ease;
  resize: both;
  overflow: hidden;
  min-width: 200px;
  min-height: 100px;
}

#chainAdminPanel:hover,
#radiusControlPanel:hover,
#heatmapControls:hover {
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}

.panel-header {
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(227, 157, 5, 0.3);
}

.panel-header:active {
  cursor: grabbing;
}

.panel-controls {
  display: flex;
  gap: 5px;
}

.panel-minimize-btn,
.panel-close-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.5);
  color: #e39d05;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.2s ease;
}

.panel-minimize-btn:hover {
  background: rgba(227, 157, 5, 0.2);
}

.panel-close-btn:hover {
  background: rgba(255, 85, 85, 0.2);
  color: var(--danger);
}

.panel-content {
  transition: max-height 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
}

.panel-content.collapsed {
  max-height: 0;
  opacity: 0;
}

/* =========================
   UTILITY & EDITOR STYLES
   ========================= */
/* extraherade till assets/css/components/editor.css och assets/css/utilities.css */

#heatmapControls {
  position: absolute;
  top: 50px;
  left: 10px;
  z-index: 1000;
  display: none;
  background: rgba(0,0,0,0.8);
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  width: 180px;
}

#radiusControlPanel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(0,0,0,0.95);
  color: white;
  padding: 15px;
  border-radius: 8px;
  z-index: 1001;
  width: 280px;
  display: none;
  border: 1px solid var(--accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

#chainAdminPanel {
  position: fixed;
  bottom: 80px;
  left: 20px;
  background: rgba(0,0,0,0.95);
  color: white;
  padding: 20px;
  border-radius: 8px;
  z-index: 1002;
  width: 320px;
  max-height: 80vh;
  overflow-y: auto;
  border: 2px solid var(--green-neon);
  display: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* =========================
   PROFILE FORM
   ========================= */

#profileForm {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);              /* 12px */
  width: 100%;
  max-width: 18.75rem;               /* 300px */
  margin-inline: 0;
}

/* =========================
   FORM GROUP
   ========================= */

#profileForm .form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);             /* 4px */
  width: 100%;
}

/* =========================
   LABEL
   ========================= */

#profileForm label {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-main);
}

/* =========================
   INPUTS & TEXTAREA
   ========================= */

#profileForm input[type="text"],
#profileForm textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;

  padding: var(--space-2xs) var(--space-xs); /* 6px 8px */
  font-size: var(--font-size-base);
  color: var(--color-text-main);

  background: var(--color-backdrop-light);

  /* Tillåten exakt border */
  border: 1px solid rgba(227, 157, 5, 0.3);
  border-radius: var(--radius-sm);
}

/* =========================
   CHECKBOX
   ========================= */

#profileForm input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin-left: 0;
}

/* =========================
   BUTTON
   ========================= */

#profileForm button {
  width: 100%;
  padding: var(--space-xs) var(--space-sm);  /* 8px 12px */

  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-base);

  color: var(--color-text-main);
  background-color: var(--color-accent);

  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;

  transition: background-color var(--transition-base);
}

#profileForm button:hover {
  background-color: var(--color-accent-hover);
}

/* =========================
   READONLY STATE
   ========================= */

#profileName[readonly] {
  background-color: var(--color-text-disabled);
  cursor: not-allowed;
}


/* PRINT STYLES REMOVED FOR ARCHIVE */

/* =========================
   HAMBURGER MENU BTN REMOVED
   ========================= */

/* =========================
   TOGGLE EDIT BUTTON
   ========================= */
#toggleEdit {
  position: fixed;
  top: 15px;
  right: 15px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background-color: transparent;
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

#toggleEdit:hover {
  transform: scale(1.1);
  border-color: var(--accent-bright);
}

#toggleEdit svg {
  width: 24px;
  height: 24px;
  fill: var(--accent);
}

#toggleEdit .saveIcon {
  display: none;
}

#toggleEdit.editMode .editIcon {
  display: none;
}

#toggleEdit.editMode .saveIcon {
  display: block;
}

/* Editor Toolbar */
#editorToolbar {
    display: none;
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--white);
    border: 1px solid var(--border-light);
    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 1000;
}

#editorToolbar button {
    border: none;
    background: none;
    cursor: pointer;
    margin: 0 2px;
    font-size: 16px;
}

#editorToolbar input[type=color] {
    width: 24px;
    height: 24px;
    border: none;
    padding: 0;
    cursor: pointer;
}

.toolbar-buttons {
    display: flex;
    gap: 4px;
}

/* Editable elements */
.editable {
    min-height: 20px;
}

.editMode .editable {
    border-bottom: 1px dashed var(--accent);
    cursor: text;
    padding: 2px 4px;
    color: var(--text-main);
}

/* Minimize icon */
.minimize-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 12px;
}

.collapsed .minimize-icon {
    transform: rotate(-90deg);
}

/* Cone positions */
#cone1 {
    top: calc(var(--cone-margin) + var(--cone-offset-y));
    left: var(--cone-margin);
}

#cone2 {
    top: calc(var(--cone-margin) + var(--cone-offset-y));
    right: var(--cone-margin);
}

#cone3 {
    bottom: calc(var(--cone-margin) - var(--cone-offset-y));
    left: var(--cone-margin);
}

#cone4 {
    bottom: calc(var(--cone-margin) - var(--cone-offset-y));
    right: var(--cone-margin);
}

button:focus-visible,
.field-btn:focus-visible,
.btn-primary:focus-visible,
.view-btn:focus-visible,
.nav-btn:focus-visible,
.today-btn:focus-visible,
.news-action-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--accent);
  outline: none;
}

/* Canvas och overlay för heatmap/kedjor */
#heatmapCanvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; opacity: 0.65; }
#chainCanvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
#chainHoverCanvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 6; }
#heatmapClickOverlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 3; cursor: crosshair; pointer-events: auto; }

/* Heatmap visuella klasser */
.heatmap-name-shadow { 
    /* Modern approach för text outline */
    -webkit-text-stroke: 2px var(--black);
    paint-order: stroke fill;
    font-weight: 600 !important;
    text-shadow: none !important;
}
.heatmap-player-shadow { box-shadow: 0 0 0 1px var(--black), 0 0 4px rgba(0,0,0,0.7); }
.heatmap-area-outline { border: 1px solid var(--black) !important; box-shadow: 0 0 4px rgba(0,0,0,0.5); }

/* Spelardot-storlek och form */
.player-dot-small { width: 15px; height: 15px; font-size: 8px; }
.player-dot-square { border-radius: 0 !important; }

/* Spelararea bas/visning/vald */
.player-area--base { border: 1px solid rgba(150,150,150,0.5); background-color: rgba(150,150,150,0.1); }
.player-area-show { display: block !important; border-color: var(--accent-a-30); background-color: var(--accent-a-05); }
.player-area--selected { border: 2px solid var(--green-neon); background-color: rgba(0,255,0,0.1); }

/* Vald spelare */
.player-selected { box-shadow: 0 0 0 3px var(--green-neon); }

/* Tillfälliga meddelanden */
.temp-message { position: fixed; top: 20px; right: 20px; color: var(--white); padding: 12px 20px; border-radius: 6px; font-size: 14px; z-index: 10000; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.temp-message.success { background: rgba(76, 175, 80, 0.9); }
.temp-message.error { background: rgba(244, 67, 54, 0.9); }
.temp-message.info { background: rgba(0,0,0,0.8); color: var(--accent); }

/* Event Info Modal */
.event-info-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    pointer-events: auto;
    width: 90%;
    max-width: 450px;
}

.event-info-content {
    background: rgba(0,0,0,0.9);
    border-radius: 8px;
    border: 1px solid var(--accent);
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

.event-info-title {
    color: var(--accent);
    margin-bottom: 10px;
    font-size: 18px;
}

.event-info-row {
    color: #fff;
    margin-bottom: 5px;
    font-size: 14px;
}

.event-info-desc {
    color: #ccc;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.5;
}

.event-info-close-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 15px;
    transition: background-color 0.2s;
}

.event-info-close-btn:hover {
    filter: brightness(0.9);
}

.event-info-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    cursor: pointer;
}

/* Event Types Colors */
.event-type-training { background-color: #4CAF50; border-left: 3px solid #388E3C; }
.event-type-match { background-color: #f44336; border-left: 3px solid #D32F2F; }
.event-type-meeting { background-color: #2196F3; border-left: 3px solid #1976D2; }
.event-type-other { background-color: #9C27B0; border-left: 3px solid #7B1FA2; }


/* For upcoming events pill */
.event-pill-training { background-color: #4CAF50; }
.event-pill-match { background-color: #f44336; }
.event-pill-meeting { background-color: #2196F3; }
.event-pill-other { background-color: #9C27B0; }

/* For upcoming event card border */
.event-card-training { border-left-color: #4CAF50 !important; }
.event-card-match { border-left-color: #f44336 !important; }
.event-card-meeting { border-left-color: #2196F3 !important; }
.event-card-other { border-left-color: #9C27B0 !important; }

/* Animation classes */
.fade-out {
    opacity: 0 !important;
    transition: opacity 0.5s ease;
}

.edit-news-btn {
    padding: 5px 10px; 
    font-size: 12px;
}

.calendar-week-dates {
    font-size: 14px; 
    color: #9aa4b2;
}

.event-info-details {
    margin-bottom: 15px;
}