/* CSS Variables */
:root {
  --bg-dark: #240024;
  --panel-main: #490049;
  --panel-alt: #5a045a;
  --panel-deep: #380238;
  --accent: #74006e;
  --text: #ffffff;
  --muted: #f0f0f0;
}

/* Fonts */
@font-face {
  font-family: "lulo";
  src: url("../fonts/lulo.otf") format("opentype");
}

@font-face {
  font-family: "avenir";
  src: url("../fonts/avenir.ttf") format("truetype");
}

/* Global Styles */
html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-dark);
  color: var(--text);
  font-family: "avenir", sans-serif;
}

/* Shell */
.dashboard-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--panel-main);
  border-bottom: 2px solid var(--accent);
}

.dashboard-header h1 {
  font-family: "lulo", sans-serif;
  margin: 0;
  font-size: 20px;
}

.dashboard-header p {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.dashboard-status {
  text-align: right;
  font-size: 12px;
}

/* Main Layout */
.dashboard-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left Panel */
.feed-panel {
  width: 35%;
  background: var(--panel-deep);
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--accent);
}

.feed-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: var(--panel-main);
}

.feed-panel-header h2 {
  margin: 0;
  font-size: 14px;
}

.feed-panel-header button {
  background: var(--accent);
  border: none;
  color: white;
  padding: 5px 10px;
  cursor: pointer;
}

.feed-panel-header button:hover {
  background: var(--panel-alt);
}

/* List */
.feed-list {
  overflow-y: auto;
  flex: 1;
}

/* Article */
.feed-item {
  padding: 10px;
  border-bottom: 1px solid var(--panel-alt);
  cursor: pointer;
}

.feed-item:hover {
  background: var(--panel-main);
}

.feed-title {
  font-weight: bold;
  font-size: 13px;
}

.feed-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

.feed-summary {
  font-size: 12px;
  margin-top: 5px;
}

/* Right Panel */
.reader-panel {
  flex: 1;
  background: rgb(53, 0, 46);
  position: relative;
  overflow: hidden;
}

.reader-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
}

#articleFrame {
  width: 100%;
  height: 100%;
  border: none;
}

.reader-fallback {
  background: var(--panel-deep);
  border-bottom: 2px solid var(--accent);
  padding: 10px;
  font-size: 13px;
}

.reader-fallback p {
  margin: 0 0 5px;
}

.reader-fallback a {
  color: var(--text);
  text-decoration: underline;
}

.desktop-article-card {
  max-width: 85%;
  margin: 40px auto;
  padding: 25px;
  background: var(--panel-deep);
  border: 2px solid var(--accent);
  max-height: calc(100vh - 270px);
  overflow-y: auto;
}

.desktop-article-source {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.desktop-article-card h2 {
  margin: 0 0 10px;
  font-family: "lulo", sans-serif;
  font-size: 20px;
}

.desktop-article-date {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px;
}

.desktop-article-card p {
  font-size: 16px;
  line-height: 2;
}

.desktop-open-link {
  display: inline-block;
  margin-top: 20px;
  background: var(--accent);
  color: var(--text);
  padding: 10px 15px;
  text-decoration: none;
}

.desktop-open-link:hover {
  background: var(--panel-alt);
}

.desktop-article-card::-webkit-scrollbar {
  width: 6px;
}

.desktop-article-card::-webkit-scrollbar-thumb {
  background: var(--accent);
}

.desktop-article-card::-webkit-scrollbar-track {
  background: transparent;
}

/* Mobile Modal */
.mobile-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mobile-article-card {
  margin: 60px 15px 20px;
  padding: 20px;
  background: var(--panel-deep);
  border: 2px solid var(--accent);
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.mobile-modal::-webkit-scrollbar,
.mobile-article-card::-webkit-scrollbar {
  width: 6px;
}

.mobile-modal::-webkit-scrollbar-thumb,
.mobile-article-card::-webkit-scrollbar-thumb {
  background: var(--accent);
}

.mobile-modal::-webkit-scrollbar-track,
.mobile-article-card::-webkit-scrollbar-track {
  background: transparent;
}

/* Hover effect (optional) */
.mobile-modal::-webkit-scrollbar-thumb:hover,
.mobile-article-card::-webkit-scrollbar-thumb:hover {
  background: var(--panel-alt);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--accent);
  border: none;
  color: white;
  padding: 5px 10px;
  cursor: pointer;
  z-index: 1001;
}

.modal-close:hover {
  background: var(--panel-alt);
}

#mobileArticleFrame {
  width: 100%;
  height: 100%;
  border: none;
}

/* Loading */
.loading-message {
  padding: 15px;
  font-size: 12px;
  color: var(--muted);
}

/* Scrollbar */
.feed-list::-webkit-scrollbar {
  width: 6px;
}

.feed-list::-webkit-scrollbar-thumb {
  background: var(--accent);
}


/* Search */
.search-input {
  width: calc(100% - 20px);
  margin: 10px;
  padding: 8px;
  background: var(--panel-deep);
  border: 1px solid var(--accent);
  color: var(--text);
}

.search-input::placeholder {
  color: var(--muted);
}

.new-badge {
  color: #ffffff;
  margin-right: 5px;
  font-weight: bold;
}

.tag-row {
  margin-top: 6px;
}

.tag-badge {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 6px;
  background: var(--accent);
  color: var(--text);
  font-size: 10px;
}

/* Security Panel */
#security-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;

  margin: 0px 0;
  padding: 15px;
  background: var(--panel-deep);
  border: 1px solid var(--accent);

  max-height: 360px;
  overflow: hidden;
}

.security-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-shrink: 0;
}

.security-top h2 {
  margin: 0;
  white-space: nowrap;
  font-size: 14px;
}

#security-summary {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

#security-summary div {
  white-space: nowrap;
}

#security-alerts {
  max-height: 260px;
  overflow-y: auto;
  padding-right: 8px;
}

.alert-card {
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  word-break: break-word;
  background: var(--panel-main);
  font-size: 12px;
}

.alert-card.high {
  color: #ff4d4d;
}

.alert-card.medium {
  color: #ffaa00;
}

.alert-card.low {
  color: #66ccff;
}

.alert-card small {
  overflow-wrap: anywhere;
}

#securityToggle {
    background: var(--accent);
    color: var(--text);
    border: skyblue 1px solid;
    padding: 4px 8px;
    cursor: pointer;
}

#security-alerts.is-collapsed {
    display: none;
}

#security-alerts {
    max-height: 260px;
    overflow-y: auto;
    padding-right: 8px;
}

#security-alerts::-webkit-scrollbar {
  width: 6px;
}

#security-alerts::-webkit-scrollbar-thumb {
  background: var(--accent);
}

#security-alerts::-webkit-scrollbar-track {
  background: transparent;
}

/* Mobile Styles */

@media (max-width: 768px) {

  .dashboard-layout {
    flex-direction: column;
  }

  .feed-panel {
    width: 100%;
    height: 100%;
  }

  .reader-panel {
    display: none;
  }

}

.is-hidden {
  display: none !important;
}