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

body .nashrieh-date-converter-widget {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #B8B8B8;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

/* Flipping Clock Styles */
.flipping-clock-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
}

.input-section {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 2rem 1.5rem 1.5rem 1.5rem;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-width: 1400px;
  width: 100%;
  direction: rtl;
}

@media (min-width: 1025px) {
  .input-section {
    flex-wrap: nowrap;
  }
}

.input-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  direction: rtl;
  flex-shrink: 0;
  white-space: nowrap;
}

.date-input-label {
  font-size: 1rem;
  color: #000000;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  direction: rtl;
  font-family: 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  white-space: nowrap;
}

.date-input-label:not(.calendar-title-farsi) {
  text-transform: none;
  letter-spacing: normal;
}

.calendar-type-select {
  padding: 0.5rem 1.25rem;
  font-size: 1rem;
  line-height: 1.5;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  background: #f5f5f5;
  color: #333333;
  cursor: pointer;
  font-weight: 400;
  min-width: 180px;
  direction: rtl;
  text-align: right;
  box-shadow: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23333333' d='M5 7.5L1 2.5h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.8rem center;
  padding-right: 2.5rem;
  box-sizing: border-box;
  height: auto;
}

.calendar-type-select:hover {
  background-color: #f0f0f0;
  border-color: #c0c0c0;
}

.calendar-type-select:focus {
  outline: none;
  background-color: #f5f5f5;
  border-color: #a0a0a0;
}

.calendar-type-select option {
  background: #f5f5f5;
  color: #333333;
}

.date-input {
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  background: #ffffff;
  color: #000000;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  direction: rtl;
  text-align: right;
}

.date-input:hover {
  background: #f5f5f5;
  border-color: rgba(0, 0, 0, 0.3);
}

.date-input:focus {
  outline: none;
  background: #f5f5f5;
  border-color: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.date-input-container {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.75rem;
  align-items: center;
  direction: rtl;
  width: auto;
  min-width: 0;
  flex-shrink: 0;
  padding: 0;
  background: transparent;
}

.date-field-wrapper {
  position: relative;
  display: inline-block;
  direction: rtl;
}

.date-field-label {
  position: absolute;
  top: -1.5rem;
  right: 0;
  font-size: 0.875rem;
  color: #333333;
  font-weight: 500;
  direction: rtl;
  font-family: 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  white-space: nowrap;
  margin: 0;
  padding: 0;
}

.date-year-field {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  background: #f5f5f5;
  color: #333333;
  cursor: text;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  font-weight: 400;
  direction: rtl;
  text-align: right;
  flex-shrink: 0;
  flex-grow: 0;
  font-family: 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  box-shadow: none;
  overflow: visible;
  white-space: nowrap;
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  pointer-events: auto;
  box-sizing: border-box;
  height: auto;
}

.date-year-field:hover {
  background-color: #f0f0f0;
  border-color: #c0c0c0;
}

.date-year-field:focus {
  outline: none;
  background-color: #ffffff;
  border-color: #a0a0a0;
}

.date-year-field::placeholder {
  color: #999999;
  text-align: right;
}

.date-month-field {
  width: 160px;
  min-width: 160px;
  max-width: 160px;
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  background: #f5f5f5;
  color: #333333;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 400;
  direction: rtl;
  text-align: right;
  flex-shrink: 0;
  flex-grow: 0;
  font-family: 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  box-shadow: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23333333' d='M5 7.5L1 2.5h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.8rem center;
  overflow: visible;
  white-space: nowrap;
  text-overflow: ellipsis;
  box-sizing: border-box;
  height: auto;
}

.date-month-field:hover {
  background-color: #f0f0f0;
  border-color: #c0c0c0;
}

.date-month-field:focus {
  outline: none;
  background-color: #f5f5f5;
  border-color: #a0a0a0;
}

.date-month-field option {
  background: #f5f5f5;
  color: #333333;
  padding: 0.5rem;
}

.date-day-field {
  width: 75px;
  min-width: 75px;
  max-width: 75px;
  padding: 0.5rem 0.5rem 0.5rem 2.5rem;
  font-size: 1rem;
  line-height: 1.5;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  background: #f5f5f5;
  color: #333333;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 400;
  direction: rtl;
  text-align: right;
  flex-shrink: 0;
  flex-grow: 0;
  font-family: 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  box-shadow: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23333333' d='M5 7.5L1 2.5h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.8rem center;
  overflow: visible;
  white-space: nowrap;
  box-sizing: border-box;
  height: auto;
}

.date-day-field:hover {
  background-color: #f0f0f0;
  border-color: #c0c0c0;
}

.date-day-field:focus {
  outline: none;
  background-color: #f5f5f5;
  border-color: #a0a0a0;
}

.date-day-field option {
  background: #f5f5f5;
  color: #333333;
  text-align: right;
  padding: 0.5rem;
}

.calendars-display {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  max-width: 1400px;
}

.calendar-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.calendar-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  direction: ltr;
  width: 100%;
  padding-right: 10%;
  padding-left: 5%;
}

