:root {
  /* Main theme colors */
  --main-color-bg: #fafbfc;
  --main-item-bg: #d6dee7;
  --main-item-bg-hover: #cad8e5;
  --main-green: #378b30;
  --main-darker-green: #0c5a39;
  --main-red: #cc0000;
  --dark-blue: #194071;
  --content-bg: #f6f8fa;
  
  /* Text colors */
  --text-primary: #214b79;
  --text-secondary: #28588d;
  --text-tertiary: #658fa9;
  --text-dark: #003f87;
  --text-light: #526991;
  --text-neutral: #353535;
  --text-white: #ffffff;
  --text-muted: #999;
  
  /* Backgrounds & borders */
  --border-light: #ddd;
  --border-medium: #ccc;
  --border-accent: #adc7e3;
  --bg-white: #fff;
  --bg-light-gray: #f3f3f3;
  --bg-medium-gray: #efefef;
  --bg-tooltip: #555;
  --bg-highlight: yellow;
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-dark: rgba(0, 0, 0, 0.004);
  
  /* Interactive */
  --tap-highlight: #b8daff5c;
  --hover-dark: #555;
  --button-dark: #333;
}

*:focus { outline: none; }
html { box-sizing: border-box; }
img, a { -webkit-tap-highlight-color: var(--tap-highlight); }
body, h2, form { margin: 0; padding: 0; }
a { text-decoration: none; }

body {
  font-family: "Montserrat", sans-serif !important;
  margin: 0;
  background-color: var(--main-color-bg);
  font-size: 16px;
  -moz-osx-font-smoothing: grayscale !important;
  text-shadow: 1px 1px 1px var(--shadow-dark);
  text-rendering: optimizeLegibility !important;
  -webkit-font-smoothing: antialiased !important;
  overflow-y: scroll;
}

.notfound404, #noContent {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#noContent {
  text-align: center;
  color: var(--dark-blue);
  justify-content: center;
  flex-direction: column;
  align-items: center;
  display: none;
}

#overlay svg { width: 100px; height: 100px; }

/* Toast Notification Styles */
.toast-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #333; /* Dark background */
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 9999;
    font-family: sans-serif;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-notification.error {
    background-color: #dc3545; /* Red for errors */
}

/* Header & Navigation */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 5px 10px;
  background-color: var(--main-item-bg);
  border-bottom: 1px solid var(--border-medium);
  box-sizing: border-box;
  /* height: 50px;   remove this */
}

.title-span {
  display: flex;
  color: var(--text-primary);
  font-size: 1.2em;
  gap: 5px;
  align-items: center;
  font-weight: bold;
}

.title-span a { color: inherit; }

.title-short { display:none; }

@media (max-width: 600px){
  .title-long { display:none; }
  .title-short { display:inline; }
}


.right-items, .right-items div {
  display: flex;
  align-items: center;
  justify-content: center;
}

.right-items div { position: relative; }

.divider {
  height: 15px;
  width: 1px;
  background-color: #acc5e1;
  align-self: center;
  margin: auto 5px;
}

.toolbar {
  width: 24px;
  height: 24px;
  cursor: pointer;
  padding: 5px;
}

.toolbar:hover {
  background-color: var(--main-item-bg-hover);
  border-radius: 50%;
}

#total_count {
  background-color: var(--content-bg);
  color: var(--text-tertiary);
  padding: 0 3px;
  border-radius: 3px;
  font-size: 0.8em;
  border: 1px solid var(--border-accent);
  transform: translateY(0.5px);
  display: none;
}

/* Filter */
#filterContainer {
  display: flex;
  align-items: center;
  position: relative;
  flex-grow: 1;
  margin: 0 15px;
}

#searchInput {
  padding: 10px;
  border: 1px solid #bbc8d7;
  border-radius: 4px;
  font-size: 16px;
  flex-grow: 1;
}

.highlight {
  background-color: var(--bg-highlight);
  font-weight: bold;
}

.hidden { display: none; }

/* News Container */
#newsContainer {
  display: block;
  margin: 0 10px;
}

.speech-bubble {
  position: relative;
  padding: 10px;
  background-color: #d8e6f3;
  border-radius: 10px;
  right: -4px;
  top: -4px;
}

ul#newsList {
  list-style-type: none;
  padding: 0;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}

/* News Items */
#newsList li {
  border: 1px solid var(--border-light);
  border-radius: 4px;
  background-color: var(--content-bg);
  position: relative;
  min-width: 0;
  width: 100%;
}

.liHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.3s ease;
  background-color: var(--main-item-bg);
  font-weight: 700;
  border: none;
  border-top-right-radius: 3px;
  border-top-left-radius: 3px;
}

.titleLink, .liHeader a.title {
  color: var(--text-secondary);
  display: inline-block;
  cursor: pointer;
}

