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

html, body {
  height: 100%;
  width: 100%;
  font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: transparent;
  direction: rtl;
  overflow-x: hidden;
}

/* Background with stars */
.bg {
  background: url(https://i.ibb.co/87GbbFP/2799006.jpg) no-repeat;
  background-size: cover;
  height: 100%;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: -3;
}

.bg:before {
  content: "";
  width: 100%;
  height: 100%;
  background: #000;
  position: fixed;
  z-index: -1;
  top: 0;
  left: 0;
  opacity: 0.15;
}

@keyframes sf-fly-by-1 {
  from {
    transform: translateZ(-600px);
    opacity: 0.5;
  }
  to {
    transform: translateZ(0);
    opacity: 0.5;
  }
}

@keyframes sf-fly-by-2 {
  from {
    transform: translateZ(-1200px);
    opacity: 0.5;
  }
  to {
    transform: translateZ(-600px);
    opacity: 0.5;
  }
}

@keyframes sf-fly-by-3 {
  from {
    transform: translateZ(-1800px);
    opacity: 0.5;
  }
  to {
    transform: translateZ(-1200px);
    opacity: 0.5;
  }
}

.star-field {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  perspective: 600px;
  -webkit-perspective: 600px;
  z-index: -1;
}

.star-field .layer {
  box-shadow: -411px -476px #cccccc, 777px -407px #d4d4d4, -387px -477px #fcfcfc, -91px -235px #d4d4d4, 491px -460px #f7f7f7, 892px -128px #f7f7f7, 758px -277px #ededed, 596px 378px #cccccc, 647px 423px whitesmoke, 183px 389px #c7c7c7,
    524px -237px #f0f0f0, 679px -535px #e3e3e3, 158px 399px #ededed, 157px 249px #ededed, 81px -450px #ebebeb, 719px -360px #c2c2c2, -499px 473px #e8e8e8, -158px -349px #d4d4d4, 870px -134px #cfcfcf, 446px 404px #c2c2c2,
    440px 490px #d4d4d4, 414px 507px #e6e6e6, -12px 246px #fcfcfc, -384px 369px #e3e3e3, 641px -413px #fcfcfc, 822px 516px #dbdbdb, 449px 132px #c2c2c2, 727px 146px #f7f7f7, -315px -488px #e6e6e6, 952px -70px #e3e3e3,
    -869px -29px #dbdbdb, 502px 80px #dedede, 764px 342px #e0e0e0, -150px -380px #dbdbdb, 654px -426px #e3e3e3, -325px -263px #c2c2c2, 755px -447px #c7c7c7, 729px -177px #c2c2c2, -682px -391px #e6e6e6, 554px -176px #ededed,
    -85px -428px #d9d9d9, 714px 55px #e8e8e8, 359px -285px #cfcfcf, -362px -508px #dedede, 468px -265px #fcfcfc, 74px -500px #c7c7c7, -514px 383px #dbdbdb, 730px -92px #cfcfcf, -112px 287px #c9c9c9, -853px 79px #d6d6d6,
    828px 475px #d6d6d6, -681px 13px #fafafa, -176px 209px #f0f0f0, 758px 457px #fafafa, -383px -454px #ededed, 813px 179px #d1d1d1, 608px 98px whitesmoke, -860px -65px #c4c4c4, -572px 272px #f7f7f7, 459px 533px #fcfcfc,
    624px -481px #e6e6e6, 790px 477px #dedede, 731px -403px #ededed, 70px -534px #cccccc, -23px 510px #cfcfcf, -652px -237px whitesmoke, -690px 367px #d1d1d1, 810px 536px #d1d1d1, 774px 293px #c9c9c9, -362px 97px #c2c2c2,
    563px 47px #dedede, 313px 475px #e0e0e0, 839px -491px #e3e3e3, -217px 377px #d4d4d4, -581px 239px #c2c2c2, -857px 72px #cccccc, -23px 340px #dedede, -837px 246px white, 170px -502px #cfcfcf, 822px -443px #e0e0e0, 795px 497px #e0e0e0,
    -814px -337px #cfcfcf, 206px -339px #f2f2f2, -779px 108px #e6e6e6, 808px 2px #d4d4d4, 665px 41px #d4d4d4, -564px 64px #cccccc, -380px 74px #cfcfcf, -369px -60px #f7f7f7, 47px -495px #e3e3e3, -383px 368px #f7f7f7, 419px 288px #d1d1d1,
    -598px -50px #c2c2c2, -833px 187px #c4c4c4, 378px 325px whitesmoke, -703px 375px #d6d6d6, 392px 520px #d9d9d9, -492px -60px #c4c4c4, 759px 288px #ebebeb, 98px -412px #c4c4c4, -911px -277px #c9c9c9;
  transform-style: preserve-3d;
  position: absolute;
  top: 50%;
  left: 50%;
  height: 4px;
  width: 4px;
  border-radius: 2px;
}

.star-field .layer:nth-child(1) {
  animation: sf-fly-by-1 5s linear infinite;
}

.star-field .layer:nth-child(2) {
  animation: sf-fly-by-2 5s linear infinite;
}

.star-field .layer:nth-child(3) {
  animation: sf-fly-by-3 5s linear infinite;
}

.con {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.app-header {
  opacity: 76%;
  text-align: center;
  margin-bottom: 40px;
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.15), rgba(72, 61, 139, 0.15));
  padding: 30px;
  border-radius: 25px;
  box-shadow: 0 20px 60px rgba(138, 43, 226, 0.3);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(138, 43, 226, 0.2);
  width: 100%;
  max-width: 550px;
}

