/* ===== CSS Variables ===== */
:root {
  /* Colors */
  --primary-bg: #1a1a1a;
  --secondary-bg: #333;
  --tertiary-bg: #2a2a2a;
  --primary-color: #007bff;
  --primary-color-hover: #0056b3;
  --highlight-green: limegreen;
  --highlight-blue: #007bff;
  --highlight-blue-light: #66b0ff;
  --highlight-orange: #ff9500;
  --highlight-red: #ff0000;
  --highlight-gray: #666;
  --box-text: #fff;
  --alt-text: #ccc;
  --secondary-text: #bbb;
  --log-success: #0f0;
  --log-error: #ff5555;

  /* Typography */
  --font-family: Arial, sans-serif;
  --font-size-base: 14px;
  --font-size-small: 12px;
  --font-size-xsmall: 11px;

  /* Spacing */
  --padding-base: 10px;
  --padding-small: 8px;

  /* Borders */
  --border-radius: 8px;
  --border-radius-small: 5px;

  /* Effects */
  --transition: all 0.3s ease;
}

/* ===== Base Styles ===== */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

/* ===== Shared Widget Styles ===== */
[class*="-widget"], 
.widget {
  background: var(--primary-bg);
  padding: var(--padding-small);
  border-radius: var(--border-radius);
  width: 100%;
  color: var(--box-text);
  font-family: var(--font-family);
  margin-bottom: var(--padding-small);
  overflow: hidden;
}

.widget-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--padding-small);
  width: 100%;
}

.widget h3, .box-title {
  font-size: var(--font-size-small);
  font-weight: bold;
  margin-bottom: var(--padding-small);
}

/* ===== Log/Error Items ===== */
[class*="-item"], .error-message, .task-tile {
  padding: 6px 8px;
  margin-bottom: 5px;
  border-left: 3px solid var(--highlight-red);
  background: var(--secondary-bg);
  border-radius: var(--border-radius-small);
  cursor: pointer;
  transition: var(--transition);
  font-size: var(--font-size-xsmall);
  word-break: break-word;
}

.log-list {
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--highlight-gray) var(--tertiary-bg);
}

.log-list::-webkit-scrollbar {
  width: 6px;
}

.log-list::-webkit-scrollbar-track {
  background: var(--tertiary-bg);
}

.log-list::-webkit-scrollbar-thumb {
  background: var(--highlight-gray);
  border-radius: 3px;
}

/* ===== Task Widget Specific ===== */
.task-tile {
  border-left-width: 5px;
  box-shadow: inset 0 0 0 1px var(--highlight-gray);
}

.border-left-green { border-color: var(--highlight-green); }
.border-left-blue { border-color: var(--highlight-blue); }
.border-left-orange { border-color: var(--highlight-orange); }
.border-left-red { border-color: var(--highlight-red); }
.border-left-gray { border-color: var(--highlight-gray); }

/* ===== Server Status Widget ===== */
.server-section {
  background: var(--tertiary-bg);
  padding: var(--padding-small);
  border-radius: 6px;
  margin-bottom: var(--padding-small);
}

.server-item {
  background: var(--secondary-bg);
  padding: 6px;
  border-radius: var(--border-radius-small);
  margin-bottom: 4px;
  font-size: var(--font-size-xsmall);
}

.server-item.online { border-left: 3px solid var(--highlight-green); }
.server-item.offline { border-left: 3px solid var(--highlight-red); }

/* ===== Utility Classes ===== */
.no-errors {
  color: var(--log-success);
  font-weight: bold;
  text-align: center;
}

.log-placeholder {
  color: var(--secondary-text);
  text-align: center;
  font-style: italic;
}

.animate-pulse {
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--highlight-blue); }
  50% { border-color: var(--highlight-blue-light); }
}

/* ===== Mobile Responsiveness ===== */
@media (max-width: 768px) {
  .widget-container {
    grid-template-columns: 1fr;
  }
  
  [class*="-widget"], .widget {
    padding: 6px;
    font-size: 11px;
  }
  
  .log-list {
    max-height: 150px;
  }
}

@media (max-width: 480px) {
  :root {
    --font-size-base: 13px;
    --font-size-small: 11px;
    --font-size-xsmall: 10px;
    --padding-base: 8px;
    --padding-small: 6px;
  }
}