/* ============================================
   365Calculator.online - Main Stylesheet
   Dark Professional Theme | RTL Arabic
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0f1419;
  --bg-secondary: #1a202c;
  --bg-card: #1e293b;
  --bg-elevated: #273344;
  --bg-input: #0f172a;
  --border-color: #2d3748;
  --border-accent: #374151;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-primary: #10b981;
  --accent-secondary: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  --accent-warm: #f59e0b;
  --danger: #ef4444;
  --success: #22c55e;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --max-width: 1200px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Tajawal', 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
}

/* ========== Container ========== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ========== Header / Navigation ========== */
.site-header {
  background: rgba(15, 20, 25, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  font-weight: 700;
}

.nav-menu {
  display: flex;
  gap: 4px;
  list-style: none;
}

.nav-menu a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  position: relative;
}

.nav-menu a:hover,
.nav-menu a.active {
  color: var(--accent-primary);
  background: rgba(16, 185, 129, 0.1);
}

.nav-menu .has-dropdown {
  position: relative;
}

.dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition);
  list-style: none;
}

.has-dropdown:hover .dropdown,
.has-dropdown:focus-within .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown a {
  display: block;
  padding: 10px 14px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
}

.mobile-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  font-size: 1.5rem;
  cursor: pointer;
}

/* ========== Hero ========== */
.hero {
  padding: 60px 0 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 100%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  margin-bottom: 18px;
  line-height: 1.3;
  background: linear-gradient(135deg, #f8fafc 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 780px;
  margin: 0 auto 30px;
  position: relative;
}

/* Hero Image Section */
.hero-image {
  width: 100%;
  max-width: 1200px;
  margin: 30px auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.hero-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* Responsive hero images */
@media (max-width: 768px) {
  .hero-image {
    margin: 20px auto;
    border-radius: var(--radius-md);
  }
}

.cta-group {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  font-family: inherit;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-accent);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-primary);
}

/* ========== Sections ========== */
section {
  padding: 50px 0;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  margin-bottom: 12px;
  text-align: center;
}

.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 40px;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

/* ========== Tools Grid ========== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 3px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.tool-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.tool-card:hover::before {
  transform: scaleX(1);
}

.tool-icon {
  font-size: 2rem;
  margin-bottom: 14px;
  display: inline-block;
}

.tool-icon img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
}

.tool-card h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.tool-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ========== Calculator Widget ========== */
.calculator {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  margin: 30px 0;
  box-shadow: var(--shadow-md);
}

.calc-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.calc-tab {
  flex: 1;
  min-width: 100px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  transition: var(--transition);
}

.calc-tab.active {
  background: var(--accent-gradient);
  color: white;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: left 14px center;
  background-size: 18px;
  padding-left: 40px;
}

.calendar-toggle {
  display: flex;
  gap: 8px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-sm);
  width: fit-content;
  margin-bottom: 20px;
}

.calendar-toggle-btn {
  padding: 8px 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
}

.calendar-toggle-btn.active {
  background: var(--accent-primary);
  color: white;
}

.input-mode-toggle {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 15px 0;
}

.input-mode-btn {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
}

.input-mode-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.input-mode-btn.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.form-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
  text-align: center;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-input::placeholder {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.calc-submit {
  width: 100%;
  padding: 16px;
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 10px;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.calc-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

/* ========== Results ========== */
.results {
  margin-top: 30px;
  display: none;
  animation: fadeInUp 0.5s ease;
}

.results.show {
  display: block;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  text-align: center;
  padding: 20px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  color: white;
}

.result-header h3 {
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.result-header .big-number {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 8px 0;
}

.result-header .subtitle {
  opacity: 0.95;
  font-size: 0.95rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.result-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.result-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-primary);
}

.result-card .value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-primary);
  display: block;
  font-variant-numeric: tabular-nums;
}

.result-card .label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: block;
}

.result-card .icon {
  font-size: 1.4rem;
  margin-bottom: 6px;
  display: block;
}

.result-section {
  margin-top: 24px;
}

.result-section h4 {
  font-size: 1.1rem;
  margin-bottom: 14px;
  color: var(--text-primary);
  padding-right: 14px;
  border-right: 3px solid var(--accent-primary);
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border-right: 3px solid var(--accent-secondary);
  gap: 12px;
  flex-wrap: wrap;
}

.info-row .lbl {
  color: var(--text-muted);
  font-weight: 500;
}

