/* Main container styles */
.main-content {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1 !important;
}

/* Clock Mode Styles */
.mode-container {
  width: 100%;
  height: fit-content;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.mode-container.active {
  opacity: 1;
  transform: translateY(0);
}

#clock-mode {
  min-width: 400px;
  max-width: 600px;
  width: 95%;
  padding: 25px 30px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  position: relative;
  z-index: 2;
  box-sizing: border-box;
  margin: 0 auto;
  overflow: hidden;
  animation: softPulse 4s infinite ease-in-out;
}

#clock-mode.active {
  display: flex;
}

/* Clock Display */
#clock-display {
  font-family: "Digital-7", monospace !important;
  font-size: clamp(60px, 12vw, 120px);
  color: #ff9800;
  text-shadow: 0 0 20px rgba(255, 152, 0, 0.5);
  margin: 0 auto;
  padding: 0;
  width: 100%;
  text-align: center;
  font-weight: bold;
  line-height: 1;
  letter-spacing: 0px !important;
  z-index: 3;
  position: relative;
  font-variant-numeric: tabular-nums;
  -moz-font-feature-settings: "tnum";
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";
  opacity: 0;
  transition: opacity 0.3s ease;
  display: block;
  box-sizing: border-box;
  white-space: nowrap;
  animation: clockAppear 0.5s ease forwards;
}

#clock-display.clock {
  opacity: 1;
}

/* Thêm style cho số 0 */
#clock-display::before {
  content: none;
}

/* Date Display */
.date {
  font-family: "vpssolah", "Digital-7", "clockicons", monospace;
  font-size: min(4vw, 28px);
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  text-align: center;
  margin: 0;
  padding: 0;
  letter-spacing: 0.03em;
  width: 100%;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  font-weight: 1000;
  z-index: 3;
  line-height: 1;
}

/* Container cho clock và date */
.time-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 8px;
  padding: 0;
  margin: 0 auto;
  box-sizing: border-box;
  animation: smoothFadeIn 0.7s ease-out;
  font-size: 6rem;
  margin: 20px 0;
}

.clock {
  font-family: "Digital-7", monospace !important;
  font-size: min(13vw, 120px);
  color: #ff9800;
  text-shadow: 0 0 20px rgba(255, 152, 0, 0.5);
  margin: 0 auto;
  padding: 0;
  width: 100%;
  text-align: center;
  font-weight: bold;
  line-height: 1;
  letter-spacing: 0px !important;
  z-index: 3;
  position: relative;
  font-variant-numeric: tabular-nums;
  -moz-font-feature-settings: "tnum";
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";
  animation: gentleGlow 3s ease-in-out infinite alternate;
}

.clock-face {
  font-size: 100px;
  width: 380px;
  height: 380px;
  padding: 20px;
}

.set-alarm-btn {
  background-color: #4caf50;
  color: white;
  border: none;
  padding: 10px 25px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);

  font-family: "Roboto", sans-serif;
  animation: float 3s ease-in-out infinite;
  position: relative;
  overflow: hidden;
  order: 3;
}

.set-alarm-btn:hover {
  background-color: #45a049;
  transform: scale(1.05);
}

.set-alarm-btn::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  transform: scale(0);
  opacity: 0;
  transition: all 0.4s ease;
}

.set-alarm-btn:active::after {
  transform: scale(2);
  opacity: 0;
  transition: 0s;
}

.stop-alarm-btn {
  background-color: #f44336;
  color: white;
  border: none;
  padding: 15px 35px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-transform: uppercase;
  font-weight: 600;
  width: 100%;
  box-shadow: 0 4px 20px rgba(244, 67, 54, 0.4);
  animation: pulse-red 2s infinite;
}

.stop-alarm-btn:hover {
  background-color: #d32f2f;
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(244, 67, 54, 0.5);
}

.stop-alarm-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 10px rgba(244, 67, 54, 0.3);
  transition: all 0.15s ease;
}

.active-alarm {
  position: relative;
  width: 90%;
  background: rgba(0, 0, 0, 0.95);
  border-radius: 15px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 152, 0, 0.3);
  z-index: 1000;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.active-alarm h2 {
  font-family: "vpssolah", monospace;
  font-size: 42px;
  color: #ff9800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-shadow: 0 0 15px rgba(255, 152, 0, 0.4);
  text-align: center;
  gap: 24px;
}

