/**
 * PV-Layout-Tool Styles
 * SOLYCO SOLon Corporate Design
 */

/* Google Fonts - Source Sans 3 */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;600&display=swap');

/* SOLYCO Brand Colors */
:root {
  --solyco-primary: #3557A2;
  --solyco-dark: #203563;
  --solyco-light-1: #5f86bf;
  --solyco-light-2: #bcdbf3;
  --solyco-gray: #3b3e41;
  --solyco-green: #36A253;
  --solyco-red: #A72D22;
  --solyco-input-bg: #fafaff;
}

/* Reset & Base Styles */
html, body { 
  height: 100%; 
  margin: 0; 
  font-family: 'Source Sans 3', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-weight: 300;
}

/* Layout */
#app { 
  display: grid; 
  grid-template-columns: 380px 1fr; 
  height: 100%;
}

#sidebar { 
  padding: 14px; 
  padding-bottom: 50px; /* Space for footer */
  border-right: 1px solid #e5e5e5; 
  overflow: auto;
}

#map { 
  width: 100%; 
  height: 100%;
}

/* Sidebar Header */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e5e5;
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo {
  height: 28px;
  width: auto;
}

.sidebar-header h1 {
  flex: 1;
  margin: 0;
}

/* Language Switcher */
.lang-switcher {
  position: relative;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid #e0e0e0;
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
  color: var(--solyco-gray);
  transition: border-color 0.2s ease;
  width: auto;
  height: auto;
}

.lang-toggle:hover {
  border-color: var(--solyco-primary);
}

.lang-current-text {
  font-weight: 600;
  color: var(--solyco-primary);
  font-size: 12px;
}

.lang-arrow {
  font-size: 8px;
  color: #999;
}

.lang-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(53, 87, 162, 0.15);
  z-index: 1000;
  min-width: 50px;
}

.lang-dropdown.show {
  display: block;
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 400;
  color: var(--solyco-gray);
  text-align: left;
  transition: background-color 0.15s ease;
}

.lang-option:hover {
  background: var(--solyco-light-2);
}

/* App Footer */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 380px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid #e5e5e5;
  border-right: 1px solid #e5e5e5;
  font-size: 11px;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 300;
  color: var(--solyco-gray);
  z-index: 9999;
  box-sizing: border-box;
}

.app-footer .version {
  opacity: 0.7;
}

.footer-links {
  display: flex;
  gap: 12px;
}

.footer-links a {
  color: var(--solyco-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: var(--solyco-dark);
  text-decoration: underline;
}

/* Typography */
h1 { 
  font-size: 18px; 
  margin: 0 0 8px;
  font-weight: 400;
  color: var(--solyco-dark);
}

h2 { 
  font-size: 14px; 
  margin: 14px 0 6px; 
  color: var(--solyco-gray);
  font-weight: 400;
}

.small { 
  font-size: 12px;
}

.muted { 
  color: #666; 
  font-size: 12px;
}

.lh-15 { 
  line-height: 1.5;
}

/* Keyboard Shortcuts */
code {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding: 2px 6px;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  color: var(--solyco-gray);
  white-space: nowrap;
}

details summary {
  padding: 4px 0;
}

details[open] summary {
  margin-bottom: 8px;
}

/* Form Elements */
label { 
  display: block; 
  font-size: 12px; 
  margin: 6px 0 2px;
  color: var(--solyco-gray);
}

input, 
select, 
button { 
  width: 100%; 
  padding: 8px; 
  box-sizing: border-box; 
  font-size: 13px;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 300;
}

input,
select {
  background: var(--solyco-input-bg);
  border: 1px solid #e0e0e0;
  border-radius: 2px;
  transition: border-color 0.2s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--solyco-primary);
}

input::placeholder {
  color: #888;
}

textarea {
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 300;
  background: var(--solyco-input-bg);
  border: 1px solid #e0e0e0;
  border-radius: 2px;
  transition: border-color 0.2s ease;
}

textarea:focus {
  outline: none;
  border-color: var(--solyco-primary);
}

textarea::placeholder {
  color: #888;
}

.form-group {
  margin-bottom: 12px;
}

/* Custom File Input */
.file-input-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin: 0;
}

.file-input-button-s {
  background: transparent;
  color: var(--solyco-primary);
  border: 1px solid var(--solyco-primary);
  border-radius: 2px;
  padding: 6px 12px;
  font-size: 13px;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
  white-space: nowrap;
  height: 28px;
  box-sizing: border-box;
}

.file-input-label:hover .file-input-button-s {
  background: var(--solyco-light-2);
}