.liHeader a.title {
  font-size: 18px;
  flex: 1;
  padding: 4px 10px;
  display: block;
  max-width: 100%;
  text-decoration: none;
}

.liContent {
  display: inline-block;
  padding: 10px;
  border-bottom-right-radius: 3px;
  border-bottom-left-radius: 3px;
  font-size: 14px;
}

.liContent .date {
  font-size: 0.9em;
  color: var(--text-dark);
  flex-shrink: 0;
}

.liContent .source > a {
  background: var(--bg-light-gray);
  color: var(--text-neutral);
  display: inline-block;
  padding: 0 2px;
  box-sizing: border-box;
  text-decoration: none;
}

/* Hover States */
li:hover .liHeader,
li:focus-within .liHeader {
  background-color: var(--main-item-bg-hover);
}

li:hover .date,
li:focus-within .date {
  color: var(--text-secondary);
}

li:hover .liContent .source a,
li:focus-within .liContent .source a {
  background-color: var(--main-item-bg-hover);
}

/* Mark Read & Tooltips */
.markRead, span.markRead {
  display: block;
  margin-left: 5px;
  cursor: pointer;
  position: relative;
  padding: 6px;
}

span.markRead { height: 24px; }

svg path, svg circle { pointer-events: none; }

.tooltiptext {
  width: max-content;
  background-color: var(--bg-tooltip);
  color: var(--text-white);
  text-align: center;
  border-radius: 6px;
  padding: 5px 10px;
  position: absolute;
  z-index: 1;
  bottom: 100%;
  margin-left: -160px;
  opacity: 1;
  transition: opacity 1s;
  font-size: 12px;
  pointer-events: none;
}

.tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 10px;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--bg-tooltip) transparent transparent transparent;
}

.settingsTooltip {
  bottom: -30px;
  right: 0px;
  font-weight: 700;
}

.settingsTooltip::after {
  top: -10px;
  right: 10px;
  border-color: transparent transparent var(--bg-tooltip) transparent;
}

/* Animations */
.swiped-right { transform: translateX(120%); transition: transform 0.2s linear; }
.swiped-left { transform: translateX(-120%); transition: transform 0.2s linear; }
.fade-out { animation: fadeOut 0.3s ease forwards; }

@keyframes fadeOut {
  0% { opacity: 1; visibility: visible; }
  100% { opacity: 0; visibility: hidden; display: none; }
}

.markAllasRead {
  display: flex;
  max-width: 100%;
  width: fit-content;
  background-color: var(--main-item-bg);
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  padding: 5px 10px;
  font-weight: 600;
  margin: 20px auto;
  border: 1px solid var(--border-accent);
  border-radius: 3px;
  cursor: pointer;
}

.markAllasRead:hover {
  background-color: var(--text-primary);
  color: var(--main-item-bg);
}

/* Settings */
#settingsLoad { display: none; }
#user-settings h2 { margin-bottom: 20px; }

.settings section {
  margin: 10px;
  padding: 20px;
  background-color: var(--bg-white);
  border-radius: 5px;
  box-shadow: 0 0 2px var(--shadow-light);
  position: relative;
}

.settings li { margin-bottom: 5px; }
.settings form { display: grid; gap: 15px; }

.settings label {
  font-weight: bold;
  margin-bottom: 5px;
  display: block;
  color: var(--text-primary);
}

.settings input,
.settings select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  box-sizing: border-box;
  height: 50px;
  font-size: 18px;
}

.settings button {
  background-color: var(--button-dark);
  color: var(--text-white);
  padding: 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  max-width: 130px;
  height: 50px;
}

.settings button:hover { background-color: var(--hover-dark); }

.settings .kapat {
  position: absolute;
  right: 15px;
  top: 15px;
  font-weight: 700;
  cursor: pointer;
}

.settings h3 { color: var(--dark-blue); }

.settings kbd {
  display: inline-block;
  padding: 0.2em 0.4em;
  font-size: 0.9em;
  color: var(--button-dark);
  background-color: #f5f5f5;
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  box-shadow: 0 2px 0 var(--shadow-light);
}

.settings .haber_var, .settings .haber_yok {
  display: flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  color: var(--content-bg);
  font-size: 12px;
  border-radius: 2px;
}

.settings .haber_var { background-color: var(--main-green); }
.settings .haber_yok { background-color: var(--main-red); }

#confirmationMessage { margin: 10px 0; display: none; }

#confirmationMessage #error {
  background-color: #ffcccc;
  color: var(--main-red);
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 2px 4px var(--shadow-light);
  border-left: 3px solid var(--main-red);
  animation: error 1s ease 0s 1 normal forwards;
  display: inline-block;
}