.app-header h1 {
  color: #E6E6FA;
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 15px;
  text-shadow: 0 0 30px rgba(138, 43, 226, 0.7), 0 4px 8px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #E6E6FA, #9966CC);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.task-counter {
  display: flex;
  justify-content: space-around;
  gap: 15px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.counter-item {
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.15), rgba(72, 61, 139, 0.15));
  color: #FFFFFF;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(138, 43, 226, 0.3);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(138, 43, 226, 0.4);
  opacity: 83%;

}

.search-container {
  width: 100%;
  max-width: 500px;
  margin-bottom: 20px;
}

.search-input {
  width: 100%;
  padding: 18px 20px;
  border: 2px solid rgba(138, 43, 226, 0.4);
  border-radius: 30px;
  font-size: 1.1rem;
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.15), rgba(72, 61, 139, 0.15));
  color: white;
  box-shadow: 0 8px 32px rgba(138, 43, 226, 0.3);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(20px);
  text-align: right;
  opacity: 75%;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.search-input:focus {
  outline: none;
  box-shadow: 0 12px 40px rgba(138, 43, 226, 0.5), 0 0 0 4px rgba(138, 43, 226, 0.2);
  transform: translateY(-3px);
  border-color: #9966CC;
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.2), rgba(72, 61, 139, 0.2));
}

.input-container {
  opacity: 75%;
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.15), rgba(72, 61, 139, 0.15));
  padding: 35px;
  border-radius: 25px;
  box-shadow: 0 20px 60px rgba(138, 43, 226, 0.3);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(138, 43, 226, 0.2);
  width: 100%;
  max-width: 550px;
  margin-bottom: 40px;
}

.task-input {
  opacity: 65%;
  width: 100%;
  padding: 18px 24px;
  border: 2px solid rgba(138, 43, 226, 0.4);
  border-radius: 30px;
  font-size: 1.1rem;
  color: white;
  margin-bottom: 20px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.15), rgba(72, 61, 139, 0.15));
  backdrop-filter: blur(20px);
  text-align: right;
  font-weight: 500;
}

.task-input::placeholder {
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.task-input:focus {
  outline: none;
  border-color: #9966CC;
  box-shadow: 0 12px 40px rgba(138, 43, 226, 0.5), 0 0 0 4px rgba(138, 43, 226, 0.2);
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.2), rgba(72, 61, 139, 0.2));
}

.button-group {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 16px 30px;
  border: none;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'Cairo', sans-serif;
  min-width: 150px;
  backdrop-filter: blur(20px);
  letter-spacing: 0.2px;
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  will-change: transform;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}