.file-name {
  font-size: 12px;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* Buttons - SOLYCO Design System */

/* Button L - Primary Action (rare, max 1 per section) */
.btn { 
  background: var(--solyco-primary); 
  color: #fff; 
  border: 0; 
  border-radius: 2px; 
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 600;
  font-size: 15px;
  padding: 10px 18px;
  height: 40px;
  box-sizing: border-box;
}

.btn:hover {
  background: var(--solyco-dark);
}

.btn:disabled {
  background: var(--solyco-primary);
  opacity: 0.45;
  cursor: not-allowed;
}

/* Button M - Secondary Action (occasional, never in lists) */
.btn.secondary { 
  background: transparent; 
  color: var(--solyco-primary);
  border: 1px solid var(--solyco-primary);
  font-size: 14px;
  padding: 8px 16px;
  height: 36px;
}

.btn.secondary:hover {
  background: var(--solyco-light-2);
}

.btn.secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: transparent;
}

/* Button S - Tool/Context Action (for repeated UI, cards, lists) */
.btn-s {
  background: transparent;
  color: var(--solyco-primary);
  border: 1px solid var(--solyco-primary);
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 300;
  font-size: 13px;
  padding: 4px 10px;
  height: 28px;
  box-sizing: border-box;
  width: auto;
}

.btn-s:hover {
  background: var(--solyco-light-2);
}