@keyframes error {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70% { transform: translateX(-10px); }
  20%, 40%, 60% { transform: translateX(10px); }
  80% { transform: translateX(8px); }
  90% { transform: translateX(-8px); }
}

#confirmationMessage #success {
  background-color: var(--main-green);
  color: var(--text-white);
  padding: 10px;
  border-radius: 5px;
  box-shadow: 0 2px 4px var(--shadow-light);
  border-left: 3px solid var(--main-darker-green);
  display: inline-block;
}

.settings #rssresult {
  color: var(--main-darker-green);
  display: block;
  margin-top: 10px;
  font-weight: 600;
}

.settings .rss_sil {
  color: var(--text-dark);
  cursor: pointer;
  font-weight: 500;
  border: 1px solid var(--border-light);
  padding: 0 4px;
  border-radius: 3px;
  background-color: var(--bg-medium-gray);
}

/* Tables */
.settings table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-family: Arial, sans-serif;
  border: 1px solid var(--border-light);
  border-radius: 5px;
  overflow: hidden;
}

.settings th {
  background-color: #f2f2f2;
  color: var(--dark-blue);
  font-weight: bold;
  padding: 10px;
  text-align: left;
}

.settings td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.settings tr:nth-child(even) { background-color: #f9f9f9; }
.settings tr:hover { background-color: #f2f2f2; }

/* Login Styles */
#login-register {
  background-image: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  justify-content: center;
  align-items: center;
  height: 100vh;
  display: flex;
}

.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--content-bg);
  border-radius: 8px;
  box-shadow: 0 4px 6px var(--shadow-light);
  width: 90%;
  max-width: 370px;
  padding: 50px 0;
  z-index: 1;
  border-bottom: 5px solid #d1dae9;
}

.login_title {
  font-size: 18px;
  color: var(--text-light);
  display: inline-block;
  font-weight: 600;
  margin-bottom: 15px;
}

#login-register .form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
}

#login-register .form-group.checkbox {
  flex-direction: row;
  align-items: flex-start;
}

#login-register .checkbox label { margin-left: 5px; }

#login-register label {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 5px;
  color: var(--text-light);
}

#login-register input[type="text"],
#login-register input[type="email"],
#login-register input[type="password"] {
  color: var(--text-light) !important;
}

#login-register input[type="text"],
#login-register input[type="email"],
#login-register input[type="password"],
#login-register .submit-button {
  width: 250px;
  padding: 8px;
  border-radius: 5px;
  border: 1px solid var(--border-medium);
  height: 45px;
  font-size: 1.2rem;
  font-weight: bold;
  box-sizing: border-box;
}

#login-register input[type="submit"] {
  background-color: #d8e0ec;
  color: var(--text-light);
  cursor: pointer;
  height: auto;
  border-color: #cbd3df;
  font-family: inherit;
}

.yeni_kayit {
  margin-top: 20px;
  width: 250px;
  padding: 8px;
  box-sizing: border-box;
  font-size: 0.9rem;
  display: flex;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
}

.yeni_kayit a { color: var(--text-light); }

.error-message {
  list-style: none;
  padding: 0;
  font-size: 0.8rem;
  margin-top: 0;
  margin-bottom: 15px;
}

.error-message li {
  background-color: #ffcccc;
  color: var(--main-red);
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 10px;
  box-shadow: 0 2px 4px var(--shadow-light);
  border-left: 3px solid var(--main-red);
}

.error-message li:last-of-type { margin-bottom: 5px; }

#login-register input:-webkit-autofill {
  -webkit-box-shadow: 200px 200px 100px white inset;
  box-shadow: 200px 200px 100px white inset;
}

#login-register input:-internal-autofill-selected { color: var(--text-light); }

#login-register .input-label {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  transition: top 0.3s, font-size 0.3s;
  pointer-events: none;
  color: var(--text-light);
}

#login-register .input-field {
  padding: 15px;
  border: 1px solid var(--border-medium);
  border-radius: 5px;
}

#login-register .input-field:focus + .input-label,
#login-register .input-field:not(:placeholder-shown) + .input-label {
  top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Autocomplete styles */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-light);
}

/* Media Queries */
@media (max-width: 1200px) {
  ul#newsList { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  ul#newsList { grid-template-columns: 1fr; }
}

@media screen and (max-width: 480px) {
  .liHeader a.title { white-space: normal; }
  ul#newsList { grid-template-columns: 1fr !important; }
  .settings meter { display: none; }
  .settings table { table-layout: fixed; overflow-wrap: break-word; }
}

@media (max-width: 480px) {
  header {
    flex-wrap: wrap;
    row-gap: 5px;
  }

  .title-span {
    flex-basis: 100%;
  }

  #filterContainer {
    flex-basis: 100%;
    order: 3;
    margin: 0;
  }

  .right-items {
    margin-left: auto;
    order: 2;
  }
}