.btn-add {
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.85), rgba(0, 242, 254, 0.85));
  color: white;
  box-shadow: 0 8px 32px rgba(79, 172, 254, 0.4), 0 4px 16px rgba(0, 242, 254, 0.2);
  display: none;
}

.btn-add:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(79, 172, 254, 0.4);
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.9), rgba(0, 242, 254, 0.9));
}

.btn-clear {
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.85), rgba(72, 61, 139, 0.85));
  color: white;
  box-shadow: 0 8px 32px rgba(138, 43, 226, 0.4), 0 4px 16px rgba(72, 61, 139, 0.2);
  display: none;
}

.btn-clear:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(138, 43, 226, 0.4);
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.9), rgba(72, 61, 139, 0.9));
}

.list-container {
  width: 100%;
  max-width: 600px;
  flex-grow: 1;
}

.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 0;
}

.task-item {
  display: flex;
  align-items: center;
  padding: 20px 30px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50px;
  box-shadow: 0 8px 30px rgba(79, 172, 254, 0.15);
  transition: all 0.3s ease;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(79, 172, 254, 0.15);
  position: relative;
  overflow: hidden;
  margin-bottom: 5px;
  height: 100px;
  width: 100%;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  min-width: 0;
  flex-wrap: nowrap;
}

.task-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, #4FACFE, #00F2FE);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.task-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(79, 172, 254, 0.3);
  background: rgba(255, 255, 255, 0.15);
}

.task-item:hover::before {
  opacity: 1;
}

.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(45deg, #4FACFE, #00F2FE);
  margin-left: 10px;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(79, 172, 254, 0.5);
}

.task-checkbox {
  margin: 0 15px;
  transform: scale(1.3);
  cursor: pointer;
  accent-color: #4FACFE;
}

.task-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.task-text {
  font-size: 1.1rem;
  color: #FFFFFF;
  font-weight: 500;
  transition: all 0.3s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
  max-height: 2.8em;
}

.task-date {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edit-btn, .delete-btn {
  background: linear-gradient(135deg, rgba(100, 149, 237, 0.2), rgba(135, 206, 250, 0.2));
  border: 1px solid rgba(100, 149, 237, 0.3);
  font-size: 1rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
  margin: 0 2px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  backdrop-filter: blur(15px);
  box-shadow: 0 3px 12px rgba(100, 149, 237, 0.25);
  position: relative;
  overflow: hidden;
}

.edit-btn::before, .delete-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.edit-btn:hover::before, .delete-btn:hover::before {
  opacity: 1;
}

.edit-btn:hover {
  background: linear-gradient(135deg, rgba(100, 149, 237, 0.35), rgba(135, 206, 250, 0.35));
  transform: scale(1.1) rotate(3deg);
  box-shadow: 0 6px 18px rgba(100, 149, 237, 0.4);
  border-color: rgba(100, 149, 237, 0.5);
}

.delete-btn {
  background: linear-gradient(135deg, rgba(147, 112, 219, 0.2), rgba(186, 85, 211, 0.2));
  border-color: rgba(147, 112, 219, 0.3);
  box-shadow: 0 3px 12px rgba(147, 112, 219, 0.25);
}

.delete-btn:hover {
  background: linear-gradient(135deg, rgba(147, 112, 219, 0.35), rgba(186, 85, 211, 0.35));
  transform: scale(1.1) rotate(-3deg);
  box-shadow: 0 6px 18px rgba(147, 112, 219, 0.4);
  border-color: rgba(147, 112, 219, 0.5);
}

.edit-btn:active, .delete-btn:active {
  transform: scale(1.05);
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    max-width: 350px;
    color: #fff;
    background: rgba(90, 62, 133, 0.25);
    backdrop-filter: blur(15px);
    transform: translateY(-120px) scale(0.8);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    will-change: transform, opacity;
}

.notification.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.notification.success {
    background: rgba(46, 213, 115, 0.2);
    box-shadow: 0 8px 25px rgba(46, 213, 115, 0.15);
    border-color: rgba(46, 213, 115, 0.3);
}

.notification.completion {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 140, 0, 0.25));
    box-shadow: 0 12px 35px rgba(255, 215, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.4);
    max-width: 400px;
    padding: 20px 25px;
    font-size: 16px;
}

