@charset "utf-8";

#entry-dialog-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 998;

  &.is-processing {
    pointer-events: none;
    cursor: wait;
  }
}

#entry-dialog {
  margin: auto;
  padding: 0px;
  max-height: 90vh;
  overflow-y: auto;
  width: 90%;
  max-width: 500px;
  border: none;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 999;

  &.is-processing {
    pointer-events: none;
  }

  #entry-dialog-container {
    padding: 24px;

    .entry-dialog-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
      padding-bottom: 12px;
      border-bottom: 1px solid #eee;

      .entry-dialog-title {
        margin: 0;
        color: #333;
        font-size: 20px;
        font-weight: bold;
      }
    }

    .entry-dialog-footer {
      display: flex;
      justify-content: flex-start;
      gap: 12px;
      margin-top: 24px;

      button {
        padding: 10px 24px;
        border-radius: 6px;
        cursor: pointer;
      }

      #entry-dialog-submit {
        background-color: #007bff;
        color: white;
        border: none;
        font-weight: bold;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;

        &:disabled {
          background-color: #cccccc;
          color: #666666;
          cursor: not-allowed;
          opacity: 0.7;
        }

        &:hover:not(:disabled) {
          background-color: #0056b3;
        }

        &.is-loading {
          color: transparent;
          pointer-events: none;

          &::after {
            content: "";
            position: absolute;
            width: 16px;
            height: 16px;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-top-color: #fff;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
          }
        }
      }

      #entry-dialog-cancel {
        background: none;
        border: 1px solid #ccc;

        &:hover {
          background-color: #f8f9fa;
        }
      }
    }
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.entry-form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;

  .entry-form-label {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: bold;

    .required-badge {
      padding: 2px 2px;
      color: red;
      font-size: 1em;
      border-radius: 3px;
      vertical-align: middle;
    }
  }

  .entry-form-input {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    outline: none;
    box-sizing: border-box;
    width: 100%;

    &:focus {
      border-color: #007bff;
      box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
    }

    &.is-invalid {
      border-color: #d93025;
      background-color: #fff8f8;
    }
  }

  textarea.entry-form-input {
    min-height: 4.5em;
    line-height: 1.5;
    resize: none !important;
    font-family: inherit;
  }

  .entry-form-error-message {
    color: #d93025;
    font-size: 12px;
    margin-top: 4px;
    min-height: 1.6em;
  }
}

.file-upload-container {
  .file-input-dropzone {
    display: block;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background-color: #f9f9f9;
    cursor: pointer;
    transition: all 0.3s ease;

    &:hover {
      border-color: #007bff;
      background-color: #f0f7ff;
    }

    .dropzone-content {
      p {
        margin: 8px 0 0;
        color: #666;
        font-size: 14px;
      }
      span {
        color: #007bff;
        text-decoration: underline;
      }
    }

    #entry-file-input-element {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      border: 0;
    }
  }
}

.file-list-display {
  list-style: none;
  padding: 0;
  margin: 0;

  .file-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    background: #f4f4f4;
    padding: 5px 10px;
    border-radius: 4px;

    .file-list-name {
      font-size: 0.9em;
    }

    .remove-btn {
      color: red;
      border: none;
      background: none;
      cursor: pointer;
      padding: 2px 5px;
      transition: opacity 0.2s;

      &:hover {
        opacity: 0.7;
        text-decoration: underline;
      }
    }
  }
}