.alarm-time {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 25px;
  background: rgba(0, 0, 0, 0.5);
  line-height: normal;
  border-radius: 15px;
  border: 1px solid rgba(255, 152, 0, 0.2);
  animation: smoothBorder 3s infinite;
}

.alarm-icon {
  width: 48px;
  height: 48px;
  filter: invert(65%) sepia(50%) saturate(1000%) hue-rotate(360deg);
  animation: pulse 2s infinite;
  display: none !important;
}

#alarm-time-display {
  font-family: "vpssolah", monospace;
  font-size: 56px;
  color: #ff9800;
  letter-spacing: 0.02em;
  text-shadow: 0 0 20px rgba(255, 152, 0, 0.5);
}

#countdown-display {
  font-family: "vpssolah", monospace;
  font-size: 32px;
  color: #ff9800;
  opacity: 0.9;
  letter-spacing: 0.02em;
  padding: 20px 30px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  display: inline-block;
  border: 1px solid rgba(255, 152, 0, 0.2);
  animation: countdownPulse 1.5s infinite alternate ease-in-out;
  width: 100%;
  text-align: center;
}

@keyframes countdownPulse {
  from {
    opacity: 1;
    text-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
  }
  to {
    opacity: 0.8;
    text-shadow: 0 0 25px rgba(255, 152, 0, 0.7),
      0 0 40px rgba(255, 152, 0, 0.4);
  }
}

/* Fullscreen mode */
.fullscreen .main-content {
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  transform: none;
}

.fullscreen .clock-container {
  position: fixed;
  top: 50px;
  left: 70px;
  width: calc(100vw - 70px);
  height: calc(100vh - 50px);
  display: flex !important;
  justify-content: center;
  align-items: center;
  padding: 0;
  animation: fullscreenEnter 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.fullscreen #clock-mode {
  min-width: 500px;
  padding: 20px 28px;
  transform: none;
}

.fullscreen .clock {
  font-size: min(18vw, 160px);
  padding: 20px 40px;
  text-shadow: 0 0 30px rgba(255, 152, 0, 0.7);
}

.fullscreen .date {
  font-size: min(5vw, 32px);
}

.fullscreen .set-alarm-btn {
  transform: scale(1.2);
}

/* Modal footer buttons */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px;
  border-top: 1px solid #3a3a3a;
}

.start-btn,
.cancel-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.start-btn {
  background: #4caf50;
  color: white;
}

.cancel-btn {
  background: #f44336;
  color: white;
}

.start-btn:hover {
  background: #45a049;
}

.cancel-btn:hover {
  background: #d32f2f;
}

/* Nút thử âm thanh */
.sound-test-btn {
  padding: 8px;
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  transition: all 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}

.sound-test-btn:hover {
  background: #45a049;
}

/* Nút thử thông báo */
.notification-test-btn {
  background: #ff9800;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}

.notification-test-btn:hover {
  background: #f57c00;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes glow {
  from {
    text-shadow: 0 0 20px rgba(255, 152, 0, 0.5),
      0 0 40px rgba(255, 152, 0, 0.3), 0 0 60px rgba(255, 152, 0, 0.2);
  }
  to {
    text-shadow: 0 0 30px rgba(255, 152, 0, 0.7),
      0 0 50px rgba(255, 152, 0, 0.5), 0 0 70px rgba(255, 152, 0, 0.3);
  }
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
  }
}

/* Hiệu ứng khi báo thức đang hoạt động */
.active-alarm.ringing {
  animation: smoothShake 0.5s infinite;
  border-color: rgba(255, 152, 0, 0.5);
  box-shadow: 0 0 30px rgba(255, 152, 0, 0.3);
}

@keyframes smoothShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px);
  }
  40% {
    transform: translateX(4px);
  }
  60% {
    transform: translateX(-2px);
  }
  80% {
    transform: translateX(2px);
  }
}

.active-alarm.ringing .alarm-icon {
  animation: ring 0.5s ease infinite;
}

@keyframes ring {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(15deg);
  }
  75% {
    transform: rotate(-15deg);
  }
}