.completion-notification {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.completion-icon {
    font-size: 2.5rem;
    animation: bounce 1s ease-in-out;
}

.completion-text {
    font-size: 1.1rem;
    line-height: 1.4;
}

.completion-stars {
    font-size: 1.2rem;
    animation: sparkle 1.5s ease-in-out infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.notification.error {
    background: rgba(255, 71, 87, 0.2);
    box-shadow: 0 8px 25px rgba(255, 71, 87, 0.15);
    border-color: rgba(255, 71, 87, 0.3);
}

.notification.warning {
    background: rgba(255, 165, 2, 0.2);
    box-shadow: 0 8px 25px rgba(255, 165, 2, 0.15);
    border-color: rgba(255, 165, 2, 0.3);
}


.app-footer {
  margin-top: 30px;
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animation keyframes */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Loading animation */
.task-item {
  animation: fadeInUp 0.5s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
  .con {
    padding: 15px;
  }

  .app-header {
    margin-bottom: 25px;
    padding: 20px;
  }

  .app-header h1 {
    font-size: 2.2rem;
  }

  .task-counter {
    flex-direction: column;
    gap: 10px;
  }

  .counter-item {
    text-align: center;
    padding: 10px 20px;
  }

  .search-container, .input-container {
    max-width: 100%;
  }

  .search-input, .task-input {
    padding: 16px 20px;
    font-size: 1rem;
  }

  .input-container {
    padding: 25px 20px;
  }

  .button-group {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }

  .btn {
    width: 100%;
    max-width: 280px;
    padding: 16px 30px;
    font-size: 1rem;
  }

  .task-item {
    padding: 15px 20px;
    height: 80px;
    max-width: 100%;
    border-radius: 40px;
  }

  .task-content {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .task-text {
    font-size: 1rem;
    line-height: 1.3;
    max-height: 2.6em;
    -webkit-line-clamp: 2;
  }






}

@media (max-width: 480px) {
  .con {
    padding: 8px;
  }

  .app-header {
    padding: 15px 12px;
    margin-bottom: 20px;
  }

  .app-header h1 {
    font-size: 1.8rem;
  }

  .search-input, .task-input {
    padding: 16px 18px;
    font-size: 1rem;
    border-radius: 25px;
  }

  .input-container {
    padding: 18px 12px;
    margin-bottom: 25px;
  }

  .task-item {
    padding: 15px 18px;
    height: auto;
    min-height: 75px;
    border-radius: 25px;
    gap: 12px;
  }

  .task-content {
    flex: 1;
    min-width: 0;
  }

  .task-text {
    font-size: 0.95rem;
    line-height: 1.3;
    max-height: none;
    -webkit-line-clamp: unset;
    white-space: normal;
    word-break: break-word;
  }

  .task-date {
    font-size: 0.75rem;
    margin-top: 4px;
  }

  .btn {
    padding: 16px 25px;
    font-size: 1rem;
    min-width: 130px;
    border-radius: 30px;
    margin: 4px;
  }

  .edit-btn, .delete-btn {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    margin: 0 3px;
  }

  .task-actions {
    flex-shrink: 0;
    gap: 8px;
  }

  .notification {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
    font-size: 13px;
    padding: 12px 15px;
  }

  .notification.completion {
    padding: 18px 20px;
    font-size: 15px;
  }

  .completion-icon {
    font-size: 2rem;
  }

  .task-counter {
    flex-direction: column;
    gap: 8px;
  }

  .counter-item {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}

/* Dark mode improvements */
.task-item.completed {
  background: rgba(255, 255, 255, 0.05);
  opacity: 0.7;
}

.task-item.completed .task-text {
  text-decoration: line-through;
  color: rgba(255, 255, 255, 0.6);
}

/* Enhanced hover effects */
.btn:active {
  transform: translateY(-1px) scale(0.98);
}

.task-checkbox:hover {
  transform: scale(1.4);
}

/* Improved loading states */
.loading {
  opacity: 0.5;
  pointer-events: none;
}

/* Better scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(45deg, #4FACFE, #00F2FE);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(45deg, #00F2FE, #4FACFE);
}
