

/* === Reset & Base === */
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background-color: #f4f4f4;
  color: #333;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
  display: flex;
  flex-direction: column;
}


body.dark-mode {
  background-color: #1a1a1a;
  color: #f4f4f4;
}

/* === Header === */
header {
  background-color: #0069d9;
  color: white;
  padding: 15px 20px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo h1 {
  margin: 0;
  font-size: 1.8em;
}

.logo {
  text-decoration: none;
  color: white;
}

.dark-mode-toggle {
  background-color: transparent;
  border: 1px solid #fff;
  color: #fff;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
  font-weight: bold;
  font-size: 14px;
  margin-left: 10px;
}

.dark-mode-toggle:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* === Hamburger Menu === */
.hamburger-menu {
  cursor: pointer;
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 25px;
  z-index: 1001;
}

.hamburger-menu .bar {
  display: block;
  height: 3px;
  background-color: white;
  border-radius: 3px;
  transition: all 0.3s ease-in-out;
}

.sidebar.open .hamburger-menu .bar:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.sidebar.open .hamburger-menu .bar:nth-child(2) {
  opacity: 0;
}
.sidebar.open .hamburger-menu .bar:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* === Sidebar === */
.sidebar {
  position: fixed;
  top: 0;
  left: -250px;
  width: 250px;
  height: 100%;
  background-color: #fff;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
  transition: left 0.3s ease;
  z-index: 1000;
  padding-top: 60px;
}

.sidebar.open {
  left: 0;
}

.sidebar ul {
  list-style: none;
  padding: 0;
}

.sidebar ul li a {
  text-decoration: none;
  color: #333;
  display: block;
  padding: 15px 20px;
  transition: background-color 0.3s;
}

.sidebar ul li a:hover {
  background-color: #e9e9e9;
}

/* === Dark Mode Sidebar === */
body.dark-mode .sidebar {
  background-color: #2c2c2c;
  color: #f4f4f4;
}
body.dark-mode .sidebar ul li a {
  color: #f4f4f4;
}

/* لون الخط في الوضع الداكن */
body.dark-mode select,
body.dark-mode input,
body.dark-mode label {
  color: #f4f4f4;
}

body.dark-mode .input-group label {
  color: #f4f4f4;
}


body.dark-mode .sidebar ul li a:hover {
  background-color: #444;
}

/* === Dropdowns === */
.dropdown-content {
  display: none;
  background-color: #f4f4f4;
  padding-left: 20px;
}

.dropdown-content a {
  color: #333;
  text-decoration: none;
}

.dropdown-item a .arrow {
  float: right;
  transition: transform 0.3s;
}

.dropdown-item.active .dropdown-content {
  display: block;
}

.dropdown-item.active .arrow {
  transform: rotate(180deg);
}

body.dark-mode .dropdown-content {
  background-color: #333;
}
body.dark-mode .dropdown-content a {
  color: #f4f4f4;
}

/* === Main Content === */
main {
  flex: 1;
  text-align: center;
  padding: 40px 20px;
}

h2 {
  color: #333;
}

body.dark-mode h2,
body.dark-mode p {
  color: #f4f4f4;
}

/* === Tool Icons === */
.tool-icons-container {
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
  margin-top: 40px;
}

/* لون النص في الوضع الداكن للأيقونات */
body.dark-mode .icon-card h3 {
  color: #f4f4f4 !important;
}

body.dark-mode .icon-card .icon-emoji {
  color: #f4f4f4 !important;
}

.icon-card {
  position: relative;
  width: 150px;
  text-align: center;
  transition: transform 0.3s;
}

.icon-card:hover {
  transform: translateY(-5px);
}

.icon-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  width: 100%;
  height: 150px;
  text-decoration: none;
  color: #333;
  transition: background-color 0.3s, color 0.3s;
}

/* === إزالة الخطوط من الأيقونات === */
.icon-card a {
  text-decoration: none !important;
  color: #f4f4f4;
  outline: none;
  border: none;
}

/* لون النص في الوضع الداكن */
body.dark-mode .icon-card a h3 {
  color: #f4f4f4 !important;
}

body.dark-mode .icon-card a span {
  color: #f4f4f4 !important;
}

.icon-card a h3 {
  text-decoration: none !important;
  border-bottom: none !important;
  outline: none;
  margin: 0;
}

.icon-emoji {
  font-size: 3em;
  margin-bottom: 10px;
}

.icon-label {
  font-weight: bold;
  color: #000;
  font-size: 1em;
}

.icon-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: white;
  min-width: 200px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 1;
  border-radius: 4px;
  margin-top: 10px;
  flex-direction: column;
  padding: 5px 0;
}