/* Animation cho thông báo */
.notification-modal .notification-content {
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    transform: translate(-50%, -60%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

/* Animation cho modal đặt báo thức */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: visibility 0s linear 0.3s, opacity 0.3s ease;
  pointer-events: none;
  z-index: 100;
}

.modal.show {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
  pointer-events: auto;
}

.modal-content {
  position: relative;
  transform: scale(0.9) translateY(-30px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform, opacity;
  width: min(90%, 500px);
  margin: auto;
  animation: modalEnter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.show .modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Hiệu ứng backdrop */
.modal::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(3px);
  will-change: opacity;
  z-index: -1;
}

.modal.show::before {
  opacity: 1;
}

/* Hiệu ứng cho form controls trong modal */
.form-group {
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.show .form-group {
  transform: translateY(0);
  opacity: 1;
}

.modal.show .form-group:nth-child(1) {
  transition-delay: 0.1s;
}
.modal.show .form-group:nth-child(2) {
  transition-delay: 0.15s;
}
.modal.show .form-group:nth-child(3) {
  transition-delay: 0.2s;
}

/* Hiệu ứng cho nút trong modal */
.modal-footer button {
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.show .modal-footer button {
  transform: translateY(0);
  opacity: 1;
}

.modal.show .modal-footer button:nth-child(1) {
  transition-delay: 0.4s;
}
.modal.show .modal-footer button:nth-child(2) {
  transition-delay: 0.45s;
}
.modal.show .modal-footer button:nth-child(3) {
  transition-delay: 0.5s;
}

/* Hiệu ứng khi đóng modal */
.modal:not(.show) .modal-content,
.modal:not(.show) .form-group,
.modal:not(.show) .modal-footer button {
  transition-delay: 0s;
}

/* Sound selector styles */
.sound-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.3);
  padding: 15px;
  border-radius: 15px;
}

.sound-selector label {
  font-size: 14px;
  color: #ffa500;
  font-weight: 600;
}

.sound-selector .input-group {
  display: flex;
  gap: 10px;
  flex: 1;
}

.sound-selector select {
  flex: 1;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 165, 0, 0.2);
  border-radius: 10px;
  color: #ffa500;
  font-size: 14px;
  cursor: pointer;
  font-family: "vpssolah", monospace;
  -webkit-appearance: none;
  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='%23ffa500' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 32px;
}

.sound-selector select option {
  background: rgba(0, 0, 0, 0.9);
  color: #ffa500;
  padding: 8px;
}

.sound-selector .test-sound {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 20px;
  background: #666;
  color: white;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sound-selector .test-sound:hover {
  background: #777;
  transform: scale(1.1);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .fullscreen #clock-mode {
    min-width: 500px;
    padding: 20px 28px;
  }
}

@media (max-width: 768px) {
  #clock-mode {
    min-width: 320px;
    padding: 1.5rem;
  }

  .active-alarm {
    width: 85%;
    padding: 1.5rem;
  }

  .active-alarm h2 {
    font-size: 36px;
  }

  #alarm-time-display {
    font-size: 48px;
  }

  #countdown-display {
    font-size: 28px;
    padding: 15px 25px;
  }

  .stop-alarm-btn {
    padding: 12px 30px;
    font-size: 16px;
  }

  .clock {
    font-size: min(14vw, 120px);
  }

  .date {
    font-size: min(3.5vw, 24px);
  }

  #clock-display {
    font-size: min(14vw, 120px);
  }

  .time-display {
    font-size: 4rem;
  }
}

@media (max-width: 480px) {
  #clock-mode {
    min-width: 260px;
    padding: 1.25rem;
  }

  .active-alarm {
    width: 90%;
    padding: 1rem;
  }

  .active-alarm h2 {
    font-size: 32px;
  }

  #alarm-time-display {
    font-size: 42px;
  }

  #countdown-display {
    font-size: 24px;
    padding: 12px 20px;
  }

  .stop-alarm-btn {
    padding: 10px 25px;
    font-size: 15px;
  }

  .clock {
    font-size: min(13vw, 100px);
  }

  .date {
    font-size: min(3vw, 20px);
  }

  #clock-display {
    font-size: min(13vw, 100px);
  }
}