.calendar-title {
  font-size: 1.5rem;
  color: #000000;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.calendar-title-farsi {
  direction: rtl;
  text-transform: none;
  letter-spacing: normal;
  font-family: 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

.copy-button {
  background: #00425d !important;
  background-image: none !important;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  color: #ffffff !important;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  width: 36px;
  height: 36px;
}

.copy-button:hover {
  background: #003548 !important;
  background-image: none !important;
  border-color: rgba(0, 0, 0, 0.3);
  color: #ffffff !important;
  transform: scale(1.05);
}

.copy-button:active {
  transform: scale(0.95);
}

.copy-button-farsi {
  width: auto;
  padding: 0.5rem 1rem;
  font-family: 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  direction: rtl;
  font-size: 0.875rem;
  font-weight: 500;
}

.copy-all-button {
  background: #00425d !important;
  background-image: none !important;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  color: #ffffff !important;
  cursor: pointer;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  margin-top: 1rem;
  width: 50%;
  margin-left: auto;
  margin-right: auto;
  font-family: 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  direction: rtl;
  font-size: 0.875rem;
  font-weight: 500;
}

.copy-all-button:hover {
  background: #003548 !important;
  background-image: none !important;
  border-color: rgba(0, 0, 0, 0.3);
  color: #ffffff !important;
  transform: scale(1.05);
}

.copy-all-button:active {
  transform: scale(0.95);
}

.date-section {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.flip-card-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.flip-card-label {
  font-size: 0.875rem;
  color: #000000;
  font-weight: 500;
  direction: rtl;
  text-transform: none;
  letter-spacing: normal;
  font-family: 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

.flip-card {
  perspective: 1000px;
  width: 100px;
  height: 90px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flip-card.flipping .flip-card-inner {
  transform: rotateX(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  padding: 1rem;
  overflow: hidden;
}

.flip-card-front {
  background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
  border: 2px solid rgba(0, 0, 0, 0.1);
}

.flip-card-back {
  background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
  border: 2px solid rgba(0, 0, 0, 0.1);
  transform: rotateX(180deg);
}

.flip-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #000000;
  text-shadow: none;
  font-variant-numeric: tabular-nums;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  line-height: 1.2;
  text-overflow: ellipsis;
  overflow: hidden;
  direction: rtl;
}

.flip-card.farsi-font .flip-card-value {
  font-family: 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

.flip-card.arabic-font .flip-card-value {
  font-family: 'Amiri', 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

.flip-card.long-text {
  width: 180px;
}

.flip-card.long-text .flip-card-value {
  font-size: 1.25rem;
}

.flip-card.wide {
  width: 120px;
}

/* Responsive design */
@media (max-width: 1024px) {
  .input-section {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .flipping-clock-container {
    gap: 1rem;
  }

  .input-section {
    flex-direction: column;
    padding: 0.75rem;
  }

  .date-section {
    gap: 1rem;
  }

  .date-input {
    font-size: 1rem;
    padding: 0.75rem 1rem;
  }

  .date-input-label {
    font-size: 1rem;
  }

  .calendar-type-select {
    font-size: 1rem;
    padding: 0.75rem 1rem;
    min-width: 200px;
  }

  .calendar-title {
    font-size: 1.5rem;
  }

  .calendars-display {
    gap: 1.5rem;
  }

  .flip-card {
    width: 80px;
    height: 75px;
  }

  .flip-card-value {
    font-size: 1.5rem;
  }

  .flip-card.long-text {
    width: 140px;
  }

  .flip-card.long-text .flip-card-value {
    font-size: 1rem;
  }

  .flip-card.wide {
    width: 100px;
  }

  .flip-card-label {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .date-section {
    flex-direction: column;
    gap: 0.75rem;
  }

  .flip-card {
    width: 70px;
    height: 70px;
  }

  .flip-card-value {
    font-size: 1.25rem;
  }

  .flip-card.long-text {
    width: 120px;
  }

  .flip-card.long-text .flip-card-value {
    font-size: 0.875rem;
  }

  .flip-card.wide {
    width: 85px;
  }
}