.icon-dropdown a {
  padding: 10px;
  text-decoration: none;
  color:#333;
  transition: background-color 0.3s, color 0.3s;
}

.icon-card.active .icon-dropdown {
  display: flex;
}

/* === Dark Mode Icons === */
body.dark-mode .icon-box {
  background-color: #2c2c2c;
  color: #f4f4f4;
}

body.dark-mode .icon-dropdown {
  background-color: #333;
}
body.dark-mode .icon-dropdown a {
  color: #f4f4f4;
}
.icon-dropdown a:hover {
  background-color: #f4f4f4;
}
body.dark-mode .icon-dropdown a:hover {
  background-color: #444;
}

/* === Categories === */
.converter-categories {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

.category {
  width: 150px;
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  border-radius: 12px;
  background-color: #fff;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s;
  text-align: center;
  cursor: pointer;
}

.category:hover {
  transform: scale(1.05);
  background-color: #e6f7ff;
}

/* === Color Box === */
.color-box {
  width: 150px;
  height: 150px;
  border: 2px solid #333;
  border-radius: 8px;
  margin: 20px auto;
  transition: background-color 0.3s;
}

body.dark-mode .color-box {
  border: 2px solid #f4f4f4;
}

/* === Footer === */
footer {
  width: 100%;
  text-align: center;
  padding: 15px;
  background-color: #333;
  color: white;
  transition: background-color 0.3s;
}

body.dark-mode footer {
  background-color: #111;
}

/* === Responsive === */
@media (max-width: 768px) {
  .hamburger-menu {
    display: flex;
  }
  .dark-mode-toggle {
    display: none;
  }
}

.category-icon {
  font-size: 3em;
  margin-bottom: 10px;
}

.category-label {
  font-weight: bold;
  color: #000;
  font-size: 1em;
}

/* === إصلاح ألوان جميع الأدوات في الوضع الداكن === */

/* Password Generator */
body.dark-mode #length,
body.dark-mode #passwordOutput {
  color: #f4f4f4 !important;
  background-color: #333 !important;
  border: 1px solid #555 !important;
}

body.dark-mode .options-group label {
  color: #f4f4f4 !important;
}

/* Color Generator */
body.dark-mode #hexInput {
  color: #f4f4f4 !important;
  background-color: #333 !important;
  border: 1px solid #555 !important;
}

body.dark-mode #color-hex-code {
  color: #f4f4f4 !important;
}

/* Converter Tools */
body.dark-mode select,
body.dark-mode input[type='file'],
body.dark-mode input[type='range'] {
  color: #f4f4f4 !important;
  background-color: #333 !important;
  border: 1px solid #555 !important;
}

body.dark-mode #qualityValue,
body.dark-mode #message {
  color: #f4f4f4 !important;
}

/* Unit Tools */
body.dark-mode .unit-label {
  color: #f4f4f4 !important;
}

body.dark-mode .unit-selector,
body.dark-mode select[id$='From'],
body.dark-mode select[id$='To'] {
  color: #f4f4f4 !important;
  background-color: #333 !important;
  border: 1px solid #555 !important;
}

body.dark-mode input[id$='Input'],
body.dark-mode input[id$='Result'] {
  color: #f4f4f4 !important;
  background-color: #333 !important;
  border: 1px solid #555 !important;
}

/* زر Dark Mode في قائمة الهامبرغر */
.dark-mode-mobile {
    border-top: 1px solid #ccc;
    margin-top: 10px;
    padding-top: 10px;
    width: 100%;
}

body.dark-mode .dark-mode-mobile {
    border-top: 1px solid #555;
}

/* زر Dark Mode في قائمة الهامبرغر - متناسق مع القائمة */
.dark-mode-toggle-menu {
    display: block;
    width: calc(100% - 40px); /* تقليل العرض قليلاً */
    margin: 0 auto; /* توسيط الزر */
    padding: 15px 20px;
    background-color: transparent;
    border: 1px solid #ccc;
    color: #333;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    border-radius: 5px;
    text-decoration: none;
    transition: background-color 0.3s;
    box-sizing: border-box;
}

body.dark-mode .dark-mode-toggle-menu {
    background-color: #333;
    border: 1px solid #555;
    color: #f4f4f4;
}

.dark-mode-toggle-menu:hover {
    background-color: #e9e9e9;
}

body.dark-mode .dark-mode-toggle-menu:hover {
    background-color: #444;
}

/* إخفاء الزر في سطح المكتب */
@media (min-width: 769px) {
    #darkModeToggleMobile {
        display: none;
    }
}

@media (max-width: 768px) {
    .dark-mode-toggle { /* الزر العلوي */
        display: none !important;
    }
}