/* Thêm phần căn giữa toàn màn hình */
.clock-container {
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: center top;
  will-change: transform;
}

/* Thống nhất z-index layers */
.main-content {
  z-index: 1;
}
.header {
  z-index: 10;
  position: fixed;
}
.sidebar {
  z-index: 20;
  position: fixed;
}
.modal {
  z-index: 100;
}
.notification-modal {
  z-index: 1000;
}

/* Ẩn icon góc trái khi có active alarm */
.active-alarm + .alarm-icon {
  display: none;
}

/* Giữ clock và date luôn hiển thị */
.clock,
.date {
  position: relative;
  z-index: 3;
}

/* Fullscreen adjustments */
.fullscreen .active-alarm {
  width: 80%;
  max-width: 600px;
  padding: 3rem;
}

/* Thống nhất lại z-index layers */
.background-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

/* Đảm bảo font được preload */
@font-face {
  font-family: "Digital-7";
  src: url("../fonts/digital-7.ttf") format("truetype");
  font-display: block;
}

@font-face {
  font-family: "vpssolah";
  src: url("../fonts/vpssolah.ttf") format("truetype");
  font-display: block;
}

/* Thêm các keyframe animation mới để tạo hiệu ứng mượt mà */
@keyframes clockAppear {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes softPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.02);
    opacity: 0.9;
  }
}

@keyframes smoothFadeIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes smoothBorder {
  0%,
  100% {
    border-color: rgba(255, 152, 0, 0.2);
  }
  50% {
    border-color: rgba(255, 152, 0, 0.6);
  }
}

@keyframes gentleGlow {
  0%,
  100% {
    text-shadow: 0 0 20px rgba(255, 152, 0, 0.5);
  }
  50% {
    text-shadow: 0 0 30px rgba(255, 152, 0, 0.7),
      0 0 50px rgba(255, 152, 0, 0.4);
  }
}

@keyframes smoothShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px);
  }
  40% {
    transform: translateX(4px);
  }
  60% {
    transform: translateX(-2px);
  }
  80% {
    transform: translateX(2px);
  }
}

/* Áp dụng các animation mới */
.time-display {
  animation: smoothFadeIn 0.7s ease-out;
}

.clock {
  animation: gentleGlow 3s ease-in-out infinite alternate;
}

#clock-mode {
  animation: softPulse 4s infinite ease-in-out;
}

.alarm-time {
  animation: smoothBorder 3s infinite;
}

/* Cải thiện animation cho thông báo báo thức */
.active-alarm.ringing {
  animation: smoothShake 0.5s infinite;
}

/* Cải thiện hiệu ứng cho nút dừng báo thức */
.stop-alarm-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 10px rgba(244, 67, 54, 0.3);
  transition: all 0.15s ease;
}

/* Hiệu ứng hover mượt hơn cho các nút */
.set-alarm-btn,
.stop-alarm-btn {
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.notification-test-btn,
.sound-test-btn {
  transition: all 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Hiệu ứng chuyển cảnh mượt mà cho modal */
.modal.show .modal-content {
  animation: modalEnter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(-30px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Hiệu ứng đếm ngược */
#countdown-display {
  animation: countdownPulse 1.5s infinite alternate ease-in-out;
}

@keyframes countdownPulse {
  from {
    opacity: 1;
    text-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
  }
  to {
    opacity: 0.8;
    text-shadow: 0 0 25px rgba(255, 152, 0, 0.7),
      0 0 40px rgba(255, 152, 0, 0.4);
  }
}

/* Điều chỉnh các nút điều khiển */
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Thêm keyframe cho animation fullscreen */
@keyframes fullscreenEnter {
  from {
    opacity: 0.7;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Thêm animation cho khi thoát chế độ fullscreen */
.clock-container {
  transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Animation khi mở player */
@keyframes smoothMove {
  0% { transform: translateX(0); }
  100% { transform: translateX(-120px); }
}

/* Animation khi đóng player */
@keyframes smoothReturn {
  0% { transform: translateX(-120px); }
  100% { transform: translateX(0); }
}

/* Class áp dụng cho clock container khi player mở */
.clock-container.player-open {
  animation: smoothMove 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* Class áp dụng cho clock container khi player đóng */
.clock-container.player-closed {
  animation: smoothReturn 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
