/* فونت و پایه */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Vazirmatn', sans-serif;
  background: #000;
  color: #eee;
  overflow-x: hidden;
}

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

/* پس‌زمینه */
#bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
}

/* کنترل‌های تغییر تم و زبان */
.controls {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  gap: 0.5rem;
}

.controls button {
  padding: 0.5rem 0.8rem;
  font-size: 0.9rem;
  border-radius: 5px;
  background: rgba(94, 51, 191, 0.9);
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  min-width: 40px;
}

.controls button:hover {
  background: rgba(87, 61, 147, 0.9);
  transform: translateY(-2px);
}

/* هدر */
header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  background: #111;
  color: #eee;
  margin-top: 0;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

/* محتوای اصلی */
main.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem 1rem;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.container {
  background: #111;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(34, 34, 34, 0.5);
  text-align: center;
  width: 100%;
}

/* فرم المنت‌ها */
input[type="url"],
input[type="password"],
input[type="text"] {
  width: 100%;
  margin: 0.7rem 0;
  padding: 0.8rem;
  border-radius: 5px;
  border: 1px solid #333;
  font-size: 1rem;
  background: #222;
  color: #eee;
  transition: all 0.3s ease;
}

input[type="url"]:focus,
input[type="password"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: #5e33bf;
  box-shadow: 0 0 5px rgba(94, 51, 191, 0.3);
}

button {
  background: #5e33bf;
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  margin-top: 1rem;
  font-size: 1.1rem;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

button:disabled {
  background: #444;
  cursor: not-allowed;
}

button:hover:not(:disabled) {
  background: #573d93;
  transform: translateY(-2px);
}

/* پروگرس بار */
#progressBar {
  width: 100%;
  height: 12px;
  background: #222;
  border-radius: 8px;
  margin: 1rem 0;
  overflow: hidden;
}

#progressBar .bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #5e33bf, #573d93);
  transition: width 0.3s ease;
  border-radius: 8px;
}

/* کادر نمایش لینک موفق */
#resultBox {
  margin-top: 1rem;
  background: #222;
  padding: 1rem;
  border-radius: 6px;
  word-wrap: break-word;
  border: 1px solid #333;
}

#resultBox a {
  color: #5e33bf;
  text-decoration: none;
}

#resultBox a:hover {
  text-decoration: underline;
}

/* فوتر */
footer {
background: var(--card-bg);
    padding: 1rem 2rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* تم روشن */
body.light {
  background: #f5f5f5;
  color: #222;
}

body.light header,
body.light footer {
  background: #fff;
  color: #222;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

body.light .container {
  background: #fff;
  color: #222;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

body.light input[type="url"],
body.light input[type="password"],
body.light input[type="text"] {
  background: #f9f9f9;
  color: #222;
  border: 1px solid #ddd;
}

body.light input[type="url"]:focus,
body.light input[type="password"]:focus,
body.light input[type="text"]:focus {
  border-color: #5e33bf;
  background: #fff;
}

body.light #resultBox {
  background: #f9f9f9;
  border: 1px solid #ddd;
}

body.light .controls button {
  background: rgba(255, 255, 255, 0.9);
  color: #5e33bf;
  border: 1px solid #5e33bf;
}

body.light .controls button:hover {
  background: #5e33bf;
  color: white;
}

/* راست‌چین در فارسی */
body[dir="rtl"] {
  direction: rtl;
}

body[dir="rtl"] input[type="url"],
body[dir="rtl"] input[type="password"],
body[dir="rtl"] input[type="text"] {
  text-align: right;
}

body[dir="rtl"] .controls {
  right: auto;
  left: 1rem;
}

/* تنظیمات موبایل */
@media (max-width: 768px) {
  .controls {
    top: 0.5rem;
    right: 0.5rem;
    flex-direction: row;
    gap: 0.3rem;
  }
  
  .controls button {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    min-width: 35px;
  }
  
  header {
    padding: 3rem 1rem 1rem;
  }
  
  header h1 {
    font-size: 1.2rem;
  }
  
  main.container {
    padding: 1rem 0.5rem;
  }
  
  .container {
    padding: 1.5rem;
    margin: 0 0.5rem;
  }
  
  input[type="url"],
  input[type="password"],
  input[type="text"] {
    padding: 0.7rem;
    font-size: 0.9rem;
  }
  
  button {
    padding: 0.7rem 1rem;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .controls {
    top: 0.3rem;
    right: 0.3rem;
  }
  
  .controls button {
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
    min-width: 30px;
  }
  
  header {
    padding: 2.5rem 0.5rem 1rem;
  }
  
  header h1 {
    font-size: 1rem;
  }
  
  .container {
    padding: 1rem;
    margin: 0 0.3rem;
  }
}

/* انیمیشن‌ها */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.container {
  animation: fadeIn 0.5s ease-out;
}

/* بهبود accessibility */
button:focus,
input:focus {
  outline: 2px solid #5e33bf;
  outline-offset: 2px;
}

/* حالت loading */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

.loading button {
  background: #666;
  cursor: wait;
}

#resultBox {
  margin-top: 20px;
  background: rgba(0,0,0,0.4);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  display: none;
  font-weight: bold;
  word-break: break-word;
}

body.light-mode #resultBox {
  background: rgba(255,255,255,0.9);
}

a:-webkit-any-link {
    color: #fff;
    text-decoration: none;
    direction: ltr;
    flex-grow: 1;
    margin-left: 0.5rem;
}
