/* CSS Variables */
:root {
    --card-border: 4px solid rgba(11, 10, 33, 0.4);
    --card-border-hover: rgba(93, 96, 227, 0.3);
    --card-border-focus: rgba(164, 166, 216, 0.6);
    /* --card-bg: rgba(22, 19, 65, 0.1); */
    --card-bg: rgba(14, 13, 38, 0.1);
    /* --card-bg-hover: rgba(0, 100, 0, 0.1); */
    --text-shadow: 0 0 10px rgba(24, 25, 26, 1.0);
    --transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
    --focus-ring: 0 0 0 0px var(--card-border-focus);
    --font-family-base: 'Segoe UI Variable', system-ui, -apple-system, sans-serif;
    --card-padding: 0px;
    --card-margin: 0px;
    --border-radius: 4px;
  }
  
  /* Firefox-specific styles */
  @-moz-document url-prefix() {
    /* Link highlight removal */
    .service-card a,
    .service-card a *,
    .service-card div[onclick],
    .service-card [role="link"],
    .service-card [role="button"] {
      background-color: transparent !important;
      -moz-appearance: none !important;
      appearance: none !important;
      outline: none !important;
      box-shadow: none !important;
      color: inherit !important;
    }
  
    /* Tab spacing fixes */
    #myTab {
      margin-bottom: 0px !important;
    }
    
    .tabcontent.active {
      margin-top: 10px !important;
    }
  
    /* Service icon sizing */
    .service-icon img {
        width: 40px !important;
        height: 40px !important;
        filter: saturate(75%) opacity(75%) !important;
    }

    .service-icon {
        width: 50px !important;
        height: 56px !important;
    }

    /* .service-name,
    .service-title-text {
        display: none !important;
        visibility: hidden !important;
    } */
    
    .service-card:hover img {
        transform: scale(1.1) !important;
        filter: saturate(100%) opacity(90%) !important;
    }
  
    /* Link states */
    .service-card a:-moz-any-link {
      background-color: transparent !important;
    }
  
    .service-card a:focus,
    .service-card a:hover,
    .service-card div[onclick]:hover {
      background-color: transparent !important;
      outline: none !important;
    }
  }
  
  
  /* Spacing adjustments */
  div.max-w\:full:nth-child(3) > div:nth-child(2),
  div.max-w\:full:nth-child(4) > div:nth-child(2),
  div.max-w\:full:nth-child(5) > div:nth-child(2),
  div.max-w\:full:nth-child(6) > div:nth-child(2),
  div.max-w\:full:nth-child(7) > div:nth-child(2),
  div.max-w\:full:nth-child(8) > div:nth-child(2) {
    margin-bottom: 5px !important;
  }
  
  div.max-w\:full:nth-child(1) > div:nth-child(1) {
    margin-left: 10px;
  }
  
  div.max-w\:full:nth-child(3) {
    padding-left: 27px;
  }
  
  #information-widgets-right {
    margin-right: 10px;
  }

  .information-widget-datetime {
    margin-left: 10px !important;
  }  
  
  /* Typography */
  /* .service-card > div:first-child:not(.service-container),
  .service-card > span:first-child,
  .service-card > h1:first-child,
  .service-card > h2:first-child,
  .service-card > h3:first-child,
  .service-card > h4:first-child,
  .service-card > h5:first-child,
  .service-card > h6:first-child,
  .service-card > p:first-child,
  .bookmark,
  .widget-container,
  .information-widget-resource,
  [id$="-tab"],
  #information-widgets > * {
    font-weight: 700 !important;
    text-transform: uppercase !important;
  }
   */
  /* Performance optimized base styles */
  .service-card,
  .bookmark,
  .widget-container,
  .information-widget-resource,
  [id$="-tab"],
  #information-widgets > * {
    font-family: var(--font-family-base);
    font-weight: 700;
    white-space: normal;
    contain: content;
    will-change: transform;
    content-visibility: auto;
    contain-intrinsic-size: auto 200px;
    backface-visibility: hidden;
    transform: translateZ(0);
  }
  
  /* Card styles */
  .service-card,
  [id$="-tab"],
  #information-widgets > * {
    position: relative;
    border: var(--card-border);
    border-radius: var(--border-radius) !important;
    padding: var(--card-padding);
    margin: var(--card-margin);
    transition: var(--transition);
    backdrop-filter: blur(15px);
    text-shadow: var(--text-shadow);
  }
  
  .service-name {
    font-size: 14px !important;
  }
  
  /* Service block styles */
  /* .service-block {
    position: relative;
    border: 1px solid var(--card-border-focus) !important;
    border-radius: var(--border-radius) !important;
  } */
  
  
  /* Background and hover effects */
  .service-card::before,
  [id$="-tab"]::before,
  #information-widgets > *::before {
    content: '';
    position: absolute;
    inset: -5px;
    background-color: var(--card-bg);
    z-index: -1;
    border-radius: var(--border-radius) !important;
  }
  
  .service-card:hover,
  [id$="-tab"]:hover {
    /* background-color: var(--card-bg-hover); */
    border-color: var(--card-border-hover);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }
  
  /* Tab styles */
  [id$="-tab"] {
    padding: 20px 15px;
    margin: 0;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }
  
  [id$="-tab"]:is(:focus, .tab-focused) {
    border-color: var(--card-border-focus);
    outline: none;
    box-shadow: var(--focus-ring);
  }
  
  [id$="-tab"].active {
    /* background-color: var(--card-bg-hover); */
    border-color: var(--card-border-focus);
  }
  
  /* Tab container and content */
  #myTab {
    font: 16px/2 var(--font-family-base);
    padding: 0;
    margin: 0;
    background: none;
    backdrop-filter: none;
    display: flex;
    gap: 15px;
  }
  
  .tabcontent {
    position: relative;
    width: 100%;
    height: 100%;
    inset: 0;
    display: none;
    overflow-y: auto;
    transition: opacity 0.3s, visibility 0.3s;
    margin: 0;
    padding: 0;
  }
  
  .tabcontent.active {
    display: block;
    opacity: 1;
    visibility: visible;
    margin-bottom: 15px;
  }
  
  /* Hidden dropdown area */
  /* #myTabContent,
  .tab-content,
  .dropdown-area {
    margin: 0;
    padding: 0;
  } */
  
  /* Animations */
  @keyframes updatePulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
  }
  
  @keyframes loadingBar {
    0% { width: 0; opacity: 0.5; }
    50% { opacity: 1; }
    100% { width: 100%; opacity: 0.5; }
  }
  
  .service-card.updating {
    animation: updatePulse 0.5s ease;
  }
  
  .service-card.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--card-border-hover);
    animation: loadingBar 2s infinite linear;
  }
  
  /* Mobile styles */
  @media (max-width: 768px) {
    :root {
      --card-padding: 10px;
      --card-margin: 3px;
    }
  
    .service-name {
      font-size: 16px !important;
    }
  
    #myTab {
      flex-direction: column;
      gap: 5px;
      padding: 0;
      margin: 0;
    }
  
    [id$="-tab"] {
      width: 100%;
      text-align: center;
      padding: 15px;
      justify-content: center;
      align-items: center;
    }
  
    .tabcontent {
      padding: 0;
      margin: 0;
    }
  
  }
  
  @media (max-width: 480px) {
    [id$="-tab"] {
      font-size: 12px !important;
    }
  
    #myTab {
      gap: 3px;
    }
  }
  
  .home-assistant {
    height: 850px;
    margin: -10px 0px 0px 0px;
  }

  .glance {
    height: 850px;
    margin: -10px 0px 0px 0px;
  }

  /* Special selectors */
  /* #headlessui-disclosure-panel-\:r6\: > ul:nth-child(1) > li:nth-child(1) > div:nth-child(1) > div:nth-child(1) {
    margin: -100px;
  } */