/* ========== LAYOUT GENERAL ========== */

/* Container principal */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ========== TOPBAR - Modern Redesign ========== */
.topbar {
  width: 100%;
  background: rgba(var(--card-bg-rgb), 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7em 1em;
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 56px;
  flex-shrink: 0;
  box-sizing: border-box;
  gap: 0.5em;
  transition: all 0.3s ease;
}

.topbar:hover {
  background: rgba(var(--card-bg-rgb), 0.95);
}

.topbar a#homeLink {
  font-weight: 700;
  font-size: 1.1em;
  color: var(--accent2);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
  transition: color 0.2s ease;
}

.topbar a#homeLink:hover {
  color: var(--accent1);
}

.top-menu {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Butonul de toggle pentru dark/light mode */
.mode-toggle {
  padding: 0.4em 0.6em;
  font-size: 0.9rem;
  min-width: auto;
  border-radius: var(--radius);
  transition: all 0.2s ease;
  background: rgba(var(--accent1-rgb), 0.1);
}

.mode-toggle:hover {
  background: rgba(var(--accent1-rgb), 0.2);
}

/* Ascunde textul "Dark/Light" pe ecrane mici */
#modeText {
  display: inline;
}

/* Dropdown button */
#toolsDropdownBtn {
  padding: 0.4em 0.6em;
  font-size: 0.9rem;
  border-radius: var(--radius);
  transition: all 0.2s ease;
  background: rgba(var(--accent1-rgb), 0.1);
}

#toolsDropdownBtn:hover {
  background: rgba(var(--accent1-rgb), 0.2);
}

/* Butonul de settings */
.settings-btn {
  width: 32px !important;
  height: 32px !important;
  font-size: 16px !important;
  border-radius: 50% !important;
  transition: all 0.2s ease !important;
  background: rgba(var(--accent1-rgb), 0.1) !important;
}

.settings-btn:hover {
  background: rgba(var(--accent1-rgb), 0.2) !important;
  transform: scale(1.05) !important;
}
/* Asigură culoarea corectă a textului în topbar */
.topbar .top-menu button,
.topbar #toolsDropdownBtn,
.topbar .settings-btn {
  color: var(--text);
}

/* Opțional: mărește ușor contrastul la hover */
.topbar .top-menu button:hover,
.topbar #toolsDropdownBtn:hover {
  opacity: 0.9;
}

/* Dropdown menu */
#toolsDropdown {
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 200px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(5px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

#toolsDropdown.active {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Adaptări pentru tableta */
@media (max-width: 768px) {
  .topbar {
    padding: 0.5em 0.8em;
  }
  
  .topbar a#homeLink {
    font-size: 1em;
  }
  
  #modeText {
    display: none;
  }
}

/* Adaptări pentru telefoane mobile - ASCUNDEM TOOLS DROPDOWN */
@media (max-width: 480px) {
  .topbar {
    padding: 0.4em 0.6em;
    min-height: 48px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--card-bg);
  }
  
  .topbar a#homeLink {
    font-size: 0.8em;
    max-width: 60%; /* Increased from 40% since no tools dropdown */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .top-menu {
    gap: 8px; /* Increased gap since we have fewer buttons */
  }
  
  /* ASCUNDEM COMPLET TOOLS DROPDOWN PE MOBILE */
  #toolsDropdownBtn,
  #toolsDropdown {
    display: none !important;
  }
  
  .mode-toggle {
    padding: 0.3em 0.5em;
    font-size: 0.8rem;
  }
  
  .settings-btn {
    width: 28px !important;
    height: 28px !important;
    font-size: 14px !important;
  }
}

/* Pentru ecrane foarte mici */
@media (max-width: 360px) {
  .topbar a#homeLink {
    font-size: 0.8em;
    max-width: 65%; /* Even more space without tools dropdown */
  }
  
  .top-menu {
    gap: 6px;
  }
}

/* ========== TOOLS DROPDOWN – DESKTOP ONLY ========== */
@media (min-width: 481px) {
  #toolsDropdown {
    position: absolute;
    right: 0;
    top: 100%;
    left: auto;
    transform: none;
    min-width: 240px;
    max-width: 100vw;
    box-sizing: border-box;
  }
}

/* Dropdown overlay - doar pentru desktop */
.dropdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9;
  display: none;
}

@media (min-width: 481px) {
  .dropdown.active + .dropdown-overlay {
    display: block;
  }
}

/* ========== RÂND CARD-URI UNELTE ========== */
.tool-cards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1em;
  padding: 0.7em 2em;
  margin-bottom: 1.2em;
  justify-items: center;
  align-items: stretch;
}

/* ========== CONȚINUT PRINCIPAL ========== */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto 2em auto;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.2em 1.5em;
  display: none;
  flex-direction: column;overflow: visible;
}

/* ========== PLACEHOLDER ADSENSE ========== */
.adsense-placeholder {
  width: 100%;
  min-height: 90px;
  background: var(--card-bg);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border-radius: var(--radius);
  margin: 1.2em auto;
  box-shadow: var(--shadow);
  border: 2px dashed var(--accent1);
  max-width: 900px;
}

/* ========== RESPONSIVE GRID ========== */

/* Tablet: 2 coloane */
@media (max-width: 900px) {
  .main-content,
  .adsense-placeholder {
    max-width: 98vw;
    padding: 1em;
  }

  .tool-cards-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .topbar {
    padding: 0.7em;
  }
}

/* Telefon: 1 coloană */
@media (max-width: 600px) {
  .tool-cards-row {
    grid-template-columns: 1fr;
    padding: 0.7em 1em;
  }

  .tool-card {
    min-width: 140px;
    font-size: 0.98rem;
    padding: 0.8em 0.3em;
  }

  .adsense-placeholder {
    min-height: 60px;
    font-size: 0.95rem;
  }

  .main-content {
    padding: 1em 0.5em;
  }
}

/* ========== UTILITĂȚI FLEX ========== */
.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

/* ========== SPACERI VERTICALI ========== */
.mt-auto { margin-top: auto; }
.mb-0   { margin-bottom: 0; }
.mb-1   { margin-bottom: 1em; }
.mb-2   { margin-bottom: 2em; }

/* ========== LAYOUT PENTRU SECȚIUNI TOOL ========== */
.tool-section {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  flex: 1;
  width: 100%;
  flex-direction: column;overflow: visible;
  padding-bottom: 1em;
}

.tool-section.active {
  display: flex !important;
  opacity: 1;
  transform: translateY(0);
}

.tool-content-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: min-content;
}

/* ========== LINK ÎNAPOI LA TOOLS ========== */
.back-to-tools {
  display: none;
  margin-top: auto;
  margin-bottom: 0.5em;
  text-align: center;
  color: var(--accent2);
  text-decoration: none;
  font-weight: 600;
  padding: 0.5em 0;
  flex-shrink: 0;
}

/* ========== COMPACT BUTTON STYLES ========== */
.compact-btn {
  padding: 0.4em 0.6em !important;
  font-size: 0.9rem !important;
  min-width: auto !important;
}

.settings-btn {
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  font-size: 18px !important;
}