.info-row .val {
  color: var(--text-primary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.countdown-box {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  padding: 20px;
  border-radius: var(--radius-md);
  text-align: center;
  color: white;
  margin-top: 16px;
}

.countdown-box h4 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: white;
  border: none;
  padding: 0;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.countdown-item {
  background: rgba(255,255,255,0.15);
  padding: 12px 6px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
}

.countdown-item .num {
  font-size: 1.6rem;
  font-weight: 700;
  display: block;
  font-variant-numeric: tabular-nums;
}

.countdown-item .lbl {
  font-size: 0.8rem;
  opacity: 0.95;
}

/* ========== Content / Articles ========== */
.content-wrapper {
  max-width: 860px;
  margin: 0 auto;
}

.content-wrapper h2 {
  font-size: 1.6rem;
  margin: 40px 0 16px;
  padding-right: 16px;
  border-right: 4px solid var(--accent-primary);
  font-weight: 700;
}

.content-wrapper h3 {
  font-size: 1.25rem;
  margin: 28px 0 12px;
  color: var(--accent-secondary);
}

.content-wrapper p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 1.05rem;
}

.content-wrapper ul, .content-wrapper ol {
  color: var(--text-secondary);
  padding-right: 24px;
  margin-bottom: 16px;
}

.content-wrapper li {
  margin-bottom: 8px;
}

.content-wrapper a {
  color: var(--accent-primary);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent-primary);
}

.content-wrapper a:hover {
  color: var(--accent-secondary);
  border-bottom-style: solid;
}

.content-wrapper strong {
  color: var(--text-primary);
  font-weight: 700;
}

.content-wrapper table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.content-wrapper th, .content-wrapper td {
  padding: 12px 16px;
  text-align: right;
  border-bottom: 1px solid var(--border-color);
}

.content-wrapper th {
  background: var(--bg-elevated);
  color: var(--accent-primary);
  font-weight: 700;
}

.content-wrapper tr:last-child td {
  border-bottom: none;
}

/* ========== FAQ ========== */
.faq-list {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  transition: var(--transition);
}

.faq-item:hover {
  border-color: var(--accent-primary);
}

.faq-question {
  width: 100%;
  padding: 18px 22px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  text-align: right;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq-question::after {
  content: '+';
  font-size: 1.5rem;
  color: var(--accent-primary);
  transition: var(--transition);
  flex-shrink: 0;
}

.faq-item.active .faq-question::after {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
  max-height: 800px;
}

.faq-answer p {
  padding: 0 22px 20px;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ========== Breadcrumb ========== */
.breadcrumb {
  padding: 14px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent-primary);
}

.breadcrumb .sep {
  margin: 0 8px;
  opacity: 0.5;
}

/* ========== AdSense Placeholder ========== */
.ad-container {
  margin: 30px auto;
  padding: 20px;
  background: var(--bg-card);
  border: 1px dashed var(--border-accent);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
}

.ad-container::before {
  content: '— مساحة إعلانية —';
}

/* ========== Footer ========== */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 50px 0 20px;
  margin-top: 60px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.footer-col h4 {
  color: var(--text-primary);
  font-size: 1.05rem;
  margin-bottom: 14px;
  font-weight: 700;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 8px;
}

.footer-col a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: var(--transition);
}

.footer-col a:hover {
  color: var(--accent-primary);
}

.footer-col p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ========== Features List ========== */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.feature-item {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.feature-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.feature-item h4 {
  color: var(--text-primary);
  margin-bottom: 6px;
  font-size: 1rem;
}

.feature-item p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

/* ========== Error message ========== */
.error-msg {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
  display: none;
  font-size: 0.9rem;
}

.error-msg.show {
  display: block;
}

/* ========== Today's Date Banner ========== */
.today-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  margin-bottom: 0px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.85rem;
}

.today-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.today-item .label {
  color: var(--text-muted);
}

.today-item .value {
  font-weight: 600;
  color: var(--text-primary);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .nav-menu {
    display: none;
    position: absolute;
    top: 70px;
    right: 0;
    left: 0;
    background: var(--bg-card);
    flex-direction: column;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 4px;
  }
  .nav-menu.active { display: flex; }
  .nav-menu a { padding: 12px 16px; }
  .dropdown { position: static; opacity: 1; visibility: visible; transform: none; background: transparent; border: none; padding-right: 16px; margin-top: 4px; box-shadow: none; }
  .has-dropdown > a::after { content: ' ▾'; font-size: 0.8rem; }
  .mobile-toggle { display: flex; align-items: center; justify-content: center; }
  .hero { padding: 40px 0 20px; }
  section { padding: 35px 0; }
  .calculator { padding: 20px; border-radius: var(--radius-md); }
  .result-header .big-number { font-size: 2rem; }
  .countdown-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .cta-group { flex-direction: column; }
  .btn { width: 100%; }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .result-card { padding: 14px; }
  .result-card .value { font-size: 1.4rem; }

  /* Mobile styling for today's banner to look compact */
  .today-banner {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 16px;
    padding: 8px 10px;
    font-size: 0.8rem;
  }
}

/* ========== Utilities ========== */
.text-center { text-align: center; }
.mb-3 { margin-bottom: 24px; }
.mt-3 { margin-top: 24px; }
.hidden { display: none !important; }

/* ========== Tag ========== */
.tag {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-primary);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}