.btn-s:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Module Cards + Icon Buttons */
.array-item.module-card {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--solyco-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-title-input {
  flex: 1;
  min-width: 140px;
  font-size: 13px;
  font-weight: 600;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.item-divider {
  height: 1px;
  background: #e5e5e5;
  margin: 10px 0 6px;
}

.btn-icon {
  background: transparent;
  color: var(--solyco-primary);
  border: 1px solid var(--solyco-primary);
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 600;
  font-size: 12px;
  padding: 0 8px;
  height: 28px;
  min-width: 28px;
  box-sizing: border-box;
  width: auto;
}

.btn-icon:hover {
  background: var(--solyco-light-2);
}

.btn-icon.active {
  background: var(--solyco-primary);
  color: #fff;
}

.btn-icon.danger {
  color: var(--solyco-gray);
  border-color: var(--solyco-gray);
}

.btn-icon.danger:hover {
  background: var(--solyco-red);
  color: #fff;
  border-color: var(--solyco-red);
}

/* Button S-Danger - Destructive Tool Action */
.btn-s.danger {
  background: transparent;
  color: var(--solyco-gray);
  border: 1px solid var(--solyco-gray);
}

.btn-s.danger:hover {
  background: var(--solyco-dark);
  color: #fff;
  border-color: var(--solyco-dark);
}

.btn-s.danger.arr-clear-feet:hover {
  background: var(--solyco-red);
  border-color: var(--solyco-red);
}

/* Legacy .btn.danger for backwards compatibility */
.btn.danger { 
  background: transparent; 
  color: var(--solyco-gray);
  border: 1px solid var(--solyco-gray);
}

.btn.danger:hover {
  background: var(--solyco-dark);
  color: #fff;
  border-color: var(--solyco-dark);
}

.btn-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Lists and Cards */
.list { 
  margin-top: 10px; 
  font-size: 13px;
}

.array-item { 
  padding: 12px; 
  border: 1px solid #e0e0e0; 
  border-radius: 2px; 
  margin-bottom: 8px; 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  gap: 8px;
  background: #fff;
  transition: border-color 0.2s ease;
}

.array-item:hover {
  border-color: var(--solyco-light-1);
}

/* Layout Helpers */
.row { 
  display: grid; 
  grid-template-columns: 1fr 1fr; 
  gap: 12px;
}

.stack { 
  display: flex; 
  gap: 8px; 
  align-items: center; 
  flex-wrap: wrap;
}

.relative { 
  position: relative;
}

/* Spacing */
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }

/* Display Utilities */
.align-center { 
  align-items: center;
}

.inline { 
  display: inline; 
  width: auto;
}

/* UI Elements */
.pill { 
  display: inline-block; 
  padding: 2px 8px; 
  border-radius: 999px; 
  background: var(--solyco-light-2); 
  border: 1px solid var(--solyco-light-1); 
  font-size: 11px;
  color: var(--solyco-dark);
}

.label { 
  background: transparent; 
  color: #000; 
  padding: 0 4px; 
  font-size: 14px; 
  white-space: nowrap; 
  pointer-events: none; 
  border: 0;
}

/* Roof drawing labels */
.roof-length-label {
  display: inline-block;
  background: var(--solyco-light-1);
  color: #fff;
  padding: 6px 10px;
  border-radius: 2px;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(53, 87, 162, 0.35);
  border: 2px solid var(--solyco-primary);
  transition: background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  pointer-events: none;
  user-select: none;
}

.roof-length-label:hover {
  background: var(--solyco-primary);
  border-color: var(--solyco-dark);
  box-shadow: 0 3px 8px rgba(53, 87, 162, 0.35);
}

/* Suggestions Dropdown */
.suggestions { 
  display: none; 
  position: absolute; 
  left: 0; 
  right: 0; 
  top: 100%; 
  background: #fff; 
  border: 1px solid #e0e0e0; 
  border-radius: 2px;
  max-height: 220px; 
  overflow: auto; 
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(53, 87, 162, 0.12);
}

.suggestions div {
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  color: var(--solyco-gray);
  font-size: 13px;
}

.suggestions div:hover {
  background: var(--solyco-light-2);
  color: var(--solyco-dark);
}

/* Export Dropdown */
.export-dropdown {
  position: relative;
  flex: 1;
}

.dropdown-menu {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 4px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(53, 87, 162, 0.15);
  overflow: hidden;
  z-index: 1000;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-menu button {
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  font-size: 15px;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 600;
  color: var(--solyco-gray);
  transition: background-color 0.15s ease;
}

.dropdown-menu button:last-child {
  border-bottom: 0;
}

.dropdown-menu button:hover {
  background: var(--solyco-light-2);
  color: var(--solyco-dark);
}

/* Workflow Animations */
.section-unlocked {
  animation: fadeInSlide 0.4s ease-out;
}

@keyframes fadeInSlide {
  from { 
    opacity: 0; 
    transform: translateY(-20px);
  }
  to { 
    opacity: 1; 
    transform: translateY(0);
  }
}

/* Smooth scroll behavior */
#sidebar {
  scroll-behavior: smooth;
}

/* Winkelbögen Labels */
.angle-arc-label {
  transition: opacity 0.2s ease;
}

.angle-arc-label div {
  user-select: none;
  cursor: default;
}

/* Obstacle Layer Cursors */
.obstacle-layer-clickable {
  cursor: pointer !important;
}

.obstacle-layer-draggable {
  cursor: move !important;
}

.obstacle-layer-draggable path,
.obstacle-layer-draggable g {
  cursor: move !important;
}

path.obstacle-layer-clickable,
path.obstacle-layer-draggable {
  cursor: inherit !important;
}

/* Leaflet panes - erhöhe z-index für Obstacles im Edit-Modus */
.leaflet-overlay-pane svg g.obstacle-editing {
  cursor: move !important;
}

.leaflet-overlay-pane svg g.obstacle-editing path {
  cursor: move !important;
}

/* Custom Layer Switcher */
.layer-switcher {
  display: flex;
  gap: 2px;
  background: white;
  border-radius: 2px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(53, 87, 162, 0.2);
}

.layer-btn {
  border: none;
  background: transparent;
  padding: 6px 10px;
  font-size: 13px;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 300;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s ease;
  white-space: nowrap;
  color: var(--solyco-gray);
}

.layer-btn:hover {
  background: var(--solyco-light-2);
}

.layer-btn.active {
  background: var(--solyco-primary);
  color: white;
  box-shadow: 0 1px 3px rgba(53, 87, 162, 0.3);
}

/* Verstecke Radio Buttons im Layer Control */
.leaflet-control-layers-base input[type="radio"] {
  display: none;
}

.leaflet-control-layers-base label {
  cursor: pointer;
  padding: 4px 8px;
  display: block;
  border-radius: 2px;
  transition: background 0.15s ease;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 300;
}

.leaflet-control-layers-base label:hover {
  background: var(--solyco-light-2);
}

.leaflet-control-layers-base label span {
  padding-left: 0 !important;
}

/* Leaflet Controls - SOLYCO style */
.leaflet-control-zoom,
.leaflet-control-layers {
  border: 0;
  border-radius: 2px;
  box-shadow: 0 6px 16px rgba(32, 53, 99, 0.18);
  overflow: hidden;
}

.leaflet-control-zoom a,
.leaflet-control-layers-toggle {
  background: #fff;
  color: var(--solyco-dark);
  border: 0;
  border-radius: 2px;
}

.leaflet-control-zoom a {
  width: 28px;
  height: 28px;
  line-height: 28px;
  font-weight: 300;
  font-size: 14px;
  font-family: 'Source Sans 3', sans-serif;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.leaflet-control-zoom a:hover,
.leaflet-control-layers-toggle:hover {
  background: var(--solyco-light-2);
  color: var(--solyco-dark);
}

.leaflet-control-zoom a.leaflet-disabled {
  background: #f4f5f8;
  color: #9aa3ad;
}

.leaflet-control-zoom a + a {
  border-top: 1px solid #e5e5e5;
}

.leaflet-control-layers-toggle {
  width: 30px;
  height: 30px;
  background-image: url('https://unpkg.com/leaflet@1.9.4/dist/images/layers.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
}

.leaflet-control-layers-expanded {
  background: #fff;
  color: var(--solyco-gray);
  border: 0;
  border-radius: 2px;
  box-shadow: 0 6px 16px rgba(32, 53, 99, 0.18);
}

/* Drop Zone für Projektdateien */
.drop-zone {
  display: none;
  margin-top: 12px;
  padding: 16px;
  border: 2px dashed var(--solyco-primary);
  border-radius: 2px;
  background: var(--solyco-light-2);
  text-align: center;
  transition: all 0.2s ease;
}

.drop-zone.visible {
  display: block;
}

.drop-zone.drag-over {
  background: rgba(53, 87, 162, 0.15);
  border-style: solid;
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.drop-zone-icon {
  font-size: 24px;
}

.drop-zone-text {
  font-size: 13px;
  color: var(--solyco-primary);
  font-weight: 400;
}
