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

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Almarai', Arial, sans-serif;
  background: linear-gradient(180deg, #5d1010 0%, #8b1a1a 100%);
  background-attachment: fixed;
  color: #ffffff;
  overflow-x: hidden;
}

.bulletin {
  width: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* === HEADER === */
.bulletin-header {
  position: relative;
  text-align: center;
  flex-shrink: 0;
  padding: 16px 12px 12px;
}

.corner {
  position: absolute;
  top: 10px;
  width: 0;
  height: 0;
  border-style: solid;
}

.corner-left {
  left: 10px;
  border-width: 0 0 22px 22px;
  border-color: transparent transparent #a52a2a transparent;
}

.corner-right {
  right: 10px;
  border-width: 0 22px 22px 0;
  border-color: transparent #a52a2a transparent transparent;
}

.bulletin-header h1 {
  font-size: clamp(1.15rem, 2.8vw, 2.4rem);
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: 8px;
  padding: 0 8px;
}

.datetime {
  font-size: clamp(0.8rem, 1.8vw, 1.35rem);
  font-weight: 400;
  opacity: 0.95;
  line-height: 1.5;
  padding: 0 8px;
}

/* === TABLE === */
.rates-table-wrap {
  flex: 1 1 auto;
  width: 100%;
  padding: 0 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.rates-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  direction: ltr;
}

.col-buy { width: 30%; }
.col-sell { width: 30%; }
.col-currency { width: 40%; }

.rates-table thead th {
  background: rgba(0, 0, 0, 0.3);
  padding: 12px 6px;
  font-size: clamp(0.95rem, 2vw, 1.6rem);
  font-weight: 700;
  text-align: center;
  border: none;
  position: sticky;
  top: 0;
  z-index: 1;
}

.rates-table tbody tr.data-row td {
  text-align: center;
  vertical-align: middle;
  padding: 16px 6px;
  font-size: clamp(0.95rem, 2.5vw, 2.2rem);
  font-weight: 700;
  line-height: 1.3;
  border-bottom: 2px solid rgba(255, 255, 255, 0.06);
}

.rates-table tbody tr.data-row:nth-child(odd) td {
  background: rgba(255, 255, 255, 0.1);
}

.rates-table tbody tr.data-row:nth-child(even) td {
  background: rgba(255, 255, 255, 0.05);
}

.rates-table tbody tr.data-row td.currency {
  text-align: right;
  padding-right: 12px;
  padding-left: 4px;
  font-size: clamp(0.85rem, 2.2vw, 2rem);
  line-height: 1.35;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.rates-table tbody tr.data-row td.buy,
.rates-table tbody tr.data-row td.sell {
  font-variant-numeric: tabular-nums;
}

.status-row td {
  padding: 40px 12px;
  text-align: center;
  border: none;
}

.status-message {
  font-size: clamp(0.95rem, 2vw, 1.3rem);
  opacity: 0.85;
}

.status-message.error {
  color: #ffcccc;
}

.status-message.loading::after {
  content: '';
  display: inline-block;
  width: 4px;
  animation: dots 1.4s infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* === FOOTER === */
.bulletin-footer {
  flex-shrink: 0;
  margin-top: 4px;
  padding: 16px 12px 20px;
  text-align: center;
  background: linear-gradient(180deg, transparent 0%, rgba(93, 16, 16, 0.95) 30%);
}

.footer-line {
  height: 2px;
  background: rgba(255, 255, 255, 0.5);
  margin: 0 16px 14px;
}

.bulletin-footer p {
  font-size: clamp(0.75rem, 1.6vw, 1.15rem);
  line-height: 1.65;
  opacity: 0.9;
  padding: 0 4px;
}

/* === UPDATE FLASH === */
.rates-table tbody tr.data-row.updated td {
  animation: flash 1.2s ease;
}

@keyframes flash {
  0% { background: rgba(255, 215, 0, 0.35); }
  100% { background: inherit; }
}

/* شاشات كبيرة: هوامش أوسع فقط */
@media (min-width: 769px) {
  .bulletin-header {
    padding: 28px 40px 20px;
  }

  .corner-left {
    left: 32px;
    border-width: 0 0 36px 36px;
  }

  .corner-right {
    right: 32px;
    border-width: 0 36px 36px 0;
  }

  .rates-table-wrap {
    padding: 0 40px;
  }

  .rates-table thead th {
    padding: 16px 12px;
  }

  .rates-table tbody tr.data-row td {
    padding: 20px 12px;
  }

  .rates-table tbody tr.data-row td.currency {
    padding-right: 24px;
  }

  .bulletin-footer {
    padding: 20px 40px 28px;
  }

  .footer-line {
    margin: 0 40px 16px;
  }
}

@media (min-width: 1200px) {
  .rates-table-wrap {
    max-width: 1100px;
    margin: 0 auto;
  }

  .bulletin-header h1 {
    font-size: 2.4rem;
  }
}
